vendor: 5,999 bytes, lines 1-9
1var sme=Object.defineProperty;var J6=t=>{throw TypeError(t)};var ome=(t,e,i)=>e in t?sme(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var je=(t,e,i)=>ome(t,typeof e!="symbol"?e+"":e,i),ZR=(t,e,i)=>e.has(t)||J6("Cannot "+i);var he=(t,e,i)=>(ZR(t,e,"read from private field"),i?i.call(t):e.get(t)),Wt=(t,e,i)=>e.has(t)?J6("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),Jt=(t,e,i,n)=>(ZR(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),ci=(t,e,i)=>(ZR(t,e,"access private method"),i);var PA=(t,e,i,n)=>({set _(o){Jt(t,e,o,i)},get _(){return he(t,e,n)}});function ame(t,e){for(var i=0;i<e.length;i++){const n=e[i];if(typeof n!="string"&&!Array.isArray(n)){for(const o in n)if(o!=="default"&&!(o in t)){const c=Object.getOwnPropertyDescriptor(n,o);c&&Object.defineProperty(t,o,c.get?c:{enumerable:!0,get:()=>n[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).observe(document,{childList:!0,subtree:!0});function i(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(o){if(o.ep)return;o.ep=!0;const c=i(o);fetch(o.href,c)}})();var LS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nX={exports:{}},kN={},rX={exports:{}},Jr={};/** 2 * @license React 3 * react.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var rE=Symbol.for("react.element"),lme=Symbol.for("react.portal"),cme=Symbol.for("react.fragment"),ume=Symbol.for("react.strict_mode"),dme=Symbol.for("react.profiler"),hme=Symbol.for("react.provider"),pme=Symbol.for("react.context"),fme=Symbol.for("react.forward_ref"),mme=Symbol.for("react.suspense"),gme=Symbol.for("react.memo"),yme=Symbol.for("react.lazy"),e$=Symbol.iterator;function _me(t){return t===null||typeof t!="object"?null:(t=e$&&t[e$]||t["@@iterator"],typeof t=="function"?t:null)}var sX={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oX=Object.assign,aX={};function qb(t,e,i){this.props=t,this.context=e,this.refs=aX,this.updater=i||sX}qb.prototype.isReactComponent={};qb.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")};qb.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lX(){}lX.prototype=qb.prototype;function UF(t,e,i){this.props=t,this.context=e,this.refs=aX,this.updater=i||sX}var VF=UF.prototype=new lX;VF.constructor=UF;oX(VF,qb.prototype);VF.isPureReactComponent=!0;var t$=Array.isArray,cX=Object.prototype.hasOwnProperty,$F={current:null},uX={key:!0,ref:!0,__self:!0,__source:!0};function dX(t,e,i){var n,o={},c=null,f=null;if(e!=null)for(n in e.ref!==void 0&&(f=e.ref),e.key!==void 0&&(c=""+e.key),e)cX.call(e,n)&&!uX.hasOwnProperty(n)&&(o[n]=e[n]);var r=arguments.length-2;if(r===1)o.children=i;else if(1<r){for(var x=Array(r),S=0;S<r;S++)x[S]=arguments[S+2];o.children=x}if(t&&t.defaultProps)for(n in r=t.defaultProps,r)o[n]===void 0&&(o[n]=r[n]);return{$$typeof:rE,type:t,key:c,ref:f,props:o,_owner:$F.current}}function vme(t,e){return{$$typeof:rE,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function qF(t){return typeof t=="object"&&t!==null&&t.$$typeof===rE}function xme(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(i){return e[i]})}var i$=/\/+/g;function XR(t,e){return typeof t=="object"&&t!==null&&t.key!=null?xme(""+t.key):e.toString(36)}function NI(t,e,i,n,o){var c=typeof t;(c==="undefined"||c==="boolean")&&(t=null);var f=!1;if(t===null)f=!0;else switch(c){case"string":case"number":f=!0;break;case"object":switch(t.$$typeof){case rE:case lme:f=!0}}if(f)return f=t,o=o(f),t=n===""?"."+XR(f,0):n,t$(o)?(i="",t!=null&&(i=t.replace(i$,"$&/")+"/"),NI(o,e,i,"",function(S){return S})):o!=null&&(qF(o)&&(o=vme(o,i+(!o.key||f&&f.key===o.key?"":(""+o.key).replace(i$,"$&/")+"/")+t)),e.push(o)),1;if(f=0,n=n===""?".":n+":",t$(t))for(var r=0;r<t.length;r++){c=t[r];var x=n+XR(c,r);f+=NI(c,e,i,x,o)}else if(x=_me(t),typeof x=="function")for(t=x.call(t),r=0;!(c=t.next()).done;)c=c.value,x=n+XR(c,r++),f+=NI(c,e,i,x,o);else if(c==="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 f}function NA(t,e,i){if(t==null)return t;var n=[],o=0;return NI(t,n,"","",function(c){return e.call(i,c,o++)}),n}function bme(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(i){(t._status===0||t._status===-1)&&(t._status=1,t._result=i)},function(i){(t._status===0||t._status===-1)&&(t._status=2,t._result=i)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var dc={current:null},MI={transition:null},wme={ReactCurrentDispatcher:dc,ReactCurrentBatchConfig:MI,ReactCurrentOwner:$F};function hX(){throw Error("act(...) is not supported in production builds of React.")}
vendor: 4,128 bytes, lines 9-25
9Jr.Children={map:NA,forEach:function(t,e,i){NA(t,function(){e.apply(this,arguments)},i)},count:function(t){var e=0;return NA(t,function(){e++}),e},toArray:function(t){return NA(t,function(e){return e})||[]},only:function(t){if(!qF(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Jr.Component=qb;Jr.Fragment=cme;Jr.Profiler=dme;Jr.PureComponent=UF;Jr.StrictMode=ume;Jr.Suspense=mme;Jr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wme;Jr.act=hX;Jr.cloneElement=function(t,e,i){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var n=oX({},t.props),o=t.key,c=t.ref,f=t._owner;if(e!=null){if(e.ref!==void 0&&(c=e.ref,f=$F.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var r=t.type.defaultProps;for(x in e)cX.call(e,x)&&!uX.hasOwnProperty(x)&&(n[x]=e[x]===void 0&&r!==void 0?r[x]:e[x])}var x=arguments.length-2;if(x===1)n.children=i;else if(1<x){r=Array(x);for(var S=0;S<x;S++)r[S]=arguments[S+2];n.children=r}return{$$typeof:rE,type:t.type,key:o,ref:c,props:n,_owner:f}};Jr.createContext=function(t){return t={$$typeof:pme,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:hme,_context:t},t.Consumer=t};Jr.createElement=dX;Jr.createFactory=function(t){var e=dX.bind(null,t);return e.type=t,e};Jr.createRef=function(){return{current:null}};Jr.forwardRef=function(t){return{$$typeof:fme,render:t}};Jr.isValidElement=qF;Jr.lazy=function(t){return{$$typeof:yme,_payload:{_status:-1,_result:t},_init:bme}};Jr.memo=function(t,e){return{$$typeof:gme,type:t,compare:e===void 0?null:e}};Jr.startTransition=function(t){var e=MI.transition;MI.transition={};try{t()}finally{MI.transition=e}};Jr.unstable_act=hX;Jr.useCallback=function(t,e){return dc.current.useCallback(t,e)};Jr.useContext=function(t){return dc.current.useContext(t)};Jr.useDebugValue=function(){};Jr.useDeferredValue=function(t){return dc.current.useDeferredValue(t)};Jr.useEffect=function(t,e){return dc.current.useEffect(t,e)};Jr.useId=function(){return dc.current.useId()};Jr.useImperativeHandle=function(t,e,i){return dc.current.useImperativeHandle(t,e,i)};Jr.useInsertionEffect=function(t,e){return dc.current.useInsertionEffect(t,e)};Jr.useLayoutEffect=function(t,e){return dc.current.useLayoutEffect(t,e)};Jr.useMemo=function(t,e){return dc.current.useMemo(t,e)};Jr.useReducer=function(t,e,i){return dc.current.useReducer(t,e,i)};Jr.useRef=function(t){return dc.current.useRef(t)};Jr.useState=function(t){return dc.current.useState(t)};Jr.useSyncExternalStore=function(t,e,i){return dc.current.useSyncExternalStore(t,e,i)};Jr.useTransition=function(){return dc.current.useTransition()};Jr.version="18.3.1";rX.exports=Jr;var K=rX.exports;const Tn=Xh(K),pX=ame({__proto__:null,default:Tn},[K]);/** 10 * @license React 11 * react-jsx-runtime.production.min.js 12 * 13 * Copyright (c) Facebook, Inc. and its affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var Sme=K,Tme=Symbol.for("react.element"),Cme=Symbol.for("react.fragment"),Eme=Object.prototype.hasOwnProperty,Ame=Sme.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ime={key:!0,ref:!0,__self:!0,__source:!0};function fX(t,e,i){var n,o={},c=null,f=null;i!==void 0&&(c=""+i),e.key!==void 0&&(c=""+e.key),e.ref!==void 0&&(f=e.ref);for(n in e)Eme.call(e,n)&&!Ime.hasOwnProperty(n)&&(o[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps,e)o[n]===void 0&&(o[n]=e[n]);return{$$typeof:Tme,type:t,key:c,ref:f,props:o,_owner:Ame.current}}kN.Fragment=Cme;kN.jsx=fX;kN.jsxs=fX;nX.exports=kN;var d=nX.exports,mX={exports:{}},cu={},gX={exports:{}},yX={};/** 18 * @license React 19 * scheduler.production.min.js 20 * 21 * Copyright (c) Facebook, Inc. and its affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */(function(t){function e(Fe,lt){var pt=Fe.length;Fe.push(lt);e:for(;0<pt;){var Ge=pt-1>>>1,Rt=Fe[Ge];
vendor: 10,808 bytes, lines 25-34
25if(0<o(Rt,lt))Fe[Ge]=lt,Fe[pt]=Rt,pt=Ge;else break e}}function i(Fe){return Fe.length===0?null:Fe[0]}function n(Fe){if(Fe.length===0)return null;var lt=Fe[0],pt=Fe.pop();if(pt!==lt){Fe[0]=pt;e:for(var Ge=0,Rt=Fe.length,Ot=Rt>>>1;Ge<Ot;){var Ci=2*(Ge+1)-1,Hi=Fe[Ci],ei=Ci+1,si=Fe[ei];if(0>o(Hi,pt))ei<Rt&&0>o(si,Hi)?(Fe[Ge]=si,Fe[ei]=pt,Ge=ei):(Fe[Ge]=Hi,Fe[Ci]=pt,Ge=Ci);else if(ei<Rt&&0>o(si,pt))Fe[Ge]=si,Fe[ei]=pt,Ge=ei;else break e}}return lt}function o(Fe,lt){var pt=Fe.sortIndex-lt.sortIndex;return pt!==0?pt:Fe.id-lt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var f=Date,r=f.now();t.unstable_now=function(){return f.now()-r}}var x=[],S=[],C=1,I=null,N=3,D=!1,V=!1,B=!1,W=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,G=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function te(Fe){for(var lt=i(S);lt!==null;){if(lt.callback===null)n(S);else if(lt.startTime<=Fe)n(S),lt.sortIndex=lt.expirationTime,e(x,lt);else break;lt=i(S)}}function ce(Fe){if(B=!1,te(Fe),!V)if(i(x)!==null)V=!0,kt(_e);else{var lt=i(S);lt!==null&&Vt(ce,lt.startTime-Fe)}}function _e(Fe,lt){V=!1,B&&(B=!1,$(Ne),Ne=-1),D=!0;var pt=N;try{for(te(lt),I=i(x);I!==null&&(!(I.expirationTime>lt)||Fe&&!De());){var Ge=I.callback;if(typeof Ge=="function"){I.callback=null,N=I.priorityLevel;var Rt=Ge(I.expirationTime<=lt);lt=t.unstable_now(),typeof Rt=="function"?I.callback=Rt:I===i(x)&&n(x),te(lt)}else n(x);I=i(x)}if(I!==null)var Ot=!0;else{var Ci=i(S);Ci!==null&&Vt(ce,Ci.startTime-lt),Ot=!1}return Ot}finally{I=null,N=pt,D=!1}}var Te=!1,we=null,Ne=-1,pe=5,Pe=-1;function De(){return!(t.unstable_now()-Pe<pe)}function Je(){if(we!==null){var Fe=t.unstable_now();Pe=Fe;var lt=!0;try{lt=we(!0,Fe)}finally{lt?dt():(Te=!1,we=null)}}else Te=!1}var dt;if(typeof G=="function")dt=function(){G(Je)};else if(typeof MessageChannel<"u"){var At=new MessageChannel,qt=At.port2;At.port1.onmessage=Je,dt=function(){qt.postMessage(null)}}else dt=function(){W(Je,0)};function kt(Fe){we=Fe,Te||(Te=!0,dt())}function Vt(Fe,lt){Ne=W(function(){Fe(t.unstable_now())},lt)}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(Fe){Fe.callback=null},t.unstable_continueExecution=function(){V||D||(V=!0,kt(_e))},t.unstable_forceFrameRate=function(Fe){0>Fe||125<Fe?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):pe=0<Fe?Math.floor(1e3/Fe):5},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_getFirstCallbackNode=function(){return i(x)},t.unstable_next=function(Fe){switch(N){case 1:case 2:case 3:var lt=3;break;default:lt=N}var pt=N;N=lt;try{return Fe()}finally{N=pt}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(Fe,lt){switch(Fe){case 1:case 2:case 3:case 4:case 5:break;default:Fe=3}var pt=N;N=Fe;try{return lt()}finally{N=pt}},t.unstable_scheduleCallback=function(Fe,lt,pt){var Ge=t.unstable_now();switch(typeof pt=="object"&&pt!==null?(pt=pt.delay,pt=typeof pt=="number"&&0<pt?Ge+pt:Ge):pt=Ge,Fe){case 1:var Rt=-1;break;case 2:Rt=250;break;case 5:Rt=1073741823;break;case 4:Rt=1e4;break;default:Rt=5e3}return Rt=pt+Rt,Fe={id:C++,callback:lt,priorityLevel:Fe,startTime:pt,expirationTime:Rt,sortIndex:-1},pt>Ge?(Fe.sortIndex=pt,e(S,Fe),i(x)===null&&Fe===i(S)&&(B?($(Ne),Ne=-1):B=!0,Vt(ce,pt-Ge))):(Fe.sortIndex=Rt,e(x,Fe),V||D||(V=!0,kt(_e))),Fe},t.unstable_shouldYield=De,t.unstable_wrapCallback=function(Fe){var lt=N;return function(){var pt=N;N=lt;try{return Fe.apply(this,arguments)}finally{N=pt}}}})(yX);gX.exports=yX;var kme=gX.exports;/** 26 * @license React 27 * react-dom.production.min.js 28 * 29 * Copyright (c) Facebook, Inc. and its affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var Pme=K,au=kme;function Mi(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)e+="&args[]="+encodeURIComponent(arguments[i]);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 _X=new Set,RT={};function rv(t,e){gb(t,e),gb(t+"Capture",e)}function gb(t,e){for(RT[t]=e,t=0;t<e.length;t++)_X.add(e[t])}var ef=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wz=Object.prototype.hasOwnProperty,Nme=/^[: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]*$/,n$={},r$={};function Mme(t){return Wz.call(r$,t)?!0:Wz.call(n$,t)?!1:Nme.test(t)?r$[t]=!0:(n$[t]=!0,!1)}function Dme(t,e,i,n){if(i!==null&&i.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Rme(t,e,i,n){if(e===null||typeof e>"u"||Dme(t,e,i,n))return!0;if(n)return!1;if(i!==null)switch(i.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 hc(t,e,i,n,o,c,f){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=o,this.mustUseProperty=i,this.propertyName=t,this.type=e,this.sanitizeURL=c,this.removeEmptyString=f}var ul={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ul[t]=new hc(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ul[e]=new hc(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ul[t]=new hc(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ul[t]=new hc(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){ul[t]=new hc(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ul[t]=new hc(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ul[t]=new hc(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ul[t]=new hc(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ul[t]=new hc(t,5,!1,t.toLowerCase(),null,!1,!1)});var HF=/[\-:]([a-z])/g;function GF(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(HF,GF);ul[e]=new hc(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(HF,GF);ul[e]=new hc(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(HF,GF);ul[e]=new hc(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ul[t]=new hc(t,1,!1,t.toLowerCase(),null,!1,!1)});ul.xlinkHref=new hc("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ul[t]=new hc(t,1,!1,t.toLowerCase(),null,!0,!0)});function WF(t,e,i,n){var o=ul.hasOwnProperty(e)?ul[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Rme(e,i,o,n)&&(i=null),n||o===null?Mme(e)&&(i===null?t.removeAttribute(e):t.setAttribute(e,""+i)):o.mustUseProperty?t[o.propertyName]=i===null?o.type===3?!1:"":i:(e=o.attributeName,n=o.attributeNamespace,i===null?t.removeAttribute(e):(o=o.type,i=o===3||o===4&&i===!0?"":""+i,n?t.setAttributeNS(n,e,i):t.setAttribute(e,i))))}var df=Pme.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,MA=Symbol.for("react.element"),i0=Symbol.for("react.portal"),n0=Symbol.for("react.fragment"),KF=Symbol.for("react.strict_mode"),Kz=Symbol.for("react.profiler"),vX=Symbol.for("react.provider"),xX=Symbol.for("react.context"),ZF=Symbol.for("react.forward_ref"),Zz=Symbol.for("react.suspense"),Xz=Symbol.for("react.suspense_list"),XF=Symbol.for("react.memo"),_m=Symbol.for("react.lazy"),bX=Symbol.for("react.offscreen"),s$=Symbol.iterator;function hS(t){return t===null||typeof t!="object"?null:(t=s$&&t[s$]||t["@@iterator"],typeof t=="function"?t:null)}var ko=Object.assign,YR;function OS(t){if(YR===void 0)try{throw Error()}catch(i){var e=i.stack.trim().match(/\n( *(at )?)/);YR=e&&e[1]||""}return` 34`+YR+t}var QR=!1;function JR(t,e){if(!t||QR)return"";QR=!0;var i=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(S){var n=S}Reflect.construct(t,[],e)}else{try{e.call()}catch(S){n=S}t.call(e.prototype)}else{try{throw Error()}catch(S){n=S}t()}}
vendor: 8,492 bytes, lines 34-37
34catch(S){if(S&&n&&typeof S.stack=="string"){for(var o=S.stack.split(` 35`),c=n.stack.split(` 36`),f=o.length-1,r=c.length-1;1<=f&&0<=r&&o[f]!==c[r];)r--;for(;1<=f&&0<=r;f--,r--)if(o[f]!==c[r]){if(f!==1||r!==1)do if(f--,r--,0>r||o[f]!==c[r]){var x=` 37`+o[f].replace(" at new "," at ");return t.displayName&&x.includes("<anonymous>")&&(x=x.replace("<anonymous>",t.displayName)),x}while(1<=f&&0<=r);break}}}finally{QR=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?OS(t):""}function jme(t){switch(t.tag){case 5:return OS(t.type);case 16:return OS("Lazy");case 13:return OS("Suspense");case 19:return OS("SuspenseList");case 0:case 2:case 15:return t=JR(t.type,!1),t;case 11:return t=JR(t.type.render,!1),t;case 1:return t=JR(t.type,!0),t;default:return""}}function Yz(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 n0:return"Fragment";case i0:return"Portal";case Kz:return"Profiler";case KF:return"StrictMode";case Zz:return"Suspense";case Xz:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case xX:return(t.displayName||"Context")+".Consumer";case vX:return(t._context.displayName||"Context")+".Provider";case ZF:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case XF:return e=t.displayName||null,e!==null?e:Yz(t.type)||"Memo";case _m:e=t._payload,t=t._init;try{return Yz(t(e))}catch{}}return null}function zme(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 Yz(e);case 8:return e===KF?"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 ug(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wX(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lme(t){var e=wX(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var o=i.get,c=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(f){n=""+f,c.call(this,f)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function DA(t){t._valueTracker||(t._valueTracker=Lme(t))}function SX(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var i=e.getValue(),n="";return t&&(n=wX(t)?t.checked?"true":"false":t.value),t=n,t!==i?(e.setValue(t),!0):!1}function hk(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 Qz(t,e){var i=e.checked;return ko({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function o$(t,e){var i=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;i=ug(e.value!=null?e.value:i),t._wrapperState={initialChecked:n,initialValue:i,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function TX(t,e){e=e.checked,e!=null&&WF(t,"checked",e,!1)}function Jz(t,e){TX(t,e);var i=ug(e.value),n=e.type;if(i!=null)n==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?eL(t,e.type,i):e.hasOwnProperty("defaultValue")&&eL(t,e.type,ug(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function a$(t,e,i){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,i||e===t.value||(t.value=e),t.defaultValue=e}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function eL(t,e,i){(e!=="number"||hk(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var FS=Array.isArray;function _0(t,e,i,n){if(t=t.options,e){e={};for(var o=0;o<i.length;o++)e["$"+i[o]]=!0;for(i=0;i<t.length;i++)o=e.hasOwnProperty("$"+t[i].value),t[i].selected!==o&&(t[i].selected=o),o&&n&&(t[i].defaultSelected=!0)}else{for(i=""+ug(i),e=null,o=0;o<t.length;o++){if(t[o].value===i){t[o].selected=!0,n&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function tL(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(Mi(91));return ko({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function l$(t,e){var i=e.value;if(i==null){if(i=e.children,e=e.defaultValue,i!=null){if(e!=null)throw Error(Mi(92));if(FS(i)){if(1<i.length)throw Error(Mi(93));i=i[0]}e=i}e==null&&(e=""),i=e}t._wrapperState={initialValue:ug(i)}}function CX(t,e){var i=ug(e.value),n=ug(e.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),e.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),n!=null&&(t.defaultValue=""+n)}function c$(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function EX(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 iL(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?EX(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var RA,AX=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,i,n,o){MSApp.execUnsafeLocalFunction(function(){return t(e,i,n,o)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(RA=RA||document.createElement("div"),RA.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=RA.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function jT(t,e){if(e){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=e;return}}t.textContent=e}var nT={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},Ome=["Webkit","ms","Moz","O"];Object.keys(nT).forEach(function(t){Ome.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),nT[e]=nT[t]})});function IX(t,e,i){return e==null||typeof e=="boolean"||e===""?"":i||typeof e!="number"||e===0||nT.hasOwnProperty(t)&&nT[t]?(""+e).trim():e+"px"}function kX(t,e){t=t.style;for(var i in e)if(e.hasOwnProperty(i)){var n=i.indexOf("--")===0,o=IX(i,e[i],n);i==="float"&&(i="cssFloat"),n?t.setProperty(i,o):t[i]=o}}var Fme=ko({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 nL(t,e){if(e){if(Fme[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Mi(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Mi(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Mi(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Mi(62))}}function rL(t,e){if(t.indexOf("-")===-1)return typeof e.is=="str
37ing";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 sL=null;function YF(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var oL=null,v0=null,x0=null;function u$(t){if(t=aE(t)){if(typeof oL!="function")throw Error(Mi(280));var e=t.stateNode;e&&(e=RN(e),oL(t.stateNode,t.type,e))}}function PX(t){v0?x0?x0.push(t):x0=[t]:v0=t}function NX(){if(v0){var t=v0,e=x0;if(x0=v0=null,u$(t),e)for(t=0;t<e.length;t++)u$(e[t])}}function MX(t,e){return t(e)}function DX(){}var ej=!1;function RX(t,e,i){if(ej)return t(e,i);ej=!0;try{return MX(t,e,i)}finally{ej=!1,(v0!==null||x0!==null)&&(DX(),NX())}}function zT(t,e){var i=t.stateNode;if(i===null)return null;var n=RN(i);if(n===null)return null;i=n[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":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(Mi(231,e,typeof i));return i}var aL=!1;if(ef)try{var pS={};Object.defineProperty(pS,"passive",{get:function(){aL=!0}}),window.addEventListener("test",pS,pS),window.removeEventListener("test",pS,pS)}catch{aL=!1}function Bme(t,e,i,n,o,c,f,r,x){var S=Array.prototype.slice.call(arguments,3);try{e.apply(i,S)}catch(C){this.onError(C)}}var rT=!1,pk=null,fk=!1,lL=null,Ume={onError:function(t){rT=!0,pk=t}};function Vme(t,e,i,n,o,c,f,r,x){rT=!1,pk=null,Bme.apply(Ume,arguments)}function $me(t,e,i,n,o,c,f,r,x){if(Vme.apply(this,arguments),rT){if(rT){var S=pk;rT=!1,pk=null}else throw Error(Mi(198));fk||(fk=!0,lL=S)}}function sv(t){var e=t,i=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(i=e.return),t=e.return;while(t)}return e.tag===3?i:null}function jX(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 d$(t){if(sv(t)!==t)throw Error(Mi(188))}function qme(t){var e=t.alternate;if(!e){if(e=sv(t),e===null)throw Error(Mi(188));return e!==t?null:t}for(var i=t,n=e;;){var o=i.return;if(o===null)break;var c=o.alternate;if(c===null){if(n=o.return,n!==null){i=n;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===i)return d$(o),t;if(c===n)return d$(o),e;c=c.sibling}throw Error(Mi(188))}if(i.return!==n.return)i=o,n=c;else{for(var f=!1,r=o.child;r;){if(r===i){f=!0,i=o,n=c;break}if(r===n){f=!0,n=o,i=c;break}r=r.sibling}if(!f){for(r=c.child;r;){if(r===i){f=!0,i=c,n=o;break}if(r===n){f=!0,n=c,i=o;break}r=r.sibling}if(!f)throw Error(Mi(189))}}if(i.alternate!==n)throw Error(Mi(190))}if(i.tag!==3)throw Error(Mi(188));return i.stateNode.current===i?t:e}function zX(t){return t=qme(t),t!==null?LX(t):null}function LX(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=LX(t);if(e!==null)return e;t=t.sibling}return null}var OX=au.unstable_scheduleCallback,h$=au.unstable_cancelCallback,Hme=au.unstable_shouldYield,Gme=au.unstable_requestPaint,Yo=au.unstable_now,Wme=au.unstable_getCurrentPriorityLevel,QF=au.unstable_ImmediatePriority,FX=au.unstable_UserBlockingPriority,mk=au.unstable_NormalPriority,Kme=au.unstable_LowPriority,BX=au.unstable_IdlePriority,PN=null,Fh=null;function Zme(t){if(Fh&&typeof Fh.onCommitFiberRoot=="function")try{Fh.onCommitFiberRoot(PN,t,void 0,(t.current.flags&128)===128)}catch{}}var Md=Math.clz32?Math.clz32:Qme,Xme=Math.log,Yme=Math.LN2;function Qme(t){return t>>>=0,t===0?32:31-(Xme(t)/Yme|0)|0}var jA=64,zA=4194304;function BS(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 gk(t,e){var i=t.pendingLanes;if(i===0)return 0;var n=0,o=t.suspendedLanes,c=t.pingedLanes,f=i&268435455;if(f!==0){var r=f&~o;r!==0?n=BS(r):(c&=f,c!==0&&(n=BS(c)))}else f=i&~o,f!==0?n=BS(f):c!==0&&(n=BS(c));if(n===0)return 0;if(e!==0&&e!==n&&!(e&o)&&(o=n&-n,c=e&-e,o>=c||o===16&&(c&4194240)!==0))return e;if(n&4&&(n|=i&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0<e;)i=31-Md(e),o=1<<i,n|=t[i],e&=~o;return n}function Jme(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 ege(t,e){for(var i=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,c=t.pendingLanes;0<c;){var f=31-Md(c),r=1<<f,x=o[f];x===-1?(!(r&i)||r&n)&&(o[f]=Jme(r,e)):x<=e&&(t.expiredLanes|=r),c&=~r}}function cL(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function UX(){var t=jA;return jA<<=1,!(jA&4194240)&&(jA=64),t}function tj(t){for(var e=[],i=0;31>i;i++)e.push(t);return e}
vendor: 4,096 bytes, line 37
37function sE(t,e,i){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Md(e),t[e]=i}function tge(t,e){var i=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 n=t.eventTimes;for(t=t.expirationTimes;0<i;){var o=31-Md(i),c=1<<o;e[o]=0,n[o]=-1,t[o]=-1,i&=~c}}function JF(t,e){var i=t.entangledLanes|=e;for(t=t.entanglements;i;){var n=31-Md(i),o=1<<n;o&e|t[n]&e&&(t[n]|=e),i&=~o}}var Vs=0;function VX(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var $X,e3,qX,HX,GX,uL=!1,LA=[],Km=null,Zm=null,Xm=null,LT=new Map,OT=new Map,Tm=[],ige="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 p$(t,e){switch(t){case"focusin":case"focusout":Km=null;break;case"dragenter":case"dragleave":Zm=null;break;case"mouseover":case"mouseout":Xm=null;break;case"pointerover":case"pointerout":LT.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":OT.delete(e.pointerId)}}function fS(t,e,i,n,o,c){return t===null||t.nativeEvent!==c?(t={blockedOn:e,domEventName:i,eventSystemFlags:n,nativeEvent:c,targetContainers:[o]},e!==null&&(e=aE(e),e!==null&&e3(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function nge(t,e,i,n,o){switch(e){case"focusin":return Km=fS(Km,t,e,i,n,o),!0;case"dragenter":return Zm=fS(Zm,t,e,i,n,o),!0;case"mouseover":return Xm=fS(Xm,t,e,i,n,o),!0;case"pointerover":var c=o.pointerId;return LT.set(c,fS(LT.get(c)||null,t,e,i,n,o)),!0;case"gotpointercapture":return c=o.pointerId,OT.set(c,fS(OT.get(c)||null,t,e,i,n,o)),!0}return!1}function WX(t){var e=Xy(t.target);if(e!==null){var i=sv(e);if(i!==null){if(e=i.tag,e===13){if(e=jX(i),e!==null){t.blockedOn=e,GX(t.priority,function(){qX(i)});return}}else if(e===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function DI(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var i=dL(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var n=new i.constructor(i.type,i);sL=n,i.target.dispatchEvent(n),sL=null}else return e=aE(i),e!==null&&e3(e),t.blockedOn=i,!1;e.shift()}return!0}function f$(t,e,i){DI(t)&&i.delete(e)}function rge(){uL=!1,Km!==null&&DI(Km)&&(Km=null),Zm!==null&&DI(Zm)&&(Zm=null),Xm!==null&&DI(Xm)&&(Xm=null),LT.forEach(f$),OT.forEach(f$)}function mS(t,e){t.blockedOn===e&&(t.blockedOn=null,uL||(uL=!0,au.unstable_scheduleCallback(au.unstable_NormalPriority,rge)))}function FT(t){function e(o){return mS(o,t)}if(0<LA.length){mS(LA[0],t);for(var i=1;i<LA.length;i++){var n=LA[i];n.blockedOn===t&&(n.blockedOn=null)}}for(Km!==null&&mS(Km,t),Zm!==null&&mS(Zm,t),Xm!==null&&mS(Xm,t),LT.forEach(e),OT.forEach(e),i=0;i<Tm.length;i++)n=Tm[i],n.blockedOn===t&&(n.blockedOn=null);for(;0<Tm.length&&(i=Tm[0],i.blockedOn===null);)WX(i),i.blockedOn===null&&Tm.shift()}var b0=df.ReactCurrentBatchConfig,yk=!0;function sge(t,e,i,n){var o=Vs,c=b0.transition;b0.transition=null;try{Vs=1,t3(t,e,i,n)}finally{Vs=o,b0.transition=c}}function oge(t,e,i,n){var o=Vs,c=b0.transition;b0.transition=null;try{Vs=4,t3(t,e,i,n)}finally{Vs=o,b0.transition=c}}function t3(t,e,i,n){if(yk){var o=dL(t,e,i,n);if(o===null)dj(t,e,n,_k,i),p$(t,n);else if(nge(o,t,e,i,n))n.stopPropagation();else if(p$(t,n),e&4&&-1<ige.indexOf(t)){for(;o!==null;){var c=aE(o);if(c!==null&&$X(c),c=dL(t,e,i,n),c===null&&dj(t,e,n,_k,i),c===o)break;o=c}o!==null&&n.stopPropagation()}else dj(t,e,n,null,i)}}var _k=null;function dL(t,e,i,n){if(_k=null,t=YF(n),t=Xy(t),t!==null)if(e=sv(t),e===null)t=null;else if(i=e.tag,i===13){if(t=jX(e),t!==null)return t;t=null}else if(i===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return _k=t,null}
vendor: 7,072 bytes, line 37
37function KX(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(Wme()){case QF:return 1;case FX:return 4;case mk:case Kme:return 16;case BX:return 536870912;default:return 16}default:return 16}}var Bm=null,i3=null,RI=null;function ZX(){if(RI)return RI;var t,e=i3,i=e.length,n,o="value"in Bm?Bm.value:Bm.textContent,c=o.length;for(t=0;t<i&&e[t]===o[t];t++);var f=i-t;for(n=1;n<=f&&e[i-n]===o[c-n];n++);return RI=o.slice(t,1<n?1-n:void 0)}function jI(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 OA(){return!0}function m$(){return!1}function uu(t){function e(i,n,o,c,f){this._reactName=i,this._targetInst=o,this.type=n,this.nativeEvent=c,this.target=f,this.currentTarget=null;for(var r in t)t.hasOwnProperty(r)&&(i=t[r],this[r]=i?i(c):c[r]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?OA:m$,this.isPropagationStopped=m$,this}return ko(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=OA)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=OA)},persist:function(){},isPersistent:OA}),e}var Hb={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},n3=uu(Hb),oE=ko({},Hb,{view:0,detail:0}),age=uu(oE),ij,nj,gS,NN=ko({},oE,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:r3,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!==gS&&(gS&&t.type==="mousemove"?(ij=t.screenX-gS.screenX,nj=t.screenY-gS.screenY):nj=ij=0,gS=t),ij)},movementY:function(t){return"movementY"in t?t.movementY:nj}}),g$=uu(NN),lge=ko({},NN,{dataTransfer:0}),cge=uu(lge),uge=ko({},oE,{relatedTarget:0}),rj=uu(uge),dge=ko({},Hb,{animationName:0,elapsedTime:0,pseudoElement:0}),hge=uu(dge),pge=ko({},Hb,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),fge=uu(pge),mge=ko({},Hb,{data:0}),y$=uu(mge),gge={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yge={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"},_ge={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vge(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=_ge[t])?!!e[t]:!1}function r3(){return vge}var xge=ko({},oE,{key:function(t){if(t.key){var e=gge[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=jI(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?yge[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:r3,charCode:function(t){return t.type==="keypress"?jI(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?jI(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),bge=uu(xge),wge=ko({},NN,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_$=uu(wge),Sge=ko({},oE,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:r3}),Tge=uu(Sge),Cge=ko({},Hb,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ege=uu(Cge),Age=ko({},NN,{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}),Ige=uu(Age),kge=[9,13,27,32],s3=ef&&"CompositionEvent"in window,sT=null;ef&&"documentMode"in document&&(sT=document.documentMode);var Pge=ef&&"TextEvent"in window&&!sT,XX=ef&&(!s3||sT&&8<sT&&11>=sT),v$=" ",x$=!1;function YX(t,e){switch(t){case"keyup":return kge.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function QX(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var r0=!1;function Nge(t,e){switch(t){case"compositionend":return QX(e);case"keypress":return e.which!==32?null:(x$=!0,v$);case"textInput":return t=e.data,t===v$&&x$?null:t;default:return null}}function Mge(t,e){if(r0)return t==="compositionend"||!s3&&YX(t,e)?(t=ZX(),RI=i3=Bm=null,r0=!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 XX&&e.locale!=="ko"?null:e.data;default:return null}}var Dge={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 b$(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Dge[t.type]:e==="textarea"}function JX(t,e,i,n){PX(n),e=vk(e,"onChange"),0<e.length&&(i=new n3("onChange","change",null,i,n),t.push({event:i,listeners:e}))}var oT=null,BT=null;function Rge(t){uY(t,0)}function MN(t){var e=a0(t);if(SX(e))return t}function jge(t,e){if(t==="change")return e}var eY=!1;if(ef){var sj;
vendor: 5,647 bytes, line 37
37if(ef){var oj="oninput"in document;if(!oj){var w$=document.createElement("div");w$.setAttribute("oninput","return;"),oj=typeof w$.oninput=="function"}sj=oj}else sj=!1;eY=sj&&(!document.documentMode||9<document.documentMode)}function S$(){oT&&(oT.detachEvent("onpropertychange",tY),BT=oT=null)}function tY(t){if(t.propertyName==="value"&&MN(BT)){var e=[];JX(e,BT,t,YF(t)),RX(Rge,e)}}function zge(t,e,i){t==="focusin"?(S$(),oT=e,BT=i,oT.attachEvent("onpropertychange",tY)):t==="focusout"&&S$()}function Lge(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return MN(BT)}function Oge(t,e){if(t==="click")return MN(e)}function Fge(t,e){if(t==="input"||t==="change")return MN(e)}function Bge(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var zd=typeof Object.is=="function"?Object.is:Bge;function UT(t,e){if(zd(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++){var o=i[n];if(!Wz.call(e,o)||!zd(t[o],e[o]))return!1}return!0}function T$(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function C$(t,e){var i=T$(t);t=0;for(var n;i;){if(i.nodeType===3){if(n=t+i.textContent.length,t<=e&&n>=e)return{node:i,offset:e-t};t=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=T$(i)}}function iY(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?iY(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function nY(){for(var t=window,e=hk();e instanceof t.HTMLIFrameElement;){try{var i=typeof e.contentWindow.location.href=="string"}catch{i=!1}if(i)t=e.contentWindow;else break;e=hk(t.document)}return e}function o3(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 Uge(t){var e=nY(),i=t.focusedElem,n=t.selectionRange;if(e!==i&&i&&i.ownerDocument&&iY(i.ownerDocument.documentElement,i)){if(n!==null&&o3(i)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in i)i.selectionStart=e,i.selectionEnd=Math.min(t,i.value.length);else if(t=(e=i.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=i.textContent.length,c=Math.min(n.start,o);n=n.end===void 0?c:Math.min(n.end,o),!t.extend&&c>n&&(o=n,n=c,c=o),o=C$(i,c);var f=C$(i,n);o&&f&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==f.node||t.focusOffset!==f.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),c>n?(t.addRange(e),t.extend(f.node,f.offset)):(e.setEnd(f.node,f.offset),t.addRange(e)))}}for(e=[],t=i;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<e.length;i++)t=e[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Vge=ef&&"documentMode"in document&&11>=document.documentMode,s0=null,hL=null,aT=null,pL=!1;function E$(t,e,i){var n=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;pL||s0==null||s0!==hk(n)||(n=s0,"selectionStart"in n&&o3(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),aT&&UT(aT,n)||(aT=n,n=vk(hL,"onSelect"),0<n.length&&(e=new n3("onSelect","select",null,e,i),t.push({event:e,listeners:n}),e.target=s0)))}function FA(t,e){var i={};return i[t.toLowerCase()]=e.toLowerCase(),i["Webkit"+t]="webkit"+e,i["Moz"+t]="moz"+e,i}var o0={animationend:FA("Animation","AnimationEnd"),animationiteration:FA("Animation","AnimationIteration"),animationstart:FA("Animation","AnimationStart"),transitionend:FA("Transition","TransitionEnd")},aj={},rY={};ef&&(rY=document.createElement("div").style,"AnimationEvent"in window||(delete o0.animationend.animation,delete o0.animationiteration.animation,delete o0.animationstart.animation),"TransitionEvent"in window||delete o0.transitionend.transition);function DN(t){if(aj[t])return aj[t];if(!o0[t])return t;var e=o0[t],i;for(i in e)if(e.hasOwnProperty(i)&&i in rY)return aj[t]=e[i];return t}var sY=DN("animationend"),oY=DN("animationiteration"),aY=DN("animationstart"),lY=DN("transitionend"),cY=new Map,A$="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 Pg(t,e){cY.set(t,e),rv(e,[t])}for(var lj=0;lj<A$.length;lj++){var cj=A$[lj],$ge=cj.toLowerCase(),qge=cj[0].toUpperCase()+cj.slice(1);Pg($ge,"on"+qge)}Pg(sY,"onAnimationEnd");Pg(oY,"onAnimationIteration");Pg(aY,"onAnimationStart");Pg("dblclick","onDoubleClick");Pg("focusin","onFocus");Pg("focusout","onBlur");Pg(lY,"onTransitionEnd");gb("onMouseEnter",["mouseout","mouseover"]);gb("onMouseLeave",["mouseout","mouseover"]);gb("onPointerEnter",["pointerout","pointerover"]);gb("onPointerLeave",["pointerout","pointerover"]);rv("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));
vendor: 4,817 bytes, line 37
37rv("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));rv("onBeforeInput",["compositionend","keypress","textInput","paste"]);rv("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));rv("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));rv("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var US="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(" "),Hge=new Set("cancel close invalid load scroll toggle".split(" ").concat(US));function I$(t,e,i){var n=t.type||"unknown-event";t.currentTarget=i,$me(n,e,void 0,t),t.currentTarget=null}function uY(t,e){e=(e&4)!==0;for(var i=0;i<t.length;i++){var n=t[i],o=n.event;n=n.listeners;e:{var c=void 0;if(e)for(var f=n.length-1;0<=f;f--){var r=n[f],x=r.instance,S=r.currentTarget;if(r=r.listener,x!==c&&o.isPropagationStopped())break e;I$(o,r,S),c=x}else for(f=0;f<n.length;f++){if(r=n[f],x=r.instance,S=r.currentTarget,r=r.listener,x!==c&&o.isPropagationStopped())break e;I$(o,r,S),c=x}}}if(fk)throw t=lL,fk=!1,lL=null,t}function oo(t,e){var i=e[_L];i===void 0&&(i=e[_L]=new Set);var n=t+"__bubble";i.has(n)||(dY(e,t,2,!1),i.add(n))}function uj(t,e,i){var n=0;e&&(n|=4),dY(i,t,n,e)}var BA="_reactListening"+Math.random().toString(36).slice(2);function VT(t){if(!t[BA]){t[BA]=!0,_X.forEach(function(i){i!=="selectionchange"&&(Hge.has(i)||uj(i,!1,t),uj(i,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[BA]||(e[BA]=!0,uj("selectionchange",!1,e))}}function dY(t,e,i,n){switch(KX(e)){case 1:var o=sge;break;case 4:o=oge;break;default:o=t3}i=o.bind(null,e,i,t),o=void 0,!aL||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),n?o!==void 0?t.addEventListener(e,i,{capture:!0,passive:o}):t.addEventListener(e,i,!0):o!==void 0?t.addEventListener(e,i,{passive:o}):t.addEventListener(e,i,!1)}function dj(t,e,i,n,o){var c=n;if(!(e&1)&&!(e&2)&&n!==null)e:for(;;){if(n===null)return;var f=n.tag;if(f===3||f===4){var r=n.stateNode.containerInfo;if(r===o||r.nodeType===8&&r.parentNode===o)break;if(f===4)for(f=n.return;f!==null;){var x=f.tag;if((x===3||x===4)&&(x=f.stateNode.containerInfo,x===o||x.nodeType===8&&x.parentNode===o))return;f=f.return}for(;r!==null;){if(f=Xy(r),f===null)return;if(x=f.tag,x===5||x===6){n=c=f;continue e}r=r.parentNode}}n=n.return}RX(function(){var S=c,C=YF(i),I=[];e:{var N=cY.get(t);if(N!==void 0){var D=n3,V=t;switch(t){case"keypress":if(jI(i)===0)break e;case"keydown":case"keyup":D=bge;break;case"focusin":V="focus",D=rj;break;case"focusout":V="blur",D=rj;break;case"beforeblur":case"afterblur":D=rj;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":D=g$;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":D=cge;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":D=Tge;break;case sY:case oY:case aY:D=hge;break;case lY:D=Ege;break;case"scroll":D=age;break;case"wheel":D=Ige;break;case"copy":case"cut":case"paste":D=fge;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":D=_$}var B=(e&4)!==0,W=!B&&t==="scroll",$=B?N!==null?N+"Capture":null:N;B=[];for(var G=S,te;G!==null;){te=G;var ce=te.stateNode;if(te.tag===5&&ce!==null&&(te=ce,$!==null&&(ce=zT(G,$),ce!=null&&B.push($T(G,ce,te)))),W)break;G=G.return}0<B.length&&(N=new D(N,V,null,i,C),I.push({event:N,listeners:B}))}}if(!(e&7)){e:{if(N=t==="mouseover"||t==="pointerover",D=t==="mouseout"||t==="pointerout",N&&i!==sL&&(V=i.relatedTarget||i.fromElement)&&(Xy(V)||V[tf]))break e;if((D||N)&&(N=C.window===C?C:(N=C.ownerDocument)?N.defaultView||N.parentWindow:window,D?(V=i.relatedTarget||i.toElement,D=S,V=V?Xy(V):null,V!==null&&(W=sv(V),V!==W||V.tag!==5&&V.tag!==6)&&(V=null)):(D=null,V=S),D!==V)){if(B=g$,ce="onMouseLeave",$="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(B=_$,ce="onPointerLeave",$="onPointerEnter",G="pointer"),W=D==null?N:a0(D),te=V==null?N:a0(V),N=new B(ce,G+"leave",D,i,C),N.target=W,N.relatedTarget=te,ce=null,Xy(C)===S&&(B=new B($,G+"enter",V,i,C),B.target=te,B.relatedTarget=W,ce=B),W=ce,D&&V)t:{for(B=D,$=V,G=0,te=B;te;te=Ux(te))G++;for(te=0,ce=$;ce;ce=Ux(ce))te++;for(;0<G-te;)B=Ux(B),G--;for(;0<te-G;)$=Ux($),te--;for(;G--;){if(B===$||$!==null&&B===$.alternate)break t;B=Ux(B),$=Ux($)}B=null}else B=null;D!==null&&k$(I,N,D,B,!1),V!==null&&W!==null&&k$(I,W,V,B,!0)}}
vendor: 4,278 bytes, lines 37-38
37e:{if(N=S?a0(S):window,D=N.nodeName&&N.nodeName.toLowerCase(),D==="select"||D==="input"&&N.type==="file")var _e=jge;else if(b$(N))if(eY)_e=Fge;else{_e=Lge;var Te=zge}else(D=N.nodeName)&&D.toLowerCase()==="input"&&(N.type==="checkbox"||N.type==="radio")&&(_e=Oge);if(_e&&(_e=_e(t,S))){JX(I,_e,i,C);break e}Te&&Te(t,N,S),t==="focusout"&&(Te=N._wrapperState)&&Te.controlled&&N.type==="number"&&eL(N,"number",N.value)}switch(Te=S?a0(S):window,t){case"focusin":(b$(Te)||Te.contentEditable==="true")&&(s0=Te,hL=S,aT=null);break;case"focusout":aT=hL=s0=null;break;case"mousedown":pL=!0;break;case"contextmenu":case"mouseup":case"dragend":pL=!1,E$(I,i,C);break;case"selectionchange":if(Vge)break;case"keydown":case"keyup":E$(I,i,C)}var we;if(s3)e:{switch(t){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else r0?YX(t,i)&&(Ne="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(Ne="onCompositionStart");Ne&&(XX&&i.locale!=="ko"&&(r0||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&r0&&(we=ZX()):(Bm=C,i3="value"in Bm?Bm.value:Bm.textContent,r0=!0)),Te=vk(S,Ne),0<Te.length&&(Ne=new y$(Ne,t,null,i,C),I.push({event:Ne,listeners:Te}),we?Ne.data=we:(we=QX(i),we!==null&&(Ne.data=we)))),(we=Pge?Nge(t,i):Mge(t,i))&&(S=vk(S,"onBeforeInput"),0<S.length&&(C=new y$("onBeforeInput","beforeinput",null,i,C),I.push({event:C,listeners:S}),C.data=we))}uY(I,e)})}function $T(t,e,i){return{instance:t,listener:e,currentTarget:i}}function vk(t,e){for(var i=e+"Capture",n=[];t!==null;){var o=t,c=o.stateNode;o.tag===5&&c!==null&&(o=c,c=zT(t,i),c!=null&&n.unshift($T(t,c,o)),c=zT(t,e),c!=null&&n.push($T(t,c,o))),t=t.return}return n}function Ux(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function k$(t,e,i,n,o){for(var c=e._reactName,f=[];i!==null&&i!==n;){var r=i,x=r.alternate,S=r.stateNode;if(x!==null&&x===n)break;r.tag===5&&S!==null&&(r=S,o?(x=zT(i,c),x!=null&&f.unshift($T(i,x,r))):o||(x=zT(i,c),x!=null&&f.push($T(i,x,r)))),i=i.return}f.length!==0&&t.push({event:e,listeners:f})}var Gge=/\r\n?/g,Wge=/\u0000|\uFFFD/g;function P$(t){return(typeof t=="string"?t:""+t).replace(Gge,` 38`).replace(Wge,"")}function UA(t,e,i){if(e=P$(e),P$(t)!==e&&i)throw Error(Mi(425))}function xk(){}var fL=null,mL=null;function gL(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 yL=typeof setTimeout=="function"?setTimeout:void 0,Kge=typeof clearTimeout=="function"?clearTimeout:void 0,N$=typeof Promise=="function"?Promise:void 0,Zge=typeof queueMicrotask=="function"?queueMicrotask:typeof N$<"u"?function(t){return N$.resolve(null).then(t).catch(Xge)}:yL;function Xge(t){setTimeout(function(){throw t})}function hj(t,e){var i=e,n=0;do{var o=i.nextSibling;if(t.removeChild(i),o&&o.nodeType===8)if(i=o.data,i==="/$"){if(n===0){t.removeChild(o),FT(e);return}n--}else i!=="$"&&i!=="$?"&&i!=="$!"||n++;i=o}while(i);FT(e)}function Ym(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 M$(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(e===0)return t;e--}else i==="/$"&&e++}t=t.previousSibling}return null}var Gb=Math.random().toString(36).slice(2),Nh="__reactFiber$"+Gb,qT="__reactProps$"+Gb,tf="__reactContainer$"+Gb,_L="__reactEvents$"+Gb,Yge="__reactListeners$"+Gb,Qge="__reactHandles$"+Gb;function Xy(t){var e=t[Nh];if(e)return e;for(var i=t.parentNode;i;){if(e=i[tf]||i[Nh]){if(i=e.alternate,e.child!==null||i!==null&&i.child!==null)for(t=M$(t);t!==null;){if(i=t[Nh])return i;t=M$(t)}return e}t=i,i=t.parentNode}return null}function aE(t){return t=t[Nh]||t[tf],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function a0(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(Mi(33))}function RN(t){return t[qT]||null}var vL=[],l0=-1;function Ng(t){return{current:t}}function lo(t){0>l0||(t.current=vL[l0],vL[l0]=null,l0--)}function to(t,e){l0++,vL[l0]=t.current,t.current=e}var dg={}
vendor: 15,818 bytes, line 38
38,El=Ng(dg),jc=Ng(!1),D_=dg;function yb(t,e){var i=t.type.contextTypes;if(!i)return dg;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var o={},c;for(c in i)o[c]=e[c];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function zc(t){return t=t.childContextTypes,t!=null}function bk(){lo(jc),lo(El)}function D$(t,e,i){if(El.current!==dg)throw Error(Mi(168));to(El,e),to(jc,i)}function hY(t,e,i){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return i;n=n.getChildContext();for(var o in n)if(!(o in e))throw Error(Mi(108,zme(t)||"Unknown",o));return ko({},i,n)}function wk(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||dg,D_=El.current,to(El,t),to(jc,jc.current),!0}function R$(t,e,i){var n=t.stateNode;if(!n)throw Error(Mi(169));i?(t=hY(t,e,D_),n.__reactInternalMemoizedMergedChildContext=t,lo(jc),lo(El),to(El,t)):lo(jc),to(jc,i)}var Lp=null,jN=!1,pj=!1;function pY(t){Lp===null?Lp=[t]:Lp.push(t)}function Jge(t){jN=!0,pY(t)}function Mg(){if(!pj&&Lp!==null){pj=!0;var t=0,e=Vs;try{var i=Lp;for(Vs=1;t<i.length;t++){var n=i[t];do n=n(!0);while(n!==null)}Lp=null,jN=!1}catch(o){throw Lp!==null&&(Lp=Lp.slice(t+1)),OX(QF,Mg),o}finally{Vs=e,pj=!1}}return null}var c0=[],u0=0,Sk=null,Tk=0,ku=[],Pu=0,R_=null,Gp=1,Wp="";function $y(t,e){c0[u0++]=Tk,c0[u0++]=Sk,Sk=t,Tk=e}function fY(t,e,i){ku[Pu++]=Gp,ku[Pu++]=Wp,ku[Pu++]=R_,R_=t;var n=Gp;t=Wp;var o=32-Md(n)-1;n&=~(1<<o),i+=1;var c=32-Md(e)+o;if(30<c){var f=o-o%5;c=(n&(1<<f)-1).toString(32),n>>=f,o-=f,Gp=1<<32-Md(e)+o|i<<o|n,Wp=c+t}else Gp=1<<c|i<<o|n,Wp=t}function a3(t){t.return!==null&&($y(t,1),fY(t,1,0))}function l3(t){for(;t===Sk;)Sk=c0[--u0],c0[u0]=null,Tk=c0[--u0],c0[u0]=null;for(;t===R_;)R_=ku[--Pu],ku[Pu]=null,Wp=ku[--Pu],ku[Pu]=null,Gp=ku[--Pu],ku[Pu]=null}var iu=null,tu=null,mo=!1,Sd=null;function mY(t,e){var i=Mu(5,null,null,0);i.elementType="DELETED",i.stateNode=e,i.return=t,e=t.deletions,e===null?(t.deletions=[i],t.flags|=16):e.push(i)}function j$(t,e){switch(t.tag){case 5:var i=t.type;return e=e.nodeType!==1||i.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,iu=t,tu=Ym(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,iu=t,tu=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(i=R_!==null?{id:Gp,overflow:Wp}:null,t.memoizedState={dehydrated:e,treeContext:i,retryLane:1073741824},i=Mu(18,null,null,0),i.stateNode=e,i.return=t,t.child=i,iu=t,tu=null,!0):!1;default:return!1}}function xL(t){return(t.mode&1)!==0&&(t.flags&128)===0}function bL(t){if(mo){var e=tu;if(e){var i=e;if(!j$(t,e)){if(xL(t))throw Error(Mi(418));e=Ym(i.nextSibling);var n=iu;e&&j$(t,e)?mY(n,i):(t.flags=t.flags&-4097|2,mo=!1,iu=t)}}else{if(xL(t))throw Error(Mi(418));t.flags=t.flags&-4097|2,mo=!1,iu=t}}}function z$(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;iu=t}function VA(t){if(t!==iu)return!1;if(!mo)return z$(t),mo=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!gL(t.type,t.memoizedProps)),e&&(e=tu)){if(xL(t))throw gY(),Error(Mi(418));for(;e;)mY(t,e),e=Ym(e.nextSibling)}if(z$(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(Mi(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(e===0){tu=Ym(t.nextSibling);break e}e--}else i!=="$"&&i!=="$!"&&i!=="$?"||e++}t=t.nextSibling}tu=null}}else tu=iu?Ym(t.stateNode.nextSibling):null;return!0}function gY(){for(var t=tu;t;)t=Ym(t.nextSibling)}function _b(){tu=iu=null,mo=!1}function c3(t){Sd===null?Sd=[t]:Sd.push(t)}var eye=df.ReactCurrentBatchConfig;function yS(t,e,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(Mi(309));var n=i.stateNode}if(!n)throw Error(Mi(147,t));var o=n,c=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===c?e.ref:(e=function(f){var r=o.refs;f===null?delete r[c]:r[c]=f},e._stringRef=c,e)}if(typeof t!="string")throw Error(Mi(284));if(!i._owner)throw Error(Mi(290,t))}return t}function $A(t,e){throw t=Object.prototype.toString.call(e),Error(Mi(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function L$(t){var e=t._init;return e(t._payload)}function yY(t){function e($,G){if(t){var te=$.deletions;te===null?($.deletions=[G],$.flags|=16):te.push(G)}}function i($,G){if(!t)return null;for(;G!==null;)e($,G),G=G.sibling;return null}function n($,G){for($=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function o($,G){return $=tg($,G),$.index=0,$.sibling=null,$}function c($,G,te){return $.index=te,t?(te=$.alternate,te!==null?(te=te.index,te<G?($.flags|=2,G):te):($.flags|=2,G)):($.flags|=1048576,G)}function f($){return t&&$.alternate===null&&($.flags|=2),$}function r($,G,te,ce){return G===null||G.tag!==6?(G=xj(te,$.mode,ce),G.return=$,G):(G=o(G,te),G.return=$,G)}function x($,G,te,ce){var _e=te.type;return _e===n0?C($,G,te.props.children,ce,te.key):G!==null&&(G.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===_m&&L$(_e)===G.type)?(ce=o(G,te.props),ce.ref=yS($,G,te),ce.return=$,ce):(ce=VI(te.type,te.key,te.props,null,$.mode,ce),ce.ref=yS($,G,te),ce.return=$,ce)}function S($,G,te,ce){return G===null||G.tag!==4||G.stateNode.containerInfo!==te.containerInfo||G.stateNode.implementation!==te.implementation?(G=bj(te,$.mode,ce),G.return=$,G):(G=o(G,te.children||[]),G.return=$,G)}function C($,G,te,ce,_e){return G===null||G.tag!==7?(G=E_(te,$.mode,ce,_e),G.return=$,G):(G=o(G,te),G.return=$,G)}function I($,G,te){if(typeof G=="string"&&G!==""||typeof G=="number")return G=xj(""+G,$.mode,te),G.return=$,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case MA:return te=VI(G.type,G.key,G.props,null,$.mode,te),te.ref=yS($,null,G),te.return=$,te;case i0:return G=bj(G,$.mode,te),G.return=$,G;case _m:var ce=G._init;return I($,ce(G._payload),te)}if(FS(G)||hS(G))return G=E_(G,$.mode,te,null),G.return=$,G;$A($,G)}return null}function N($,G,te,ce){var _e=G!==null?G.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return _e!==null?null:r($,G,""+te,ce);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case MA:return te.key===_e?x($,G,te,ce):null;case i0:return te.key===_e?S($,G,te,ce):null;case _m:return _e=te._init,N($,G,_e(te._payload),ce)}if(FS(te)||hS(te))return _e!==null?null:C($,G,te,ce,null);$A($,te)}return null}function D($,G,te,ce,_e){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return $=$.get(te)||null,r(G,$,""+ce,_e);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case MA:return $=$.get(ce.key===null?te:ce.key)||null,x(G,$,ce,_e);case i0:return $=$.get(ce.key===null?te:ce.key)||null,S(G,$,ce,_e);case _m:var Te=ce._init;return D($,G,te,Te(ce._payload),_e)}if(FS(ce)||hS(ce))return $=$.get(te)||null,C(G,$,ce,_e,null);$A(G,ce)}return null}function V($,G,te,ce){for(var _e=null,Te=null,we=G,Ne=G=0,pe=null;we!==null&&Ne<te.length;Ne++){we.index>Ne?(pe=we,we=null):pe=we.sibling;var Pe=N($,we,te[Ne],ce);if(Pe===null){we===null&&(we=pe);break}t&&we&&Pe.alternate===null&&e($,we),G=c(Pe,G,Ne),Te===null?_e=Pe:Te.sibling=Pe,Te=Pe,we=pe}if(Ne===te.length)return i($,we),mo&&$y($,Ne),_e;if(we===null){for(;Ne<te.length;Ne++)we=I($,te[Ne],ce),we!==null&&(G=c(we,G,Ne),Te===null?_e=we:Te.sibling=we,Te=we);return mo&&$y($,Ne),_e}for(we=n($,we);Ne<te.length;Ne++)pe=D(we,$,Ne,te[Ne],ce),pe!==null&&(t&&pe.alternate!==null&&we.delete(pe.key===null?Ne:pe.key),G=c(pe,G,Ne),Te===null?_e=pe:Te.sibling=pe,Te=pe);return t&&we.forEach(function(De){return e($,De)}),mo&&$y($,Ne),_e}function B($,G,te,ce){var _e=hS(te);if(typeof _e!="function")throw Error(Mi(150));if(te=_e.call(te),te==null)throw Error(Mi(151));for(var Te=_e=null,we=G,Ne=G=0,pe=null,Pe=te.next();we!==null&&!Pe.done;Ne++,Pe=te.next()){we.index>Ne?(pe=we,we=null):pe=we.sibling;var De=N($,we,Pe.value,ce);if(De===null){we===null&&(we=pe);break}t&&we&&De.alternate===null&&e($,we),G=c(De,G,Ne),Te===null?_e=De:Te.sibling=De,Te=De,we=pe}if(Pe.done)return i($,we),mo&&$y($,Ne),_e;if(we===null){for(;!Pe.done;Ne++,Pe=te.next())Pe=I($,Pe.value,ce),Pe!==null&&(G=c(Pe,G,Ne),Te===null?_e=Pe:Te.sibling=Pe,Te=Pe);return mo&&$y($,Ne),_e}for(we=n($,we);!Pe.done;Ne++,Pe=te.next())Pe=D(we,$,Ne,Pe.value,ce),Pe!==null&&(t&&Pe.alternate!==null&&we.delete(Pe.key===null?Ne:Pe.key),G=c(Pe,G,Ne),Te===null?_e=Pe:Te.sibling=Pe,Te=Pe);return t&&we.forEach(function(Je){return e($,Je)}),mo&&$y($,Ne),_e}function W($,G,te,ce){if(typeof te=="object"&&te!==null&&te.type===n0&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case MA:e:{for(var _e=te.key,Te=G;Te!==null;){if(Te.key===_e){if(_e=te.type,_e===n0){if(Te.tag===7){i($,Te.sibling),G=o(Te,te.props.children),G.return=$,$=G;break e}}else if(Te.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===_m&&L$(_e)===Te.type){i($,Te.sibling),G=o(Te,te.props),G.ref=yS($,Te,te),G.return=$,$=G;break e}i($,Te);break}else e($,Te);Te=Te.sibling}te.type===n0?(G=E_(te.props.children,$.mode,ce,te.key),G.return=$,$=G):(ce=VI(te.type,te.key,te.props,null,$.mode,ce),ce.ref=yS($,G,te),ce.return=$,$=ce)}return f($);case i0:e:{for(Te=te.key;G!==null;){if(G.key===Te)if(G.tag===4&&G.stateNode.containerInfo===te.containerInfo&&G.stateNode.implementation===te.implementation){i($,G.sibling),G=o(G,te.children||[]),G.return=$,$=G;break e}else{i($,G);break}else e($,G);G=G.sibling}G=bj(te,$.mode,ce),G.return=$,$=G}return f($);case _m:return Te=te._init,W($,G,Te(te._payload),ce)}if(FS(te))return V($,G,te,ce);if(hS(te))return B($,G,te,ce);$A($,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,G!==null&&G.tag===6?(i($,G.sibling),G=o(G,te),G.return=$,$=G):(i($,G),G=xj(te,$.mode,ce),G.return=$,$=G),f($)):i($,G)}return W}var vb=yY(!0),_Y=yY(!1),Ck=Ng(null),Ek=null,d0=null,u3=null;function d3(){u3=d0=Ek=null}function h3(t){var e=Ck.current;lo(Ck),t._currentValue=e}function wL(t,e,i){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===i)break;t=t.return}}function w0(t,e){Ek=t,u3=d0=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Dc=!0),t.firstContext=null)}function Bu(t){var e=t._currentValue;if(u3!==t)if(t={context:t,memoizedValue:e,next:null},d0===null){if(Ek===null)throw Error(Mi(308));d0=t,Ek.dependencies={lanes:0,firstContext:t}}else d0=d0.next=t;return e}var Yy=null;function p3(t){Yy===null?Yy=[t]:Yy.push(t)}function vY(t,e,i,n){var o=e.interleaved;return o===null?(i.next=i,p3(e)):(i.next=o.next,o.next=i),e.interleaved=i,nf(t,n)}function nf(t,e){t.lanes|=e;var i=t.alternate;for(i!==null&&(i.lanes|=e),i=t,t=t.return;t!==null;)t.childLanes|=e,i=t.alternate,i!==null&&(i.childLanes|=e),i=t,t=t.return;return i.tag===3?i.stateNode:null}var vm=!1;function f3(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xY(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 Xp(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Qm(t,e,i){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,Es&2){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,nf(t,i)}return o=n.interleaved,o===null?(e.next=e,p3(n)):(e.next=o.next,o.next=e),n.interleaved=e,nf(t,i)}function zI(t,e,i){if(e=e.updateQueue,e!==null&&(e=e.shared,(i&4194240)!==0)){var n=e.lanes;n&=t.pendingLanes,i|=n,e.lanes=i,JF(t,i)}}function O$(t,e){var i=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,i===n)){var o=null,c=null;if(i=i.firstBaseUpdate,i!==null){do{var f={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};c===null?o=c=f:c=c.next=f,i=i.next}while(i!==null);c===null?o=c=e:c=c.next=e}else o=c=e;i={baseState:n.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:n.shared,effects:n.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=e:t.next=e,i.lastBaseUpdate=e}function Ak(t,e,i,n){var o=t.updateQueue;vm=!1;var c=o.firstBaseUpdate,f=o.lastBaseUpdate,r=o.shared.pending;if(r!==null){o.shared.pending=null;var x=r,S=x.next;x.next=null,f===null?c=S:f.next=S,f=x;var C=t.alternate;C!==null&&(C=C.updateQueue,r=C.lastBaseUpdate,r!==f&&(r===null?C.firstBaseUpdate=S:r.next=S,C.lastBaseUpdate=x))}if(c!==null){var I=o.baseState;f=0,C=S=x=null,r=c;do{var N=r.lane,D=r.eventTime;if((n&N)===N){C!==null&&(C=C.next={eventTime:D,lane:0,tag:r.tag,payload:r.payload,callback:r.callback,next:null});e:{var V=t,B=r;switch(N=e,D=i,B.tag){case 1:if(V=B.payload,typeof V=="function"){I=V.call(D,I,N);break e}I=V;break e;case 3:V.flags=V.flags&-65537|128;case 0:if(V=B.payload,N=typeof V=="function"?V.call(D,I,N):V,N==null)break e;I=ko({},I,N);break e;case 2:vm=!0}}r.callback!==null&&r.lane!==0&&(t.flags|=64,N=o.effects,N===null?o.effects=[r]:N.push(r))}else D={eventTime:D,lane:N,tag:r.tag,payload:r.payload,callback:r.callback,next:null},C===null?(S=C=D,x=I):C=C.next=D,f|=N;if(r=r.next,r===null){if(r=o.shared.pending,r===null)break;N=r,r=N.next,N.next=null,o.lastBaseUpdate=N,o.shared.pending=null}}while(!0);if(C===null&&(x=I),o.baseState=x,o.firstBaseUpdate=S,o.lastBaseUpdate=C,e=o.shared.interleaved,e!==null){o=e;do f|=o.lane,o=o.next;while(o!==e)}else c===null&&(o.shared.lanes=0);z_|=f,t.lanes=f,t.memoizedState=I}}function F$(t,e,i){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var n=t[e],o=n.callback;if(o!==null){if(n.callback=null,n=i,typeof o!="function")throw Error(Mi(191,o));o.call(n)}}}var lE={},Bh=Ng(lE),HT=Ng(lE),GT=Ng(lE);function Qy(t){if(t===lE)throw Error(Mi(174));return t}function m3(t,e){switch(to(GT,e),to(HT,t),to(Bh,lE),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:iL(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=iL(e,t)}lo(Bh),to(Bh,e)}function xb(){lo(Bh),lo(HT),lo(GT)}function bY(t){Qy(GT.current);var e=Qy(Bh.current),i=iL(e,t.type);e!==i&&(to(HT,t),to(Bh,i))}function g3(t){HT.current===t&&(lo(Bh),lo(HT))}var To=Ng(0);function Ik(t){for(var e=t;e!==null;){if(e.tag===13){var i=e.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.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 fj=[];function y3(){for(var t=0;t<fj.length;t++)fj[t]._workInProgressVersionPrimary=null;fj.length=0}var LI=df.ReactCurrentDispatcher,mj=df.ReactCurrentBatchConfig,j_=0,Eo=null,xa=null,Oa=null,kk=!1,lT=!1,WT=0,tye=0;function vl(){throw Error(Mi(321))}function _3(t,e){if(e===null)return!1;for(var i=0;i<e.length&&i<t.length;i++)if(!zd(t[i],e[i]))return!1;return!0}function v3(t,e,i,n,o,c){if(j_=c,Eo=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,LI.current=t===null||t.memoizedState===null?sye:oye,t=i(n,o),lT){c=0;do{if(lT=!1,WT=0,25<=c)throw Error(Mi(301));c+=1,Oa=xa=null,e.updateQueue=null,LI.current=aye,t=i(n,o)}while(lT)}if(LI.current=Pk,e=xa!==null&&xa.next!==null,j_=0,Oa=xa=Eo=null,kk=!1,e)throw Error(Mi(300));return t}function x3(){var t=WT!==0;return WT=0,t}function yh(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oa===null?Eo.memoizedState=Oa=t:Oa=Oa.next=t,Oa}
vendor: 5,161 bytes, line 38
38function Uu(){if(xa===null){var t=Eo.alternate;t=t!==null?t.memoizedState:null}else t=xa.next;var e=Oa===null?Eo.memoizedState:Oa.next;if(e!==null)Oa=e,xa=t;else{if(t===null)throw Error(Mi(310));xa=t,t={memoizedState:xa.memoizedState,baseState:xa.baseState,baseQueue:xa.baseQueue,queue:xa.queue,next:null},Oa===null?Eo.memoizedState=Oa=t:Oa=Oa.next=t}return Oa}function KT(t,e){return typeof e=="function"?e(t):e}function gj(t){var e=Uu(),i=e.queue;if(i===null)throw Error(Mi(311));i.lastRenderedReducer=t;var n=xa,o=n.baseQueue,c=i.pending;if(c!==null){if(o!==null){var f=o.next;o.next=c.next,c.next=f}n.baseQueue=o=c,i.pending=null}if(o!==null){c=o.next,n=n.baseState;var r=f=null,x=null,S=c;do{var C=S.lane;if((j_&C)===C)x!==null&&(x=x.next={lane:0,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null}),n=S.hasEagerState?S.eagerState:t(n,S.action);else{var I={lane:C,action:S.action,hasEagerState:S.hasEagerState,eagerState:S.eagerState,next:null};x===null?(r=x=I,f=n):x=x.next=I,Eo.lanes|=C,z_|=C}S=S.next}while(S!==null&&S!==c);x===null?f=n:x.next=r,zd(n,e.memoizedState)||(Dc=!0),e.memoizedState=n,e.baseState=f,e.baseQueue=x,i.lastRenderedState=n}if(t=i.interleaved,t!==null){o=t;do c=o.lane,Eo.lanes|=c,z_|=c,o=o.next;while(o!==t)}else o===null&&(i.lanes=0);return[e.memoizedState,i.dispatch]}function yj(t){var e=Uu(),i=e.queue;if(i===null)throw Error(Mi(311));i.lastRenderedReducer=t;var n=i.dispatch,o=i.pending,c=e.memoizedState;if(o!==null){i.pending=null;var f=o=o.next;do c=t(c,f.action),f=f.next;while(f!==o);zd(c,e.memoizedState)||(Dc=!0),e.memoizedState=c,e.baseQueue===null&&(e.baseState=c),i.lastRenderedState=c}return[c,n]}function wY(){}function SY(t,e){var i=Eo,n=Uu(),o=e(),c=!zd(n.memoizedState,o);if(c&&(n.memoizedState=o,Dc=!0),n=n.queue,b3(EY.bind(null,i,n,t),[t]),n.getSnapshot!==e||c||Oa!==null&&Oa.memoizedState.tag&1){if(i.flags|=2048,ZT(9,CY.bind(null,i,n,o,e),void 0,null),Ua===null)throw Error(Mi(349));j_&30||TY(i,e,o)}return o}function TY(t,e,i){t.flags|=16384,t={getSnapshot:e,value:i},e=Eo.updateQueue,e===null?(e={lastEffect:null,stores:null},Eo.updateQueue=e,e.stores=[t]):(i=e.stores,i===null?e.stores=[t]:i.push(t))}function CY(t,e,i,n){e.value=i,e.getSnapshot=n,AY(e)&&IY(t)}function EY(t,e,i){return i(function(){AY(e)&&IY(t)})}function AY(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!zd(t,i)}catch{return!0}}function IY(t){var e=nf(t,1);e!==null&&Dd(e,t,1,-1)}function B$(t){var e=yh();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:KT,lastRenderedState:t},e.queue=t,t=t.dispatch=rye.bind(null,Eo,t),[e.memoizedState,t]}function ZT(t,e,i,n){return t={tag:t,create:e,destroy:i,deps:n,next:null},e=Eo.updateQueue,e===null?(e={lastEffect:null,stores:null},Eo.updateQueue=e,e.lastEffect=t.next=t):(i=e.lastEffect,i===null?e.lastEffect=t.next=t:(n=i.next,i.next=t,t.next=n,e.lastEffect=t)),t}function kY(){return Uu().memoizedState}function OI(t,e,i,n){var o=yh();Eo.flags|=t,o.memoizedState=ZT(1|e,i,void 0,n===void 0?null:n)}function zN(t,e,i,n){var o=Uu();n=n===void 0?null:n;var c=void 0;if(xa!==null){var f=xa.memoizedState;if(c=f.destroy,n!==null&&_3(n,f.deps)){o.memoizedState=ZT(e,i,c,n);return}}Eo.flags|=t,o.memoizedState=ZT(1|e,i,c,n)}function U$(t,e){return OI(8390656,8,t,e)}function b3(t,e){return zN(2048,8,t,e)}function PY(t,e){return zN(4,2,t,e)}function NY(t,e){return zN(4,4,t,e)}function MY(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 DY(t,e,i){return i=i!=null?i.concat([t]):null,zN(4,4,MY.bind(null,e,t),i)}function w3(){}function RY(t,e){var i=Uu();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&_3(e,n[1])?n[0]:(i.memoizedState=[t,e],t)}function jY(t,e){var i=Uu();e=e===void 0?null:e;var n=i.memoizedState;return n!==null&&e!==null&&_3(e,n[1])?n[0]:(t=t(),i.memoizedState=[t,e],t)}function zY(t,e,i){return j_&21?(zd(i,e)||(i=UX(),Eo.lanes|=i,z_|=i,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Dc=!0),t.memoizedState=i)}function iye(t,e){var i=Vs;Vs=i!==0&&4>i?i:4,t(!0);var n=mj.transition;mj.transition={};try{t(!1),e()}finally{Vs=i,mj.transition=n}}function LY(){return Uu().memoizedState}function nye(t,e,i){var n=eg(t);if(i={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null},OY(t))FY(e,i);else if(i=vY(t,e,i,n),i!==null){var o=sc();Dd(i,t,n,o),BY(i,e,n)}}function rye(t,e,i){var n=eg(t),o={lane:n,action:i,hasEagerState:!1,eagerState:null,next:null};if(OY(t))FY(e,o);else{var c=t.alternate;if(t.lanes===0&&(c===null||c.lanes===0)&&(c=e.lastRenderedReducer,c!==null))try{var f=e.lastRenderedState,r=c(f,i);if(o.hasEagerState=!0,o.eagerState=r,zd(r,f)){var x=e.interleaved;x===null?(o.next=o,p3(e)):(o.next=x.next,x.next=o),e.interleaved=o;return}}catch{}finally{}i=vY(t,e,o,n),i!==null&&(o=sc(),Dd(i,t,n,o),BY(i,e,n))}}function OY(t){var e=t.alternate;return t===Eo||e!==null&&e===Eo}function FY(t,e){lT=kk=!0;var i=t.pending;i===null?e.next=e:(e.next=i.next,i.next=e),t.pending=e}function BY(t,e,i){if(i&4194240){var n=e.lanes;
vendor: 7,764 bytes, lines 38-40
38n&=t.pendingLanes,i|=n,e.lanes=i,JF(t,i)}}var Pk={readContext:Bu,useCallback:vl,useContext:vl,useEffect:vl,useImperativeHandle:vl,useInsertionEffect:vl,useLayoutEffect:vl,useMemo:vl,useReducer:vl,useRef:vl,useState:vl,useDebugValue:vl,useDeferredValue:vl,useTransition:vl,useMutableSource:vl,useSyncExternalStore:vl,useId:vl,unstable_isNewReconciler:!1},sye={readContext:Bu,useCallback:function(t,e){return yh().memoizedState=[t,e===void 0?null:e],t},useContext:Bu,useEffect:U$,useImperativeHandle:function(t,e,i){return i=i!=null?i.concat([t]):null,OI(4194308,4,MY.bind(null,e,t),i)},useLayoutEffect:function(t,e){return OI(4194308,4,t,e)},useInsertionEffect:function(t,e){return OI(4,2,t,e)},useMemo:function(t,e){var i=yh();return e=e===void 0?null:e,t=t(),i.memoizedState=[t,e],t},useReducer:function(t,e,i){var n=yh();return e=i!==void 0?i(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=nye.bind(null,Eo,t),[n.memoizedState,t]},useRef:function(t){var e=yh();return t={current:t},e.memoizedState=t},useState:B$,useDebugValue:w3,useDeferredValue:function(t){return yh().memoizedState=t},useTransition:function(){var t=B$(!1),e=t[0];return t=iye.bind(null,t[1]),yh().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,i){var n=Eo,o=yh();if(mo){if(i===void 0)throw Error(Mi(407));i=i()}else{if(i=e(),Ua===null)throw Error(Mi(349));j_&30||TY(n,e,i)}o.memoizedState=i;var c={value:i,getSnapshot:e};return o.queue=c,U$(EY.bind(null,n,c,t),[t]),n.flags|=2048,ZT(9,CY.bind(null,n,c,i,e),void 0,null),i},useId:function(){var t=yh(),e=Ua.identifierPrefix;if(mo){var i=Wp,n=Gp;i=(n&~(1<<32-Md(n)-1)).toString(32)+i,e=":"+e+"R"+i,i=WT++,0<i&&(e+="H"+i.toString(32)),e+=":"}else i=tye++,e=":"+e+"r"+i.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},oye={readContext:Bu,useCallback:RY,useContext:Bu,useEffect:b3,useImperativeHandle:DY,useInsertionEffect:PY,useLayoutEffect:NY,useMemo:jY,useReducer:gj,useRef:kY,useState:function(){return gj(KT)},useDebugValue:w3,useDeferredValue:function(t){var e=Uu();return zY(e,xa.memoizedState,t)},useTransition:function(){var t=gj(KT)[0],e=Uu().memoizedState;return[t,e]},useMutableSource:wY,useSyncExternalStore:SY,useId:LY,unstable_isNewReconciler:!1},aye={readContext:Bu,useCallback:RY,useContext:Bu,useEffect:b3,useImperativeHandle:DY,useInsertionEffect:PY,useLayoutEffect:NY,useMemo:jY,useReducer:yj,useRef:kY,useState:function(){return yj(KT)},useDebugValue:w3,useDeferredValue:function(t){var e=Uu();return xa===null?e.memoizedState=t:zY(e,xa.memoizedState,t)},useTransition:function(){var t=yj(KT)[0],e=Uu().memoizedState;return[t,e]},useMutableSource:wY,useSyncExternalStore:SY,useId:LY,unstable_isNewReconciler:!1};function hd(t,e){if(t&&t.defaultProps){e=ko({},e),t=t.defaultProps;for(var i in t)e[i]===void 0&&(e[i]=t[i]);return e}return e}function SL(t,e,i,n){e=t.memoizedState,i=i(n,e),i=i==null?e:ko({},e,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var LN={isMounted:function(t){return(t=t._reactInternals)?sv(t)===t:!1},enqueueSetState:function(t,e,i){t=t._reactInternals;var n=sc(),o=eg(t),c=Xp(n,o);c.payload=e,i!=null&&(c.callback=i),e=Qm(t,c,o),e!==null&&(Dd(e,t,o,n),zI(e,t,o))},enqueueReplaceState:function(t,e,i){t=t._reactInternals;var n=sc(),o=eg(t),c=Xp(n,o);c.tag=1,c.payload=e,i!=null&&(c.callback=i),e=Qm(t,c,o),e!==null&&(Dd(e,t,o,n),zI(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var i=sc(),n=eg(t),o=Xp(i,n);o.tag=2,e!=null&&(o.callback=e),e=Qm(t,o,n),e!==null&&(Dd(e,t,n,i),zI(e,t,n))}};function V$(t,e,i,n,o,c,f){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,c,f):e.prototype&&e.prototype.isPureReactComponent?!UT(i,n)||!UT(o,c):!0}function UY(t,e,i){var n=!1,o=dg,c=e.contextType;return typeof c=="object"&&c!==null?c=Bu(c):(o=zc(e)?D_:El.current,n=e.contextTypes,c=(n=n!=null)?yb(t,o):dg),e=new e(i,c),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=LN,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=c),e}function $$(t,e,i,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(i,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(i,n),e.state!==t&&LN.enqueueReplaceState(e,e.state,null)}function TL(t,e,i,n){var o=t.stateNode;o.props=i,o.state=t.memoizedState,o.refs={},f3(t);var c=e.contextType;typeof c=="object"&&c!==null?o.context=Bu(c):(c=zc(e)?D_:El.current,o.context=yb(t,c)),o.state=t.memoizedState,c=e.getDerivedStateFromProps,typeof c=="function"&&(SL(t,e,c,i),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&LN.enqueueReplaceState(o,o.state,null),Ak(t,i,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function bb(t,e){try{var i="",n=e;do i+=jme(n),n=n.return;while(n);var o=i}catch(c){o=` 39Error generating stack: `+c.message+` 40`+c.stack}return{value:t,source:e,stack:o,digest:null}}function _j(t,e,i){return{value:t,source:null,stack:i??null,digest:e??null}}function CL(t,e){try{console.error(e.value)}catch(i){setTimeout(function(){throw i})}}var lye=typeof WeakMap=="function"?WeakMap:Map;function VY(t,e,i){i=Xp(-1,i),i.tag=3,i.payload={element:null};var n=e.value;return i.callback=function(){Mk||(Mk=!0,jL=n),CL(t,e)},i}function $Y(t,e,i){i=Xp(-1,i),i.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var o=e.value;i.payload=function(){return n(o)},i.callback=function(){CL(t,e)}}var c=t.stateNode;return c!==null&&typeof c.componentDidCatch=="function"&&(i.callback=function(){CL(t,e),typeof n!="function"&&(Jm===null?Jm=new Set([this]):Jm.add(this));var f=e.stack;this.componentDidCatch(e.value,{componentStack:f!==null?f:""})}),i}function q$(t,e,i){var n=t.pingCache;if(n===null){n=t.pingCache=new lye;var o=new Set;n.set(e,o)}else o=n.get(e),o===void 0&&(o=new Set,n.set(e,o));o.has(i)||(o.add(i),t=wye.bind(null,t,e,i),e.then(t,t))}function H$(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 G$(t,e,i,n,o){return t.mode&1?(t.flags|=65536,t.lanes=o,t):(t===e?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(e=Xp(-1,1),e.tag=2,Qm(i,e,1))),i.lanes|=1),t)}var cye=df.ReactCurrentOwner,Dc=!1;function ec(t,e,i,n){e.child=t===null?_Y(e,null,i,n):vb(e,t.child,i,n)}function W$(t,e,i,n,o){i=i.render;var c=e.ref;return w0(e,o),n=v3(t,e,i,n,c,o),i=x3(),t!==null&&!Dc?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,rf(t,e,o)):(mo&&i&&a3(e),e.flags|=1,ec(t,e,n,o),e.child)}function K$(t,e,i,n,o){if(t===null){var c=i.type;return typeof c=="function"&&!P3(c)&&c.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(e.tag=15,e.type=c,qY(t,e,c,n,o)):(t=VI(i.type,null,n,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(c=t.child,!(t.lanes&o)){var f=c.memoizedProps;if(i=i.compare,i=i!==null?i:UT,i(f,n)&&t.ref===e.ref)return rf(t,e,o)}return e.flags|=1,t=tg(c,n),t.ref=e.ref,t.return=e,e.child=t}function qY(t,e,i,n,o){if(t!==null){var c=t.memoizedProps;if(UT(c,n)&&t.ref===e.ref)if(Dc=!1,e.pendingProps=n=c,(t.lanes&o)!==0)t.flags&131072&&(Dc=!0);else return e.lanes=t.lanes,rf(t,e,o)}
vendor: 8,747 bytes, line 40
40return EL(t,e,i,n,o)}function HY(t,e,i){var n=e.pendingProps,o=n.children,c=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},to(p0,Yc),Yc|=i;else{if(!(i&1073741824))return t=c!==null?c.baseLanes|i:i,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,to(p0,Yc),Yc|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=c!==null?c.baseLanes:i,to(p0,Yc),Yc|=n}else c!==null?(n=c.baseLanes|i,e.memoizedState=null):n=i,to(p0,Yc),Yc|=n;return ec(t,e,o,i),e.child}function GY(t,e){var i=e.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(e.flags|=512,e.flags|=2097152)}function EL(t,e,i,n,o){var c=zc(i)?D_:El.current;return c=yb(e,c),w0(e,o),i=v3(t,e,i,n,c,o),n=x3(),t!==null&&!Dc?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,rf(t,e,o)):(mo&&n&&a3(e),e.flags|=1,ec(t,e,i,o),e.child)}function Z$(t,e,i,n,o){if(zc(i)){var c=!0;wk(e)}else c=!1;if(w0(e,o),e.stateNode===null)FI(t,e),UY(e,i,n),TL(e,i,n,o),n=!0;else if(t===null){var f=e.stateNode,r=e.memoizedProps;f.props=r;var x=f.context,S=i.contextType;typeof S=="object"&&S!==null?S=Bu(S):(S=zc(i)?D_:El.current,S=yb(e,S));var C=i.getDerivedStateFromProps,I=typeof C=="function"||typeof f.getSnapshotBeforeUpdate=="function";I||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(r!==n||x!==S)&&$$(e,f,n,S),vm=!1;var N=e.memoizedState;f.state=N,Ak(e,n,f,o),x=e.memoizedState,r!==n||N!==x||jc.current||vm?(typeof C=="function"&&(SL(e,i,C,n),x=e.memoizedState),(r=vm||V$(e,i,r,n,N,x,S))?(I||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(e.flags|=4194308)):(typeof f.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=x),f.props=n,f.state=x,f.context=S,n=r):(typeof f.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{f=e.stateNode,xY(t,e),r=e.memoizedProps,S=e.type===e.elementType?r:hd(e.type,r),f.props=S,I=e.pendingProps,N=f.context,x=i.contextType,typeof x=="object"&&x!==null?x=Bu(x):(x=zc(i)?D_:El.current,x=yb(e,x));var D=i.getDerivedStateFromProps;(C=typeof D=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(r!==I||N!==x)&&$$(e,f,n,x),vm=!1,N=e.memoizedState,f.state=N,Ak(e,n,f,o);var V=e.memoizedState;r!==I||N!==V||jc.current||vm?(typeof D=="function"&&(SL(e,i,D,n),V=e.memoizedState),(S=vm||V$(e,i,S,n,N,V,x)||!1)?(C||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(n,V,x),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(n,V,x)),typeof f.componentDidUpdate=="function"&&(e.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof f.componentDidUpdate!="function"||r===t.memoizedProps&&N===t.memoizedState||(e.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||r===t.memoizedProps&&N===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=V),f.props=n,f.state=V,f.context=x,n=S):(typeof f.componentDidUpdate!="function"||r===t.memoizedProps&&N===t.memoizedState||(e.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||r===t.memoizedProps&&N===t.memoizedState||(e.flags|=1024),n=!1)}return AL(t,e,i,n,c,o)}function AL(t,e,i,n,o,c){GY(t,e);var f=(e.flags&128)!==0;if(!n&&!f)return o&&R$(e,i,!1),rf(t,e,c);n=e.stateNode,cye.current=e;var r=f&&typeof i.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&f?(e.child=vb(e,t.child,null,c),e.child=vb(e,null,r,c)):ec(t,e,r,c),e.memoizedState=n.state,o&&R$(e,i,!0),e.child}function WY(t){var e=t.stateNode;e.pendingContext?D$(t,e.pendingContext,e.pendingContext!==e.context):e.context&&D$(t,e.context,!1),m3(t,e.containerInfo)}function X$(t,e,i,n,o){return _b(),c3(o),e.flags|=256,ec(t,e,i,n),e.child}var IL={dehydrated:null,treeContext:null,retryLane:0};function kL(t){return{baseLanes:t,cachePool:null,transitions:null}}function KY(t,e,i){var n=e.pendingProps,o=To.current,c=!1,f=(e.flags&128)!==0,r;if((r=f)||(r=t!==null&&t.memoizedState===null?!1:(o&2)!==0),r?(c=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),to(To,o&1),t===null)return bL(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):(f=n.children,t=n.fallback,c?(n=e.mode,c=e.child,f={mode:"hidden",children:f},!(n&1)&&c!==null?(c.childLanes=0,c.pendingProps=f):c=BN(f,n,0,null),t=E_(t,n,i,null),c.return=e,t.return=e,c.sibling=t,e.child=c,e.child.memoizedState=kL(i),e.memoizedState=IL,t):S3(e,f));if(o=t.memoizedState,o!==null&&(r=o.dehydrated,r!==null))return uye(t,e,f,n,r,o,i);if(c){c=n.fallback,f=e.mode,o=t.child,r=o.sibling;var x={mode:"hidden",children:n.children};return!(f&1)&&e.child!==o?(n=e.child,n.childLanes=0,n.pendingProps=x,e.deletions=null):(n=tg(o,x),n.subtreeFlags=o.subtreeFlags&14680064),r!==null?c=tg(r,c):(c=E_(c,f,i,null),c.flags|=2),c.return=e,n.return=e,n.sibling=c,e.child=n,n=c,c=e.child,f=t.child.memoizedState,f=f===null?kL(i):{baseLanes:f.baseLanes|i,cachePool:null,transitions:f.transitions},c.memoizedState=f,c.childLanes=t.childLanes&~i,e.memoizedState=IL,n}return c=t.child,t=c.sibling,n=tg(c,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=i),n.return=e,n.sibling=null,t!==null&&(i=e.deletions,i===null?(e.deletions=[t],e.flags|=16):i.push(t)),e.child=n,e.memoizedState=null,n}function S3(t,e){return e=BN({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function qA(t,e,i,n){return n!==null&&c3(n),vb(e,t.child,null,i),t=S3(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function uye(t,e,i,n,o,c,f){if(i)return e.flags&256?(e.flags&=-257,n=_j(Error(Mi(422))),qA(t,e,f,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(c=n.fallback,o=e.mode,n=BN({mode:"visible",children:n.children},o,0,null),c=E_(c,o,f,null),c.flags|=2,n.return=e,c.return=e,n.sibling=c,e.child=n,e.mode&1&&vb(e,t.child,null,f),e.child.memoizedState=kL(f),e.memoizedState=IL,c);if(!(e.mode&1))return qA(t,e,f,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var r=n.dgst;return n=r,c=Error(Mi(419)),n=_j(c,n,void 0),qA(t,e,f,n)}if(r=(f&t.childLanes)!==0,Dc||r){if(n=Ua,n!==null){switch(f&-f){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(n.suspendedLanes|f)?0:o,o!==0&&o!==c.retryLane&&(c.retryLane=o,nf(t,o),Dd(n,t,o,-1))}return k3(),n=_j(Error(Mi(421))),qA(t,e,f,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=Sye.bind(null,t),o._reactRetry=e,null):(t=c.treeContext,tu=Ym(o.nextSibling),iu=e,mo=!0,Sd=null,t!==null&&(ku[Pu++]=Gp,ku[Pu++]=Wp,ku[Pu++]=R_,Gp=t.id,Wp=t.overflow,R_=e),e=S3(e,n.children),e.flags|=4096,e)}function Y$(t,e,i){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),wL(t.return,e,i)}function vj(t,e,i,n,o){var c=t.memoizedState;c===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:i,tailMode:o}:(c.isBackwards=e,c.rendering=null,c.renderingStartTime=0,c.last=n,c.tail=i,c.tailMode=o)}function ZY(t,e,i){var n=e.pendingProps,o=n.revealOrder,c=n.tail;if(ec(t,e,n.children,i),n=To.current,n&2)n=n&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&&Y$(t,i,e);else if(t.tag===19)Y$(t,i,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}n&=1}if(to(To,n),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(i=e.child,o=null;i!==null;)t=i.alternate,t!==null&&Ik(t)===null&&(o=i),i=i.sibling;i=o,i===null?(o=e.child,e.child=null):(o=i.sibling,i.sibling=null),vj(e,!1,o,i,c);break;case"backwards":for(i=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&Ik(t)===null){e.child=o;break}t=o.sibling,o.sibling=i,i=o,o=t}vj(e,!0,i,null,c);break;case"together":vj(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function FI(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}
vendor: 5,612 bytes, line 40
40function rf(t,e,i){if(t!==null&&(e.dependencies=t.dependencies),z_|=e.lanes,!(i&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Mi(153));if(e.child!==null){for(t=e.child,i=tg(t,t.pendingProps),e.child=i,i.return=e;t.sibling!==null;)t=t.sibling,i=i.sibling=tg(t,t.pendingProps),i.return=e;i.sibling=null}return e.child}function dye(t,e,i){switch(e.tag){case 3:WY(e),_b();break;case 5:bY(e);break;case 1:zc(e.type)&&wk(e);break;case 4:m3(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;to(Ck,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(to(To,To.current&1),e.flags|=128,null):i&e.child.childLanes?KY(t,e,i):(to(To,To.current&1),t=rf(t,e,i),t!==null?t.sibling:null);to(To,To.current&1);break;case 19:if(n=(i&e.childLanes)!==0,t.flags&128){if(n)return ZY(t,e,i);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),to(To,To.current),n)break;return null;case 22:case 23:return e.lanes=0,HY(t,e,i)}return rf(t,e,i)}var XY,PL,YY,QY;XY=function(t,e){for(var i=e.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}};PL=function(){};YY=function(t,e,i,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,Qy(Bh.current);var c=null;switch(i){case"input":o=Qz(t,o),n=Qz(t,n),c=[];break;case"select":o=ko({},o,{value:void 0}),n=ko({},n,{value:void 0}),c=[];break;case"textarea":o=tL(t,o),n=tL(t,n),c=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=xk)}nL(i,n);var f;i=null;for(S in o)if(!n.hasOwnProperty(S)&&o.hasOwnProperty(S)&&o[S]!=null)if(S==="style"){var r=o[S];for(f in r)r.hasOwnProperty(f)&&(i||(i={}),i[f]="")}else S!=="dangerouslySetInnerHTML"&&S!=="children"&&S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(RT.hasOwnProperty(S)?c||(c=[]):(c=c||[]).push(S,null));for(S in n){var x=n[S];if(r=o!=null?o[S]:void 0,n.hasOwnProperty(S)&&x!==r&&(x!=null||r!=null))if(S==="style")if(r){for(f in r)!r.hasOwnProperty(f)||x&&x.hasOwnProperty(f)||(i||(i={}),i[f]="");for(f in x)x.hasOwnProperty(f)&&r[f]!==x[f]&&(i||(i={}),i[f]=x[f])}else i||(c||(c=[]),c.push(S,i)),i=x;else S==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,r=r?r.__html:void 0,x!=null&&r!==x&&(c=c||[]).push(S,x)):S==="children"?typeof x!="string"&&typeof x!="number"||(c=c||[]).push(S,""+x):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&(RT.hasOwnProperty(S)?(x!=null&&S==="onScroll"&&oo("scroll",t),c||r===x||(c=[])):(c=c||[]).push(S,x))}i&&(c=c||[]).push("style",i);var S=c;(e.updateQueue=S)&&(e.flags|=4)}};QY=function(t,e,i,n){i!==n&&(e.flags|=4)};function _S(t,e){if(!mo)switch(t.tailMode){case"hidden":e=t.tail;for(var i=null;e!==null;)e.alternate!==null&&(i=e),e=e.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var n=null;i!==null;)i.alternate!==null&&(n=i),i=i.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function xl(t){var e=t.alternate!==null&&t.alternate.child===t.child,i=0,n=0;if(e)for(var o=t.child;o!==null;)i|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)i|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=n,t.childLanes=i,e}function hye(t,e,i){var n=e.pendingProps;switch(l3(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xl(e),null;case 1:return zc(e.type)&&bk(),xl(e),null;case 3:return n=e.stateNode,xb(),lo(jc),lo(El),y3(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(VA(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Sd!==null&&(OL(Sd),Sd=null))),PL(t,e),xl(e),null;case 5:g3(e);var o=Qy(GT.current);if(i=e.type,t!==null&&e.stateNode!=null)YY(t,e,i,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(Mi(166));return xl(e),null}if(t=Qy(Bh.current),VA(e)){n=e.stateNode,i=e.type;var c=e.memoizedProps;switch(n[Nh]=e,n[qT]=c,t=(e.mode&1)!==0,i){case"dialog":oo("cancel",n),oo("close",n);break;case"iframe":case"object":case"embed":oo("load",n);break;case"video":case"audio":for(o=0;o<US.length;o++)oo(US[o],n);break;case"source":oo("error",n);break;case"img":case"image":case"link":oo("error",n),oo("load",n);break;case"details":oo("toggle",n);break;case"input":o$(n,c),oo("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!c.multiple},oo("invalid",n);break;case"textarea":l$(n,c),oo("invalid",n)}nL(i,c),o=null;for(var f in c)if(c.hasOwnProperty(f)){var r=c[f];f==="children"?typeof r=="string"?n.textContent!==r&&(c.suppressHydrationWarning!==!0&&UA(n.textContent,r,t),o=["children",r]):typeof r=="number"&&n.textContent!==""+r&&(c.suppressHydrationWarning!==!0&&UA(n.textContent,r,t),o=["children",""+r]):RT.hasOwnProperty(f)&&r!=null&&f==="onScroll"&&oo("scroll",n)}switch(i){case"input":DA(n),a$(n,c,!0);break;case"textarea":DA(n),c$(n);break;case"select":case"option":break;default:typeof c.onClick=="function"&&(n.onclick=xk)}n=o,e.updateQueue=n,n!==null&&(e.flags|=4)}else{f=o.nodeType===9?o:o.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=EX(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=f.createElement("div"),t.innerHTML="<script><\/script>
40",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=f.createElement(i,{is:n.is}):(t=f.createElement(i),i==="select"&&(f=t,n.multiple?f.multiple=!0:n.size&&(f.size=n.size))):t=f.createElementNS(t,i),t[Nh]=e,t[qT]=n,XY(t,e,!1,!1),e.stateNode=t;e:{switch(f=rL(i,n),i){case"dialog":oo("cancel",t),oo("close",t),o=n;break;case"iframe":case"object":case"embed":oo("load",t),o=n;break;case"video":case"audio":for(o=0;o<US.length;o++)oo(US[o],t);o=n;break;case"source":oo("error",t),o=n;break;case"img":case"image":case"link":oo("error",t),oo("load",t),o=n;break;case"details":oo("toggle",t),o=n;break;case"input":o$(t,n),o=Qz(t,n),oo("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=ko({},n,{value:void 0}),oo("invalid",t);break;case"textarea":l$(t,n),o=tL(t,n),oo("invalid",t);break;default:o=n}nL(i,o),r=o;for(c in r)if(r.hasOwnProperty(c)){var x=r[c];c==="style"?kX(t,x):c==="dangerouslySetInnerHTML"?(x=x?x.__html:void 0,x!=null&&AX(t,x)):c==="children"?typeof x=="string"?(i!=="textarea"||x!=="")&&jT(t,x):typeof x=="number"&&jT(t,""+x):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(RT.hasOwnProperty(c)?x!=null&&c==="onScroll"&&oo("scroll",t):x!=null&&WF(t,c,x,f))}switch(i){case"input":DA(t),a$(t,n,!1);break;case"textarea":DA(t),c$(t);break;case"option":n.value!=null&&t.setAttribute("value",""+ug(n.value));break;case"select":t.multiple=!!n.multiple,c=n.value,c!=null?_0(t,!!n.multiple,c,!1):n.defaultValue!=null&&_0(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=xk)}switch(i){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return xl(e),null;case 6:if(t&&e.stateNode!=null)QY(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(Mi(166));if(i=Qy(GT.current),Qy(Bh.current),VA(e)){if(n=e.stateNode,i=e.memoizedProps,n[Nh]=e,(c=n.nodeValue!==i)&&(t=iu,t!==null))switch(t.tag){case 3:UA(n.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&UA(n.nodeValue,i,(t.mode&1)!==0)}c&&(e.flags|=4)}else n=(i.nodeType===9?i:i.ownerDocument).createTextNode(n),n[Nh]=e,e.stateNode=n}return xl(e),null;case 13:if(lo(To),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(mo&&tu!==null&&e.mode&1&&!(e.flags&128))gY(),_b(),e.flags|=98560,c=!1;else if(c=VA(e),n!==null&&n.dehydrated!==null){if(t===null){if(!c)throw Error(Mi(318));if(c=e.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(Mi(317));c[Nh]=e}else _b(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;xl(e),c=!1}else Sd!==null&&(OL(Sd),Sd=null),c=!0;if(!c)return e.flags&65536?e:null}return e.flags&128?(e.lanes=i,e):(n=n!==null,n!==(t!==null&&t.memoizedState!==null)&&n&&(e.child.flags|=8192,e.mode&1&&(t===null||To.current&1?Ta===0&&(Ta=3):k3())),e.updateQueue!==null&&(e.flags|=4),xl(e),null);case 4:return xb(),PL(t,e),t===null&&VT(e.stateNode.containerInfo),xl(e),null;case 10:return h3(e.type._context),xl(e),null;case 17:return zc(e.type)&&bk(),xl(e),null;case 19:if(lo(To),c=e.memoizedState,c===null)return xl(e),null;if(n=(e.flags&128)!==0,f=c.rendering,f===null)if(n)_S(c,!1);else{if(Ta!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(f=Ik(t),f!==null){for(e.flags|=128,_S(c,!1),n=f.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),e.subtreeFlags=0,n=i,i=e.child;i!==null;)c=i,t=n,c.flags&=14680066,f=c.alternate,f===null?(c.childLanes=0,c.lanes=t,c.child=null,c.subtreeFlags=0,c.memoizedProps=null,c.memoizedState=null,c.updateQueue=null,c.dependencies=null,c.stateNode=null):(c.childLanes=f.childLanes,c.lanes=f.lanes,c.child=f.child,c.subtreeFlags=0,c.deleti
vendor: 28,084 bytes, line 40
40ons=null,c.memoizedProps=f.memoizedProps,c.memoizedState=f.memoizedState,c.updateQueue=f.updateQueue,c.type=f.type,t=f.dependencies,c.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return to(To,To.current&1|2),e.child}t=t.sibling}c.tail!==null&&Yo()>wb&&(e.flags|=128,n=!0,_S(c,!1),e.lanes=4194304)}else{if(!n)if(t=Ik(f),t!==null){if(e.flags|=128,n=!0,i=t.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),_S(c,!0),c.tail===null&&c.tailMode==="hidden"&&!f.alternate&&!mo)return xl(e),null}else 2*Yo()-c.renderingStartTime>wb&&i!==1073741824&&(e.flags|=128,n=!0,_S(c,!1),e.lanes=4194304);c.isBackwards?(f.sibling=e.child,e.child=f):(i=c.last,i!==null?i.sibling=f:e.child=f,c.last=f)}return c.tail!==null?(e=c.tail,c.rendering=e,c.tail=e.sibling,c.renderingStartTime=Yo(),e.sibling=null,i=To.current,to(To,n?i&1|2:i&1),e):(xl(e),null);case 22:case 23:return I3(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?Yc&1073741824&&(xl(e),e.subtreeFlags&6&&(e.flags|=8192)):xl(e),null;case 24:return null;case 25:return null}throw Error(Mi(156,e.tag))}function pye(t,e){switch(l3(e),e.tag){case 1:return zc(e.type)&&bk(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xb(),lo(jc),lo(El),y3(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return g3(e),null;case 13:if(lo(To),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Mi(340));_b()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lo(To),null;case 4:return xb(),null;case 10:return h3(e.type._context),null;case 22:case 23:return I3(),null;case 24:return null;default:return null}}var HA=!1,Tl=!1,fye=typeof WeakSet=="function"?WeakSet:Set,_n=null;function h0(t,e){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(n){Bo(t,e,n)}else i.current=null}function NL(t,e,i){try{i()}catch(n){Bo(t,e,n)}}var Q$=!1;function mye(t,e){if(fL=yk,t=nY(),o3(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var n=i.getSelection&&i.getSelection();if(n&&n.rangeCount!==0){i=n.anchorNode;var o=n.anchorOffset,c=n.focusNode;n=n.focusOffset;try{i.nodeType,c.nodeType}catch{i=null;break e}var f=0,r=-1,x=-1,S=0,C=0,I=t,N=null;t:for(;;){for(var D;I!==i||o!==0&&I.nodeType!==3||(r=f+o),I!==c||n!==0&&I.nodeType!==3||(x=f+n),I.nodeType===3&&(f+=I.nodeValue.length),(D=I.firstChild)!==null;)N=I,I=D;for(;;){if(I===t)break t;if(N===i&&++S===o&&(r=f),N===c&&++C===n&&(x=f),(D=I.nextSibling)!==null)break;I=N,N=I.parentNode}I=D}i=r===-1||x===-1?null:{start:r,end:x}}else i=null}i=i||{start:0,end:0}}else i=null;for(mL={focusedElem:t,selectionRange:i},yk=!1,_n=e;_n!==null;)if(e=_n,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,_n=t;else for(;_n!==null;){e=_n;try{var V=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(V!==null){var B=V.memoizedProps,W=V.memoizedState,$=e.stateNode,G=$.getSnapshotBeforeUpdate(e.elementType===e.type?B:hd(e.type,B),W);$.__reactInternalSnapshotBeforeUpdate=G}break;case 3:var te=e.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Mi(163))}}catch(ce){Bo(e,e.return,ce)}if(t=e.sibling,t!==null){t.return=e.return,_n=t;break}_n=e.return}return V=Q$,Q$=!1,V}function cT(t,e,i){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&t)===t){var c=o.destroy;o.destroy=void 0,c!==void 0&&NL(e,i,c)}o=o.next}while(o!==n)}}function ON(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var i=e=e.next;do{if((i.tag&t)===t){var n=i.create;i.destroy=n()}i=i.next}while(i!==e)}}function ML(t){var e=t.ref;if(e!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof e=="function"?e(t):e.current=t}}function JY(t){var e=t.alternate;e!==null&&(t.alternate=null,JY(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Nh],delete e[qT],delete e[_L],delete e[Yge],delete e[Qge])),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 eQ(t){return t.tag===5||t.tag===3||t.tag===4}function J$(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||eQ(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 DL(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.nodeType===8?i.parentNode.insertBefore(t,e):i.insertBefore(t,e):(i.nodeType===8?(e=i.parentNode,e.insertBefore(t,i)):(e=i,e.appendChild(t)),i=i._reactRootContainer,i!=null||e.onclick!==null||(e.onclick=xk));else if(n!==4&&(t=t.child,t!==null))for(DL(t,e,i),t=t.sibling;t!==null;)DL(t,e,i),t=t.sibling}function RL(t,e,i){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?i.insertBefore(t,e):i.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(RL(t,e,i),t=t.sibling;t!==null;)RL(t,e,i),t=t.sibling}var il=null,xd=!1;function lm(t,e,i){for(i=i.child;i!==null;)tQ(t,e,i),i=i.sibling}function tQ(t,e,i){if(Fh&&typeof Fh.onCommitFiberUnmount=="function")try{Fh.onCommitFiberUnmount(PN,i)}catch{}switch(i.tag){case 5:Tl||h0(i,e);case 6:var n=il,o=xd;il=null,lm(t,e,i),il=n,xd=o,il!==null&&(xd?(t=il,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):il.removeChild(i.stateNode));break;case 18:il!==null&&(xd?(t=il,i=i.stateNode,t.nodeType===8?hj(t.parentNode,i):t.nodeType===1&&hj(t,i),FT(t)):hj(il,i.stateNode));break;case 4:n=il,o=xd,il=i.stateNode.containerInfo,xd=!0,lm(t,e,i),il=n,xd=o;break;case 0:case 11:case 14:case 15:if(!Tl&&(n=i.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var c=o,f=c.destroy;c=c.tag,f!==void 0&&(c&2||c&4)&&NL(i,e,f),o=o.next}while(o!==n)}lm(t,e,i);break;case 1:if(!Tl&&(h0(i,e),n=i.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=i.memoizedProps,n.state=i.memoizedState,n.componentWillUnmount()}catch(r){Bo(i,e,r)}lm(t,e,i);break;case 21:lm(t,e,i);break;case 22:i.mode&1?(Tl=(n=Tl)||i.memoizedState!==null,lm(t,e,i),Tl=n):lm(t,e,i);break;default:lm(t,e,i)}}function e8(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new fye),e.forEach(function(n){var o=Tye.bind(null,t,n);i.has(n)||(i.add(n),n.then(o,o))})}}function cd(t,e){var i=e.deletions;if(i!==null)for(var n=0;n<i.length;n++){var o=i[n];try{var c=t,f=e,r=f;e:for(;r!==null;){switch(r.tag){case 5:il=r.stateNode,xd=!1;break e;case 3:il=r.stateNode.containerInfo,xd=!0;break e;case 4:il=r.stateNode.containerInfo,xd=!0;break e}r=r.return}if(il===null)throw Error(Mi(160));tQ(c,f,o),il=null,xd=!1;var x=o.alternate;x!==null&&(x.return=null),o.return=null}catch(S){Bo(o,e,S)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)iQ(e,t),e=e.sibling}function iQ(t,e){var i=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(cd(e,t),ph(t),n&4){try{cT(3,t,t.return),ON(3,t)}catch(B){Bo(t,t.return,B)}try{cT(5,t,t.return)}catch(B){Bo(t,t.return,B)}}break;case 1:cd(e,t),ph(t),n&512&&i!==null&&h0(i,i.return);break;case 5:if(cd(e,t),ph(t),n&512&&i!==null&&h0(i,i.return),t.flags&32){var o=t.stateNode;try{jT(o,"")}catch(B){Bo(t,t.return,B)}}if(n&4&&(o=t.stateNode,o!=null)){var c=t.memoizedProps,f=i!==null?i.memoizedProps:c,r=t.type,x=t.updateQueue;if(t.updateQueue=null,x!==null)try{r==="input"&&c.type==="radio"&&c.name!=null&&TX(o,c),rL(r,f);var S=rL(r,c);for(f=0;f<x.length;f+=2){var C=x[f],I=x[f+1];C==="style"?kX(o,I):C==="dangerouslySetInnerHTML"?AX(o,I):C==="children"?jT(o,I):WF(o,C,I,S)}switch(r){case"input":Jz(o,c);break;case"textarea":CX(o,c);break;case"select":var N=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!c.multiple;var D=c.value;D!=null?_0(o,!!c.multiple,D,!1):N!==!!c.multiple&&(c.defaultValue!=null?_0(o,!!c.multiple,c.defaultValue,!0):_0(o,!!c.multiple,c.multiple?[]:"",!1))}o[qT]=c}catch(B){Bo(t,t.return,B)}}break;case 6:if(cd(e,t),ph(t),n&4){if(t.stateNode===null)throw Error(Mi(162));o=t.stateNode,c=t.memoizedProps;try{o.nodeValue=c}catch(B){Bo(t,t.return,B)}}break;case 3:if(cd(e,t),ph(t),n&4&&i!==null&&i.memoizedState.isDehydrated)try{FT(e.containerInfo)}catch(B){Bo(t,t.return,B)}break;case 4:cd(e,t),ph(t);break;case 13:cd(e,t),ph(t),o=t.child,o.flags&8192&&(c=o.memoizedState!==null,o.stateNode.isHidden=c,!c||o.alternate!==null&&o.alternate.memoizedState!==null||(E3=Yo())),n&4&&e8(t);break;case 22:if(C=i!==null&&i.memoizedState!==null,t.mode&1?(Tl=(S=Tl)||C,cd(e,t),Tl=S):cd(e,t),ph(t),n&8192){if(S=t.memoizedState!==null,(t.stateNode.isHidden=S)&&!C&&t.mode&1)for(_n=t,C=t.child;C!==null;){for(I=_n=C;_n!==null;){switch(N=_n,D=N.child,N.tag){case 0:case 11:case 14:case 15:cT(4,N,N.return);break;case 1:h0(N,N.return);var V=N.stateNode;if(typeof V.componentWillUnmount=="function"){n=N,i=N.return;try{e=n,V.props=e.memoizedProps,V.state=e.memoizedState,V.componentWillUnmount()}catch(B){Bo(n,i,B)}}break;case 5:h0(N,N.return);break;case 22:if(N.memoizedState!==null){i8(I);continue}}D!==null?(D.return=N,_n=D):i8(I)}C=C.sibling}e:for(C=null,I=t;;){if(I.tag===5){if(C===null){C=I;try{o=I.stateNode,S?(c=o.style,typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none"):(r=I.stateNode,x=I.memoizedProps.style,f=x!=null&&x.hasOwnProperty("display")?x.display:null,r.style.display=IX("display",f))}catch(B){Bo(t,t.return,B)}}}else if(I.tag===6){if(C===null)try{I.stateNode.nodeValue=S?"":I.memoizedProps}catch(B){Bo(t,t.return,B)}}else if((I.tag!==22&&I.tag!==23||I.memoizedState===null||I===t)&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===t)break e;for(;I.sibling===null;){if(I.return===null||I.return===t)break e;C===I&&(C=null),I=I.return}C===I&&(C=null),I.sibling.return=I.return,I=I.sibling}}break;case 19:cd(e,t),ph(t),n&4&&e8(t);break;case 21:break;default:cd(e,t),ph(t)}}function ph(t){var e=t.flags;if(e&2){try{e:{for(var i=t.return;i!==null;){if(eQ(i)){var n=i;break e}i=i.return}throw Error(Mi(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(jT(o,""),n.flags&=-33);var c=J$(t);RL(t,c,o);break;case 3:case 4:var f=n.stateNode.containerInfo,r=J$(t);DL(t,r,f);break;default:throw Error(Mi(161))}}catch(x){Bo(t,t.return,x)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function gye(t,e,i){_n=t,nQ(t)}function nQ(t,e,i){for(var n=(t.mode&1)!==0;_n!==null;){var o=_n,c=o.child;if(o.tag===22&&n){var f=o.memoizedState!==null||HA;if(!f){var r=o.alternate,x=r!==null&&r.memoizedState!==null||Tl;r=HA;var S=Tl;if(HA=f,(Tl=x)&&!S)for(_n=o;_n!==null;)f=_n,x=f.child,f.tag===22&&f.memoizedState!==null?n8(o):x!==null?(x.return=f,_n=x):n8(o);for(;c!==null;)_n=c,nQ(c),c=c.sibling;_n=o,HA=r,Tl=S}t8(t)}else o.subtreeFlags&8772&&c!==null?(c.return=o,_n=c):t8(t)}}function t8(t){for(;_n!==null;){var e=_n;if(e.flags&8772){var i=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Tl||ON(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!Tl)if(i===null)n.componentDidMount();else{var o=e.elementType===e.type?i.memoizedProps:hd(e.type,i.memoizedProps);n.componentDidUpdate(o,i.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var c=e.updateQueue;c!==null&&F$(e,c,n);break;case 3:var f=e.updateQueue;if(f!==null){if(i=null,e.child!==null)switch(e.child.tag){case 5:i=e.child.stateNode;break;case 1:i=e.child.stateNode}F$(e,f,i)}break;case 5:var r=e.stateNode;if(i===null&&e.flags&4){i=r;var x=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":x.autoFocus&&i.focus();break;case"img":x.src&&(i.src=x.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var S=e.alternate;if(S!==null){var C=S.memoizedState;if(C!==null){var I=C.dehydrated;I!==null&&FT(I)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Mi(163))}Tl||e.flags&512&&ML(e)}catch(N){Bo(e,e.return,N)}}if(e===t){_n=null;break}if(i=e.sibling,i!==null){i.return=e.return,_n=i;break}_n=e.return}}function i8(t){for(;_n!==null;){var e=_n;if(e===t){_n=null;break}var i=e.sibling;if(i!==null){i.return=e.return,_n=i;break}_n=e.return}}function n8(t){for(;_n!==null;){var e=_n;try{switch(e.tag){case 0:case 11:case 15:var i=e.return;try{ON(4,e)}catch(x){Bo(e,i,x)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(x){Bo(e,o,x)}}var c=e.return;try{ML(e)}catch(x){Bo(e,c,x)}break;case 5:var f=e.return;try{ML(e)}catch(x){Bo(e,f,x)}}}catch(x){Bo(e,e.return,x)}if(e===t){_n=null;break}var r=e.sibling;if(r!==null){r.return=e.return,_n=r;break}_n=e.return}}var yye=Math.ceil,Nk=df.ReactCurrentDispatcher,T3=df.ReactCurrentOwner,Du=df.ReactCurrentBatchConfig,Es=0,Ua=null,ha=null,al=0,Yc=0,p0=Ng(0),Ta=0,XT=null,z_=0,FN=0,C3=0,uT=null,kc=null,E3=0,wb=1/0,Rp=null,Mk=!1,jL=null,Jm=null,GA=!1,Um=null,Dk=0,dT=0,zL=null,BI=-1,UI=0;function sc(){return Es&6?Yo():BI!==-1?BI:BI=Yo()}function eg(t){return t.mode&1?Es&2&&al!==0?al&-al:eye.transition!==null?(UI===0&&(UI=UX()),UI):(t=Vs,t!==0||(t=window.event,t=t===void 0?16:KX(t.type)),t):1}function Dd(t,e,i,n){if(50<dT)throw dT=0,zL=null,Error(Mi(185));sE(t,i,n),(!(Es&2)||t!==Ua)&&(t===Ua&&(!(Es&2)&&(FN|=i),Ta===4&&Cm(t,al)),Lc(t,n),i===1&&Es===0&&!(e.mode&1)&&(wb=Yo()+500,jN&&Mg()))}function Lc(t,e){var i=t.callbackNode;ege(t,e);var n=gk(t,t===Ua?al:0);if(n===0)i!==null&&h$(i),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(i!=null&&h$(i),e===1)t.tag===0?Jge(r8.bind(null,t)):pY(r8.bind(null,t)),Zge(function(){!(Es&6)&&Mg()}),i=null;else{switch(VX(n)){case 1:i=QF;break;case 4:i=FX;break;case 16:i=mk;break;case 536870912:i=BX;break;default:i=mk}i=dQ(i,rQ.bind(null,t))}t.callbackPriority=e,t.callbackNode=i}}function rQ(t,e){if(BI=-1,UI=0,Es&6)throw Error(Mi(327));var i=t.callbackNode;if(S0()&&t.callbackNode!==i)return null;var n=gk(t,t===Ua?al:0);if(n===0)return null;if(n&30||n&t.expiredLanes||e)e=Rk(t,n);else{e=n;var o=Es;Es|=2;var c=oQ();(Ua!==t||al!==e)&&(Rp=null,wb=Yo()+500,C_(t,e));do try{xye();break}catch(r){sQ(t,r)}while(!0);d3(),Nk.current=c,Es=o,ha!==null?e=0:(Ua=null,al=0,e=Ta)}if(e!==0){if(e===2&&(o=cL(t),o!==0&&(n=o,e=LL(t,o))),e===1)throw i=XT,C_(t,0),Cm(t,n),Lc(t,Yo()),i;if(e===6)Cm(t,n);else{if(o=t.current.alternate,!(n&30)&&!_ye(o)&&(e=Rk(t,n),e===2&&(c=cL(t),c!==0&&(n=c,e=LL(t,c))),e===1))throw i=XT,C_(t,0),Cm(t,n),Lc(t,Yo()),i;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(Mi(345));case 2:qy(t,kc,Rp);break;case 3:if(Cm(t,n),(n&130023424)===n&&(e=E3+500-Yo(),10<e)){if(gk(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){sc(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=yL(qy.bind(null,t,kc,Rp),e);break}qy(t,kc,Rp);break;case 4:if(Cm(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var f=31-Md(n);c=1<<f,f=e[f],f>o&&(o=f),n&=~c}if(n=o,n=Yo()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*yye(n/1960))-n,10<n){t.timeoutHandle=yL(qy.bind(null,t,kc,Rp),n);break}qy(t,kc,Rp);break;case 5:qy(t,kc,Rp);break;default:throw Error(Mi(329))}}}return Lc(t,Yo()),t.callbackNode===i?rQ.bind(null,t):null}function LL(t,e){var i=uT;return t.current.memoizedState.isDehydrated&&(C_(t,e).flags|=256),t=Rk(t,e),t!==2&&(e=kc,kc=i,e!==null&&OL(e)),t}function OL(t){kc===null?kc=t:kc.push.apply(kc,t)}function _ye(t){for(var e=t;;){if(e.flags&16384){var i=e.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var n=0;n<i.length;n++){var o=i[n],c=o.getSnapshot;o=o.value;try{if(!zd(c(),o))return!1}catch{return!1}}}if(i=e.child,e.subtreeFlags&16384&&i!==null)i.return=e,e=i;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 Cm(t,e){for(e&=~C3,e&=~FN,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var i=31-Md(e),n=1<<i;t[i]=-1,e&=~n}}function r8(t){if(Es&6)throw Error(Mi(327));S0();var e=gk(t,0);if(!(e&1))return Lc(t,Yo()),null;var i=Rk(t,e);if(t.tag!==0&&i===2){var n=cL(t);n!==0&&(e=n,i=LL(t,n))}if(i===1)throw i=XT,C_(t,0),Cm(t,e),Lc(t,Yo()),i;if(i===6)throw Error(Mi(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,qy(t,kc,Rp),Lc(t,Yo()),null}function A3(t,e){var i=Es;Es|=1;try{return t(e)}finally{Es=i,Es===0&&(wb=Yo()+500,jN&&Mg())}}function L_(t){Um!==null&&Um.tag===0&&!(Es&6)&&S0();var e=Es;Es|=1;var i=Du.transition,n=Vs;try{if(Du.transition=null,Vs=1,t)return t()}finally{Vs=n,Du.transition=i,Es=e,!(Es&6)&&Mg()}}function I3(){Yc=p0.current,lo(p0)}function C_(t,e){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,Kge(i)),ha!==null)for(i=ha.return;i!==null;){var n=i;switch(l3(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&bk();break;case 3:xb(),lo(jc),lo(El),y3();break;case 5:g3(n);break;case 4:xb();break;case 13:lo(To);break;case 19:lo(To);break;case 10:h3(n.type._context);break;case 22:case 23:I3()}i=i.return}if(Ua=t,ha=t=tg(t.current,null),al=Yc=e,Ta=0,XT=null,C3=FN=z_=0,kc=uT=null,Yy!==null){for(e=0;e<Yy.length;e++)if(i=Yy[e],n=i.interleaved,n!==null){i.interleaved=null;var o=n.next,c=i.pending;if(c!==null){var f=c.next;c.next=o,n.next=f}i.pending=n}Yy=null}return t}function sQ(t,e){do{var i=ha;try{if(d3(),LI.current=Pk,kk){for(var n=Eo.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}kk=!1}if(j_=0,Oa=xa=Eo=null,lT=!1,WT=0,T3.current=null,i===null||i.return===null){Ta=1,XT=e,ha=null;break}e:{var c=t,f=i.return,r=i,x=e;if(e=al,r.flags|=32768,x!==null&&typeof x=="object"&&typeof x.then=="function"){var S=x,C=r,I=C.tag;if(!(C.mode&1)&&(I===0||I===11||I===15)){var N=C.alternate;N?(C.updateQueue=N.updateQueue,C.memoizedState=N.memoizedState,C.lanes=N.lanes):(C.updateQueue=null,C.memoizedState=null)}var D=H$(f);if(D!==null){D.flags&=-257,G$(D,f,r,c,e),D.mode&1&&q$(c,S,e),e=D,x=S;var V=e.updateQueue;if(V===null){var B=new Set;B.add(x),e.updateQueue=B}else V.add(x);break e}else{if(!(e&1)){q$(c,S,e),k3();break e}x=Error(Mi(426))}}else if(mo&&r.mode&1){var W=H$(f);if(W!==null){!(W.flags&65536)&&(W.flags|=256),G$(W,f,r,c,e),c3(bb(x,r));break e}}c=x=bb(x,r),Ta!==4&&(Ta=2),uT===null?uT=[c]:uT.push(c),c=f;do{switch(c.tag){case 3:c.flags|=65536,e&=-e,c.lanes|=e;var $=VY(c,x,e);O$(c,$);break e;case 1:r=x;var G=c.type,te=c.stateNode;if(!(c.flags&128)&&(typeof G.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(Jm===null||!Jm.has(te)))){c.flags|=65536,e&=-e,c.lanes|=e;var ce=$Y(c,r,e);O$(c,ce);break e}}c=c.return}while(c!==null)}lQ(i)}catch(_e){e=_e,ha===i&&i!==null&&(ha=i=i.return);continue}break}while(!0)}function oQ(){var t=Nk.current;return Nk.current=Pk,t===null?Pk:t}function k3(){(Ta===0||Ta===3||Ta===2)&&(Ta=4),Ua===null||!(z_&268435455)&&!(FN&268435455)||Cm(Ua,al)}function Rk(t,e){var i=Es;Es|=2;var n=oQ();(Ua!==t||al!==e)&&(Rp=null,C_(t,e));do try{vye();break}catch(o){sQ(t,o)}while(!0);if(d3(),Es=i,Nk.current=n,ha!==null)throw Error(Mi(261));return Ua=null,al=0,Ta}function vye(){for(;ha!==null;)aQ(ha)}function xye(){for(;ha!==null&&!Hme();)aQ(ha)}function aQ(t){var e=uQ(t.alternate,t,Yc);t.memoizedProps=t.pendingProps,e===null?lQ(t):ha=e,T3.current=null}function lQ(t){var e=t;do{var i=e.alternate;if(t=e.return,e.flags&32768){if(i=pye(i,e),i!==null){i.flags&=32767,ha=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Ta=6,ha=null;return}}else if(i=hye(i,e,Yc),i!==null){ha=i;return}if(e=e.sibling,e!==null){ha=e;return}ha=e=t}while(e!==null);Ta===0&&(Ta=5)}function qy(t,e,i){var n=Vs,o=Du.transition;try{Du.transition=null,Vs=1,bye(t,e,i,n)}finally{Du.transition=o,Vs=n}return null}function bye(t,e,i,n){do S0();while(Um!==null);if(Es&6)throw Error(Mi(327));i=t.finishedWork;var o=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(Mi(177));t.callbackNode=null,t.callbackPriority=0;var c=i.lanes|i.childLanes;if(tge(t,c),t===Ua&&(ha=Ua=null,al=0),!(i.subtreeFlags&2064)&&!(i.flags&2064)||GA||(GA=!0,dQ(mk,function(){return S0(),null})),c=(i.flags&15990)!==0,i.subtreeFlags&15990||c){c=Du.transition,Du.transition=null;var f=Vs;Vs=1;var r=Es;Es|=4,T3.current=null,mye(t,i),iQ(i,t),Uge(mL),yk=!!fL,mL=fL=null,t.current=i,gye(i),Gme(),Es=r,Vs=f,Du.transition=c}else t.current=i;if(GA&&(GA=!1,Um=t,Dk=o),c=t.pendingLanes,c===0&&(Jm=null),Zme(i.stateNode),Lc(t,Yo()),e!==null)for(n=t.onRecoverableError,i=0;i<e.length;i++)o=e[i],n(o.value,{componentStack:o.stack,digest:o.digest});if(Mk)throw Mk=!1,t=jL,jL=null,t;return Dk&1&&t.tag!==0&&S0(),c=t.pendingLanes,c&1?t===zL?dT++:(dT=0,zL=t):dT=0,Mg(),null}function S0(){if(Um!==null){var t=VX(Dk),e=Du.transition,i=Vs;try{if(Du.transition=null,Vs=16>t?16:t,Um===null)var n=!1;else{if(t=Um,Um=null,Dk=0,Es&6)throw Error(Mi(331));var o=Es;for(Es|=4,_n=t.current;_n!==null;){var c=_n,f=c.child;if(_n.flags&16){var r=c.deletions;if(r!==null){for(var x=0;x<r.length;x++){var S=r[x];for(_n=S;_n!==null;){var C=_n;switch(C.tag){case 0:case 11:case 15:cT(8,C,c)}var I=C.child;if(I!==null)I.return=C,_n=I;else for(;_n!==null;){C=_n;var N=C.sibling,D=C.return;if(JY(C),C===S){_n=null;break}if(N!==null){N.return=D,_n=N;break}_n=D}}}var V=c.alternate;if(V!==null){var B=V.child;if(B!==null){V.child=null;do{var W=B.sibling;B.sibling=null,B=W}while(B!==null)}}_n=c}}if(c.subtreeFlags&2064&&f!==null)f.return=c,_n=f;else e:for(;_n!==null;){if(c=_n,c.flags&2048)switch(c.tag){case 0:case 11:case 15:cT(9,c,c.return)}var $=c.sibling;if($!==null){$.return=c.return,_n=$;break e}_n=c.return}}var G=t.current;for(_n=G;_n!==null;){f=_n;var te=f.child;if(f.subtreeFlags&2064&&te!==null)te.return=f,_n=te;else e:for(f=G;_n!==null;){if(r=_n,r.flags&2048)try{switch(r.tag){case 0:case 11:case 15:ON(9,r)}}catch(_e){Bo(r,r.return,_e)}if(r===f){_n=null;break e}var ce=r.sibling;if(ce!==null){ce.return=r.return,_n=ce;break e}_n=r.return}}if(Es=o,Mg(),Fh&&typeof Fh.onPostCommitFiberRoot=="function")try{Fh.onPostCommitFiberRoot(PN,t)}catch{}n=!0}return n}finally{Vs=i,Du.transition=e}}return!1}function s8(t,e,i){e=bb(i,e),e=VY(t,e,1),t=Qm(t,e,1),e=sc(),t!==null&&(sE(t,1,e),Lc(t,e))}function Bo(t,e,i){if(t.tag===3)s8(t,t,i);else for(;e!==null;){if(e.tag===3){s8(e,t,i);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Jm===null||!Jm.has(n))){t=bb(i,t),t=$Y(e,t,1),e=Qm(e,t,1),t=sc(),e!==null&&(sE(e,1,t),Lc(e,t));break}}e=e.return}}function wye(t,e,i){var n=t.pingCache;n!==null&&n.delete(e),e=sc(),t.pingedLanes|=t.suspendedLanes&i,Ua===t&&(al&i)===i&&(Ta===4||Ta===3&&(al&130023424)===al&&500>Yo()-E3?C_(t,0):C3|=i),Lc(t,e)}function cQ(t,e){e===0&&(t.mode&1?(e=zA,zA<<=1,!(zA&130023424)&&(zA=4194304)):e=1);var i=sc();t=nf(t,e),t!==null&&(sE(t,e,i),Lc(t,i))}function Sye(t){var e=t.memoizedState,i=0;e!==null&&(i=e.retryLane),cQ(t,i)}function Tye(t,e){var i=0;switch(t.tag){case 13:var n=t.stateNode,o=t.memoizedState;o!==null&&(i=o.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Mi(314))}n!==null&&n.delete(e),cQ(t,i)}var uQ;uQ=function(t,e,i){if(t!==null)if(t.memoizedProps!==e.pendingProps||jc.current)Dc=!0;else{if(!(t.lanes&i)&&!(e.flags&128))return Dc=!1,dye(t,e,i);Dc=!!(t.flags&131072)}else Dc=!1,mo&&e.flags&1048576&&fY(e,Tk,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;FI(t,e),t=e.pendingProps;var o=yb(e,El.current);w0(e,i),o=v3(null,e,n,t,o,i);var c=x3();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,zc(n)?(c=!0,wk(e)):c=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,f3(e),o.updater=LN,e.stateNode=o,o._reactInternals=e,TL(e,n,t,i),e=AL(null,e,n,!0,c,i)):(e.tag=0,mo&&c&&a3(e),ec(null,e,o,i),e=e.child),e;case 16:n=e.elementType;e:{switch(FI(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Eye(n),t=hd(n,t),o){case 0:e=EL(null,e,n,t,i);break e;case 1:e=Z$(null,e,n,t,i);break e;case 11:e=W$(null,e,n,t,i);break e;case 14:e=K$(null,e,n,hd(n.type,t),i);break e}throw Error(Mi(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:hd(n,o),EL(t,e,n,o,i);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:hd(n,o),Z$(t,e,n,o,i);case 3:e:{if(WY(e),t===null)throw Error(Mi(387));n=e.pendingProps,c=e.memoizedState,o=c.element,xY(t,e),Ak(e,n,null,i);var f=e.memoizedState;if(n=f.element,c.isDehydrated)if(c={element:n,isDehydrated:!1,cache:f.cache,pendingSuspenseBoundaries:f.pendingSuspenseBoundaries,transitions:f.transitions},e.updateQueue.baseState=c,e.memoizedState=c,e.flags&256){o=bb(Error(Mi(423)),e),e=X$(t,e,n,i,o);break e}else if(n!==o){o=bb(Error(Mi(424)),e),e=X$(t,e,n,i,o);break e}else for(tu=Ym(e.stateNode.containerInfo.firstChild),iu=e,mo=!0,Sd=null,i=_Y(e,null,n,i),e.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(_b(),n===o){e=rf(t,e,i);break e}ec(t,e,n,i)}e=e.child}return e;case 5:return bY(e),t===null&&bL(e),n=e.type,o=e.pendingProps,c=t!==null?t.memoizedProps:null,f=o.children,gL(n,o)?f=null:c!==null&&gL(n,c)&&(e.flags|=32),GY(t,e),ec(t,e,f,i),e.child;case 6:return t===null&&bL(e),null;case 13:return KY(t,e,i);case 4:return m3(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=vb(e,null,n,i):ec(t,e,n,i),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:hd(n,o),W$(t,e,n,o,i);case 7:return ec(t,e,e.pendingProps,i),e.child;case 8:return ec(t,e,e.pendingProps.children,i),e.child;case 12:return ec(t,e,e.pendingProps.children,i),e.child;case 10:e:{if(n=e.type._context,o=e.pendingProps,c=e.memoizedProps,f=o.value,to(Ck,n._currentValue),n._currentValue=f,c!==null)if(zd(c.value,f)){if(c.children===o.children&&!jc.current){e=rf(t,e,i);break e}}else for(c=e.child,c!==null&&(c.return=e);c!==null;){var r=c.dependencies;if(r!==null){f=c.child;for(var x=r.firstContext;x!==null;){if(x.context===n){if(c.tag===1){x=Xp(-1,i&-i),x.tag=2;var S=c.updateQueue;if(S!==null){S=S.shared;var C=S.pending;C===null?x.next=x:(x.next=C.next,C.next=x),S.pending=x}}c.lanes|=i,x=c.alternate,x!==null&&(x.lanes|=i),wL(c.return,i,e),r.lanes|=i;break}x=x.next}}else if(c.tag===10)f=c.type===e.type?null:c.child;else if(c.tag===18){if(f=c.return,f===null)throw Error(Mi(341));f.lanes|=i,r=f.alternate,r!==null&&(r.lanes|=i),wL(f,i,e),f=c.sibling}else f=c.child;if(f!==null)f.return=c;else for(f=c;f!==null;){if(f===e){f=null;break}if(c=f.sibling,c!==null){c.return=f.return,f=c;break}f=f.return}c=f}ec(t,e,o.children,i),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,w0(e,i),o=Bu(o),n=n(o),e.flags|=1,ec(t,e,n,i),e.child;case 14:return n=e.type,o=hd(n,e.pendingProps),o=hd(n.type,o),K$(t,e,n,o,i);case 15:return qY(t,e,e.type,e.pendingProps,i);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:hd(n,o),FI(t,e),e.tag=1,zc(n)?(t=!0,wk(e)):t=!1,w0(e,i),UY(e,n,o),TL(e,n,o,i),AL(null,e,n,!0,t,i);case 19:return ZY(t,e,i);case 22:return HY(t,e,i)}throw Error(Mi(156,e.tag))};function dQ(t,e){return OX(t,e)}function Cye(t,e,i,n){this.tag=t,this.key=i,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mu(t,e,i,n){return new Cye(t,e,i,n)}function P3(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Eye(t){if(typeof t=="function")return P3(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ZF)return 11;if(t===XF)return 14}return 2}function tg(t,e){var i=t.alternate;return i===null?(i=Mu(t.tag,e,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=e,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deleti
vendor: 5,556 bytes, line 40
40ons=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,e=t.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function VI(t,e,i,n,o,c){var f=2;if(n=t,typeof t=="function")P3(t)&&(f=1);else if(typeof t=="string")f=5;else e:switch(t){case n0:return E_(i.children,o,c,e);case KF:f=8,o|=8;break;case Kz:return t=Mu(12,i,e,o|2),t.elementType=Kz,t.lanes=c,t;case Zz:return t=Mu(13,i,e,o),t.elementType=Zz,t.lanes=c,t;case Xz:return t=Mu(19,i,e,o),t.elementType=Xz,t.lanes=c,t;case bX:return BN(i,o,c,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case vX:f=10;break e;case xX:f=9;break e;case ZF:f=11;break e;case XF:f=14;break e;case _m:f=16,n=null;break e}throw Error(Mi(130,t==null?t:typeof t,""))}return e=Mu(f,i,e,o),e.elementType=t,e.type=n,e.lanes=c,e}function E_(t,e,i,n){return t=Mu(7,t,n,e),t.lanes=i,t}function BN(t,e,i,n){return t=Mu(22,t,n,e),t.elementType=bX,t.lanes=i,t.stateNode={isHidden:!1},t}function xj(t,e,i){return t=Mu(6,t,null,e),t.lanes=i,t}function bj(t,e,i){return e=Mu(4,t.children!==null?t.children:[],t.key,e),e.lanes=i,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Aye(t,e,i,n,o){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=tj(0),this.expirationTimes=tj(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tj(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function N3(t,e,i,n,o,c,f,r,x){return t=new Aye(t,e,i,r,x),e===1?(e=1,c===!0&&(e|=8)):e=0,c=Mu(3,null,null,e),t.current=c,c.stateNode=t,c.memoizedState={element:n,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},f3(c),t}function Iye(t,e,i){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i0,key:n==null?null:""+n,children:t,containerInfo:e,implementation:i}}function hQ(t){if(!t)return dg;t=t._reactInternals;e:{if(sv(t)!==t||t.tag!==1)throw Error(Mi(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(zc(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(Mi(171))}if(t.tag===1){var i=t.type;if(zc(i))return hY(t,i,e)}return e}function pQ(t,e,i,n,o,c,f,r,x){return t=N3(i,n,!0,t,o,c,f,r,x),t.context=hQ(null),i=t.current,n=sc(),o=eg(i),c=Xp(n,o),c.callback=e??null,Qm(i,c,o),t.current.lanes=o,sE(t,o,n),Lc(t,n),t}function UN(t,e,i,n){var o=e.current,c=sc(),f=eg(o);return i=hQ(i),e.context===null?e.context=i:e.pendingContext=i,e=Xp(c,f),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=Qm(o,e,f),t!==null&&(Dd(t,o,f,c),zI(t,o,f)),f}function jk(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 o8(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<e?i:e}}function M3(t,e){o8(t,e),(t=t.alternate)&&o8(t,e)}function kye(){return null}var fQ=typeof reportError=="function"?reportError:function(t){console.error(t)};function D3(t){this._internalRoot=t}VN.prototype.render=D3.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(Mi(409));UN(t,e,null,null)};VN.prototype.unmount=D3.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;L_(function(){UN(null,t,null,null)}),e[tf]=null}};function VN(t){this._internalRoot=t}VN.prototype.unstable_scheduleHydration=function(t){if(t){var e=HX();t={blockedOn:null,target:t,priority:e};for(var i=0;i<Tm.length&&e!==0&&e<Tm[i].priority;i++);Tm.splice(i,0,t),i===0&&WX(t)}};function R3(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function $N(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function a8(){}function Pye(t,e,i,n,o){if(o){if(typeof n=="function"){var c=n;n=function(){var S=jk(f);c.call(S)}}var f=pQ(e,n,t,0,null,!1,!1,"",a8);return t._reactRootContainer=f,t[tf]=f.current,VT(t.nodeType===8?t.parentNode:t),L_(),f}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var r=n;n=function(){var S=jk(x);r.call(S)}}var x=N3(t,0,!1,null,null,!1,!1,"",a8);return t._reactRootContainer=x,t[tf]=x.current,VT(t.nodeType===8?t.parentNode:t),L_(function(){UN(e,x,i,n)}),x}function qN(t,e,i,n,o){var c=i._reactRootContainer;if(c){var f=c;if(typeof o=="function"){var r=o;o=function(){var x=jk(f);r.call(x)}}UN(e,f,t,o)}else f=Pye(i,e,t,o,n);return jk(f)}$X=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var i=BS(e.pendingLanes);i!==0&&(JF(e,i|1),Lc(e,Yo()),!(Es&6)&&(wb=Yo()+500,Mg()))}break;case 13:L_(function(){var n=nf(t,1);if(n!==null){var o=sc();Dd(n,t,1,o)}}),M3(t,1)}};e3=function(t){if(t.tag===13){var e=nf(t,134217728);if(e!==null){var i=sc();Dd(e,t,134217728,i)}M3(t,134217728)}};qX=function(t){if(t.tag===13){var e=eg(t),i=nf(t,e);if(i!==null){var n=sc();Dd(i,t,e,n)}M3(t,e)}};HX=function(){return Vs};GX=function(t,e){var i=Vs;try{return Vs=t,e()}finally{Vs=i}};
40oL=function(t,e,i){switch(e){case"input":if(Jz(t,i),e=i.name,i.type==="radio"&&e!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<i.length;e++){var n=i[e];if(n!==t&&n.form===t.form){var o=RN(n);if(!o)throw Error(Mi(90));SX(n),Jz(n,o)}}}break;case"textarea":CX(t,i);break;case"select":e=i.value,e!=null&&_0(t,!!i.multiple,e,!1)}};MX=A3;DX=L_;var Nye={usingClientEntryPoint:!1,Events:[aE,a0,RN,PX,NX,A3]},vS={findFiberByHostInstance:Xy,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Mye={bundleType:vS.bundleType,version:vS.version,rendererPackageName:vS.rendererPackageName,rendererConfig:vS.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:df.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=zX(t),t===null?null:t.stateNode},findFiberByHostInstance:vS.findFiberByHostInstance||kye,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 WA=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!WA.isDisabled&&WA.supportsFiber)try{PN=WA.inject(Mye),Fh=WA}catch{}}cu.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Nye;cu.createPortal=function(t,e){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!R3(e))throw Error(Mi(200));return Iye(t,e,null,i)};cu.createRoot=function(t,e){if(!R3(t))throw Error(Mi(299));var i=!1,n="",o=fQ;return e!=null&&(e.unstable_strictMode===!0&&(i=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=N3(t,1,!1,null,null,i,!1,n,o),t[tf]=e.current,VT(t.nodeType===8?t.parentNode:t),new D3(e)};cu.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(Mi(188)):(t=Object.keys(t).join(","),Error(Mi(268,t)));return t=zX(e),t=t===null?null:t.stateNode,t};cu.flushSync=function(t){return L_(t)};cu.hydrate=function(t,e,i){if(!$N(e))throw Error(Mi(200));return qN(null,t,e,!0,i)};cu.hydrateRoot=function(t,e,i){if(!R3(t))throw Error(Mi(405));var n=i!=null&&i.hydratedSources||null,o=!1,c="",f=fQ;if(i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(c=i.identifierPrefix),i.onRecoverableError!==void 0&&(f=i.onRecoverableError)),e=pQ(e,null,t,1,i??null,o,!1,c,f),t[tf]=e.current,VT(t),n)for(t=0;t<n.length;t++)i=n[t],o=i._getVersion,o=o(i._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[i,o]:e.mutableSourceEagerHydrationData.push(i,o);return new VN(e)};cu.render=function(t,e,i){if(!$N(e))throw Error(Mi(200));return qN(null,t,e,!1,i)};cu.unmountComponentAtNode=function(t){if(!$N(t))throw Error(Mi(40));return t._reactRootContainer?(L_(function(){qN(null,null,t,!1,function(){t._reactRootContainer=null,t[tf]=null})}),!0):!1};cu.unstable_batchedUpdates=A3;cu.unstable_renderSubtreeIntoContainer=function(t,e,i,n){if(!$N(i))throw Error(Mi(200));if(t==null||t._reactInternals===void 0)throw Error(Mi(38));return qN(t,e,i,!1,n)};cu.version="18.3.1-next-f1338f8080-20240426";function mQ(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mQ)}catch(t){console.error(t)}}mQ(),mX.exports=cu;var ov=mX.exports;const gQ=Xh(ov);var yQ,l8=ov;yQ=l8.createRoot,l8.hydrateRoot;function Dye(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var i,n,o,c,f=[],r="",x=t.split("/");for(x[0]||x.shift();o=x.shift();)i=o[0],i==="*"?(f.push(i),r+=o[1]==="?"?"(?:/(.*))?":"/(.*)"):i===":"?(n=o.indexOf("?",1),c=o.indexOf(".",1),f.push(o.substring(1,~n?n:~c?c:o.length)),r+=~n&&!~c?"(?:/([^/]+?))?":"/([^/]+?)",~c&&(r+=(~n?"?":"")+"\\"+o.substring(c))):r+="/"+o;return{keys:f,pattern:new RegExp("^"+r+(e?"(?=$|/)":"/?$"),"i")}}var _Q={exports:{}},vQ={};/** 41 * @license React 42 * use-sync-external-store-shim.production.js 43 * 44 * Copyright (c) Meta Platforms, Inc. and affiliates. 45 * 46 * This source code is licensed under the MIT license found in the 47 * LICENSE file in the root directory of this source tree. 48 */var Sb=K;function Rye(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var jye=typeof Object.is=="function"?Object.is:Rye,zye=Sb.useState,Lye=Sb.useEffect,Oye=Sb.useLayoutEffect,Fye=Sb.useDebugValue;function Bye(t,e){var i=e(),n=zye({inst:{value:i,getSnapshot:e}}),o=n[0].inst,c=n[1];return Oye(function(){o.value=i,o.getSnapshot=e,wj(o)&&c({inst:o})},[t,i,e]),Lye(function(){return wj(o)&&c({inst:o}),t(function(){wj(o)&&c({inst:o})})},[t]),Fye(i),i}function wj(t){var e=t.getSnapshot;t=t.value;try{var i=e();return!jye(t,i)}catch{return!0}}function Uye(t,e){return e()}var Vye=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Uye:Bye;vQ.useSyncExternalStore=Sb.useSyncExternalStore!==void 0?Sb.useSyncExternalStore:Vye;_Q.exports=vQ;var cE=_Q.exports;const $ye=pX.useInsertionEffect,qye=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Hye=qye?K.useLayoutEffect:K.useEffect,Gye=$ye||Hye,xQ=t=>{const e=K.useRef([t,(...i)=>e[0](...i)]).current;return Gye(()=>{e[0]=t}),e[1]},Wye="popstate",j3="pushState",z3="replaceState",Kye="hashchange",c8=[Wye,j3,z3,Kye],Zye=t=>{for(const e of c8)addEventListener(e,t);return()=>{for(const e of c8)removeEventListener(e,t)}},bQ=(t,e)=>cE.useSyncExternalStore(Zye,t,e),Xye=()=>location.search,Yye=({ssrSearch:t=""}={})=>bQ(Xye,()=>t),u8=()=>location.pathname,Qye=({ssrPath:t}={})=>bQ(u8,t?()=>t:u8),Jye=(t,{replace:e=!1,state:i=null}={})=>history[e?z3:j3](i,"",t),e_e=(t={})=>[Qye(t),Jye],d8=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[d8]>"u"){for(const t of[j3,z3]){const e=history[t];history[t]=function(){const i=e.apply(this,arguments),n=new Event(t);return n.arguments=arguments,dispatchEvent(n),i}}Object.defineProperty(window,d8,{value:!0})}const t_e=(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())?"~"+e:e.slice(t.length)||"/",wQ=(t="")=>t==="/"?"":t,i_e=(t,e)=>t[0]==="~"?t.slice(1):wQ(e)+t,n_e=(t="",e)=>t_e(h8(wQ(t)),h8(e)),h8=t=>{try{return decodeURI(t)}catch{return t}},SQ={hook:e_e,searchHook:Yye,parser:Dye,base:"",ssrPath:void 0,ssrSearch:void 0,hrefs:t=>t},TQ=K.createContext(SQ),Wb=()=>K.useContext(TQ),CQ={},EQ=K.createContext(CQ),r_e=()=>K.useContext(EQ),HN=t=>{const[e,i]=t.hook(t);return[n_e(t.base,e),xQ((n,o)=>i(i_e(n,t.base),o))]},$o=()=>HN(Wb()),L3=(t,e,i,n)=>{const{pattern:o,keys:c}=e instanceof RegExp?{keys:!1,pattern:e}:t(e||"*",n),f=o.exec(i)||[],[r,...x]=f;return r!==void 0?[!0,(()=>{const S=c!==!1?Object.fromEntries(c.map((I,N)=>[I,x[N]])):f.groups;let C={...x};return S&&Object.assign(C,S),C})(),...n?[r]:[]]:[!1,null]},uE=t=>L3(Wb().parser,t,$o()[0]),s_e=({children:t,...e})=>{var C,I;const i=Wb(),n=e.hook?SQ:i;let o=n;const[c,f]=((C=e.ssrPath)==null?void 0:C.split("?"))??[];f&&(e.ssrSearch=f,e.ssrPath=c),e.hrefs=e.hrefs??((I=e.hook)==null?void 0:I.hrefs);let r=K.useRef({}),x=r.current,S=x;for(let N in n){const D=N==="base"?n[N]+(e[N]||""):e[N]||n[N];x===S&&D!==S[N]&&(r.current=S={...S}),S[N]=D,D!==n[N]&&(o=S)}return K.createElement(TQ.Provider,{value:o,children:t})},p8=({children:t,component:e},i)=>e?K.createElement(e,{params:i}):typeof t=="function"?t(i):t,o_e=t=>{let e=K.useRef(CQ),i=e.current;for(const n in t)t[n]!==i[n]&&(i=t);return Object.keys(t).length===0&&(i=t),e.current=i},xr=({path:t,nest:e,match:i,...n})=>{const o=Wb(),[c]=HN(o),[f,r,x]=i??L3(o.parser,t,c,e),S=o_e({...r_e(),...r});if(!f)return null;const C=x?K.createElement(s_e,{base:x},p8(n,S)):p8(n,S);return K.createElement(EQ.Provider,{value:S,children:C})},yr=K.forwardRef((t,e)=>{const i=Wb(),[n,o]=HN(i),{to:c="",href:f=c,onClick:r,asChild:x,children:S,className:C,replace:I,state:N,...D}=t,V=xQ(W=>{W.ctrlKey||W.metaKey||W.altKey||W.shiftKey||W.button!==0||(r==null||r(W),W.defaultPrevented||(W.preventDefault(),o(f,t)))}),B=i.hrefs(f[0]==="~"?f.slice(1):i.base+f,i);return x&&K.isValidElement(S)?K.cloneElement(S,{onClick:V,href:B}):K.createElement("a",{...D,onClick:V,href:B,className:C!=null&&C.call?C(n===f):C,children:S,ref:e})}),AQ=t=>Array.isArray(t)?t.flatMap(e=>AQ(e&&e.type===K.Fragment?e.props.children:e)):[t],a_e=({children:t,location:e})=>{const i=Wb(),[n]=HN(i);for(const o of AQ(t)){let c=0;if(K.isValidElement(o)&&(c=L3(i.parser,o.props.path,e||n,o.props.nest))[0])return K.cloneElement(o,{match:c})}return null};var Kb=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(){}},O_=typeof window>"u"||"Deno"in globalThis;function Eu(){}function l_e(t,e){return typeof t=="function"?t(e):t}function FL(t){return typeof t=="number"&&t>=0&&t!==1/0}function IQ(t,e){return Math.max(t+(e||0)-Date.now(),0)}function T0(t,e){return typeof t=="function"?t(e):t}function Td(t,e){return typeof t=="function"?t(e):t}function f8(t,e){const{type:i="all",exact:n,fetchStatus:o,predicate:c,queryKey:f,stale:r}=t;if(f){if(n){if(e.queryHash!==O3(f,e.options))return!1}else if(!YT(e.queryKey,f))return!1}if(i!=="all"){const x=e.isActive();if(i==="active"&&!x||i==="inactive"&&x)return!1}return!(typeof r=="boolean"&&e.isStale()!==r||o&&o!==e.state.fetchStatus||c&&!c(e))}function m8(t,e){const{exact:i,status:n,predicate:o,mutationKey:c}=t;if(c){if(!e.options.mutationKey)return!1;if(i){if(F_(e.options.mutationKey)!==F_(c))return!1}else if(!YT(e.options.mutationKey,c))return!1}return!(n&&e.state.status!==n||o&&!o(e))}function O3(t,e){return((e==null?void 0:e.queryKeyHashFn)||F_)(t)}function F_(t){return JSON.stringify(t,(e,i)=>BL(i)?Object.keys(i).sort().reduce((n,o)=>(n[o]=i[o],n),{}):i)}function YT(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(i=>!YT(t[i],e[i])):!1}function kQ(t,e){if(t===e)return t;const i=g8(t)&&g8(e);
vendor: 34,688 bytes, line 48
48if(i||BL(t)&&BL(e)){const n=i?t:Object.keys(t),o=n.length,c=i?e:Object.keys(e),f=c.length,r=i?[]:{};let x=0;for(let S=0;S<f;S++){const C=i?S:c[S];(!i&&n.includes(C)||i)&&t[C]===void 0&&e[C]===void 0?(r[C]=void 0,x++):(r[C]=kQ(t[C],e[C]),r[C]===t[C]&&t[C]!==void 0&&x++)}return o===f&&x===o?t:r}return e}function zk(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(t[i]!==e[i])return!1;return!0}function g8(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function BL(t){if(!y8(t))return!1;const e=t.constructor;if(e===void 0)return!0;const i=e.prototype;return!(!y8(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function y8(t){return Object.prototype.toString.call(t)==="[object Object]"}function c_e(t){return new Promise(e=>{setTimeout(e,t)})}function UL(t,e,i){return typeof i.structuralSharing=="function"?i.structuralSharing(t,e):i.structuralSharing!==!1?kQ(t,e):e}function u_e(t,e,i=0){const n=[...t,e];return i&&n.length>i?n.slice(1):n}function d_e(t,e,i=0){const n=[e,...t];return i&&n.length>i?n.slice(0,-1):n}var F3=Symbol();function PQ(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===F3?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var a_,km,L0,sW,h_e=(sW=class extends Kb{constructor(){super();Wt(this,a_);Wt(this,km);Wt(this,L0);Jt(this,L0,e=>{if(!O_&&window.addEventListener){const i=()=>e();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){he(this,km)||this.setEventListener(he(this,L0))}onUnsubscribe(){var e;this.hasListeners()||((e=he(this,km))==null||e.call(this),Jt(this,km,void 0))}setEventListener(e){var i;Jt(this,L0,e),(i=he(this,km))==null||i.call(this),Jt(this,km,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){he(this,a_)!==e&&(Jt(this,a_,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(i=>{i(e)})}isFocused(){var e;return typeof he(this,a_)=="boolean"?he(this,a_):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},a_=new WeakMap,km=new WeakMap,L0=new WeakMap,sW),B3=new h_e,O0,Pm,F0,oW,p_e=(oW=class extends Kb{constructor(){super();Wt(this,O0,!0);Wt(this,Pm);Wt(this,F0);Jt(this,F0,e=>{if(!O_&&window.addEventListener){const i=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n)}}})}onSubscribe(){he(this,Pm)||this.setEventListener(he(this,F0))}onUnsubscribe(){var e;this.hasListeners()||((e=he(this,Pm))==null||e.call(this),Jt(this,Pm,void 0))}setEventListener(e){var i;Jt(this,F0,e),(i=he(this,Pm))==null||i.call(this),Jt(this,Pm,e(this.setOnline.bind(this)))}setOnline(e){he(this,O0)!==e&&(Jt(this,O0,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return he(this,O0)}},O0=new WeakMap,Pm=new WeakMap,F0=new WeakMap,oW),Lk=new p_e;function VL(){let t,e;const i=new Promise((o,c)=>{t=o,e=c});i.status="pending",i.catch(()=>{});function n(o){Object.assign(i,o),delete i.resolve,delete i.reject}return i.resolve=o=>{n({status:"fulfilled",value:o}),t(o)},i.reject=o=>{n({status:"rejected",reason:o}),e(o)},i}function f_e(t){return Math.min(1e3*2**t,3e4)}function NQ(t){return(t??"online")==="online"?Lk.isOnline():!0}var MQ=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Sj(t){return t instanceof MQ}function DQ(t){let e=!1,i=0,n=!1,o;const c=VL(),f=B=>{var W;n||(N(new MQ(B)),(W=t.abort)==null||W.call(t))},r=()=>{e=!0},x=()=>{e=!1},S=()=>B3.isFocused()&&(t.networkMode==="always"||Lk.isOnline())&&t.canRun(),C=()=>NQ(t.networkMode)&&t.canRun(),I=B=>{var W;n||(n=!0,(W=t.onSuccess)==null||W.call(t,B),o==null||o(),c.resolve(B))},N=B=>{var W;n||(n=!0,(W=t.onError)==null||W.call(t,B),o==null||o(),c.reject(B))},D=()=>new Promise(B=>{var W;o=$=>{(n||S())&&B($)},(W=t.onPause)==null||W.call(t)}).then(()=>{var B;o=void 0,n||(B=t.onContinue)==null||B.call(t)}),V=()=>{if(n)return;let B;const W=i===0?t.initialPromise:void 0;try{B=W??t.fn()}catch($){B=Promise.reject($)}Promise.resolve(B).then(I).catch($=>{var Te;if(n)return;const G=t.retry??(O_?0:3),te=t.retryDelay??f_e,ce=typeof te=="function"?te(i,$):te,_e=G===!0||typeof G=="number"&&i<G||typeof G=="function"&&G(i,$);if(e||!_e){N($);return}i++,(Te=t.onFail)==null||Te.call(t,i,$),c_e(ce).then(()=>S()?void 0:D()).then(()=>{e?N($):V()})})};return{promise:c,cancel:f,continue:()=>(o==null||o(),c),cancelRetry:r,continueRetry:x,canStart:C,start:()=>(C()?V():D().then(V),c)}}function m_e(){let t=[],e=0,i=r=>{r()},n=r=>{r()},o=r=>setTimeout(r,0);const c=r=>{e?t.push(r):o(()=>{i(r)})},f=()=>{const r=t;t=[],r.length&&o(()=>{n(()=>{r.forEach(x=>{i(x)})})})};return{batch:r=>{let x;e++;try{x=r()}finally{e--,e||f()}return x},batchCalls:r=>(...x)=>{c(()=>{r(...x)})},schedule:c,setNotifyFunction:r=>{i=r},setBatchNotifyFunction:r=>{n=r},setScheduler:r=>{o=r}}}var wa=m_e(),l_,aW,RQ=(aW=class{constructor(){Wt(this,l_)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),FL(this.gcTime)&&Jt(this,l_,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(O_?1/0:5*60*1e3))}clearGcTimeout(){he(this,l_)&&(clearTimeout(he(this,l_)),Jt(this,l_,void 0))}},l_=new WeakMap,aW),B0,U0,Tu,bl,DC,c_,pd,Np,lW,g_e=(lW=class extends RQ{constructor(e){super();Wt(this,pd);Wt(this,B0);Wt(this,U0);Wt(this,Tu);Wt(this,bl);Wt(this,DC);Wt(this,c_);Jt(this,c_,!1),Jt(this,DC,e.defaultOptions),this.setOptions(e.options),this.observers=[],Jt(this,Tu,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Jt(this,B0,y_e(this.options)),this.state=e.state??he(this,B0),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=he(this,bl))==null?void 0:e.promise}setOptions(e){this.options={...he(this,DC),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&he(this,Tu).remove(this)}setData(e,i){const n=UL(this.state.data,e,this.options);return ci(this,pd,Np).call(this,{data:n,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),n}setState(e,i){ci(this,pd,Np).call(this,{type:"setState",state:e,setStateOptions:i})}cancel(e){var n,o;const i=(n=he(this,bl))==null?void 0:n.promise;return(o=he(this,bl))==null||o.cancel(e),i?i.then(Eu).catch(Eu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(he(this,B0))}isActive(){return this.observers.some(e=>Td(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===F3||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!IQ(this.state.dataUpdatedAt,e)}onFocus(){var i;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(i=he(this,bl))==null||i.continue()}onOnline(){var i;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(i=he(this,bl))==null||i.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),he(this,Tu).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(i=>i!==e),this.observers.length||(he(this,bl)&&(he(this,c_)?he(this,bl).cancel({revert:!0}):he(this,bl).cancelRetry()),this.scheduleGc()),he(this,Tu).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ci(this,pd,Np).call(this,{type:"invalidate"})}fetch(e,i){var x,S,C;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(he(this,bl))return he(this,bl).continueRetry(),he(this,bl).promise}if(e&&this.setOptions(e),!this.options.queryFn){const I=this.observers.find(N=>N.options.queryFn);I&&this.setOptions(I.options)}const n=new AbortController,o=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(Jt(this,c_,!0),n.signal)})},c=()=>{const I=PQ(this.options,i),N={queryKey:this.queryKey,meta:this.meta};return o(N),Jt(this,c_,!1),this.options.persister?this.options.persister(I,N,this):I(N)},f={fetchOptions:i,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:c};o(f),(x=this.options.behavior)==null||x.onFetch(f,this),Jt(this,U0,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((S=f.fetchOptions)==null?void 0:S.meta))&&ci(this,pd,Np).call(this,{type:"fetch",meta:(C=f.fetchOptions)==null?void 0:C.meta});const r=I=>{var N,D,V,B;Sj(I)&&I.silent||ci(this,pd,Np).call(this,{type:"error",error:I}),Sj(I)||((D=(N=he(this,Tu).config).onError)==null||D.call(N,I,this),(B=(V=he(this,Tu).config).onSettled)==null||B.call(V,this.state.data,I,this)),this.scheduleGc()};return Jt(this,bl,DQ({initialPromise:i==null?void 0:i.initialPromise,fn:f.fetchFn,abort:n.abort.bind(n),onSuccess:I=>{var N,D,V,B;if(I===void 0){r(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(I)}catch(W){r(W);return}(D=(N=he(this,Tu).config).onSuccess)==null||D.call(N,I,this),(B=(V=he(this,Tu).config).onSettled)==null||B.call(V,I,this.state.error,this),this.scheduleGc()},onError:r,onFail:(I,N)=>{ci(this,pd,Np).call(this,{type:"failed",failureCount:I,error:N})},onPause:()=>{ci(this,pd,Np).call(this,{type:"pause"})},onContinue:()=>{ci(this,pd,Np).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0})),he(this,bl).start()}},B0=new WeakMap,U0=new WeakMap,Tu=new WeakMap,bl=new WeakMap,DC=new WeakMap,c_=new WeakMap,pd=new WeakSet,Np=function(e){const i=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...jQ(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=e.error;return Sj(o)&&o.revert&&he(this,U0)?{...he(this,U0),fetchStatus:"idle"}:{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=i(this.state),wa.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),he(this,Tu).notify({query:this,type:"updated",action:e})})},lW);function jQ(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:NQ(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function y_e(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,i=e!==void 0,n=i?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var wh,cW,__e=(cW=class extends Kb{constructor(e={}){super();Wt(this,wh);this.config=e,Jt(this,wh,new Map)}build(e,i,n){const o=i.queryKey,c=i.queryHash??O3(o,i);let f=this.get(c);return f||(f=new g_e({cache:this,queryKey:o,queryHash:c,options:e.defaultQueryOptions(i),state:n,defaultOptions:e.getQueryDefaults(o)}),this.add(f)),f}add(e){he(this,wh).has(e.queryHash)||(he(this,wh).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const i=he(this,wh).get(e.queryHash);i&&(e.destroy(),i===e&&he(this,wh).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){wa.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return he(this,wh).get(e)}getAll(){return[...he(this,wh).values()]}find(e){const i={exact:!0,...e};return this.getAll().find(n=>f8(i,n))}findAll(e={}){const i=this.getAll();return Object.keys(e).length>0?i.filter(n=>f8(e,n)):i}notify(e){wa.batch(()=>{this.listeners.forEach(i=>{i(e)})})}onFocus(){wa.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){wa.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wh=new WeakMap,cW),Sh,Xl,u_,Th,pm,uW,v_e=(uW=class extends RQ{constructor(e){super();Wt(this,Th);Wt(this,Sh);Wt(this,Xl);Wt(this,u_);this.mutationId=e.mutationId,Jt(this,Xl,e.mutationCache),Jt(this,Sh,[]),this.state=e.state||zQ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){he(this,Sh).includes(e)||(he(this,Sh).push(e),this.clearGcTimeout(),he(this,Xl).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Jt(this,Sh,he(this,Sh).filter(i=>i!==e)),this.scheduleGc(),he(this,Xl).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){he(this,Sh).length||(this.state.status==="pending"?this.scheduleGc():he(this,Xl).remove(this))}continue(){var e;return((e=he(this,u_))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,c,f,r,x,S,C,I,N,D,V,B,W,$,G,te,ce,_e,Te,we;Jt(this,u_,DQ({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Ne,pe)=>{ci(this,Th,pm).call(this,{type:"failed",failureCount:Ne,error:pe})},onPause:()=>{ci(this,Th,pm).call(this,{type:"pause"})},onContinue:()=>{ci(this,Th,pm).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>he(this,Xl).canRun(this)}));const i=this.state.status==="pending",n=!he(this,u_).canStart();try{if(!i){ci(this,Th,pm).call(this,{type:"pending",variables:e,isPaused:n}),await((c=(o=he(this,Xl).config).onMutate)==null?void 0:c.call(o,e,this));const pe=await((r=(f=this.options).onMutate)==null?void 0:r.call(f,e));pe!==this.state.context&&ci(this,Th,pm).call(this,{type:"pending",context:pe,variables:e,isPaused:n})}const Ne=await he(this,u_).start();return await((S=(x=he(this,Xl).config).onSuccess)==null?void 0:S.call(x,Ne,e,this.state.context,this)),await((I=(C=this.options).onSuccess)==null?void 0:I.call(C,Ne,e,this.state.context)),await((D=(N=he(this,Xl).config).onSettled)==null?void 0:D.call(N,Ne,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,Ne,null,e,this.state.context)),ci(this,Th,pm).call(this,{type:"success",data:Ne}),Ne}catch(Ne){try{throw await(($=(W=he(this,Xl).config).onError)==null?void 0:$.call(W,Ne,e,this.state.context,this)),await((te=(G=this.options).onError)==null?void 0:te.call(G,Ne,e,this.state.context)),await((_e=(ce=he(this,Xl).config).onSettled)==null?void 0:_e.call(ce,void 0,Ne,this.state.variables,this.state.context,this)),await((we=(Te=this.options).onSettled)==null?void 0:we.call(Te,void 0,Ne,e,this.state.context)),Ne}finally{ci(this,Th,pm).call(this,{type:"error",error:Ne})}}finally{he(this,Xl).runNext(this)}}},Sh=new WeakMap,Xl=new WeakMap,u_=new WeakMap,Th=new WeakSet,pm=function(e){const i=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=i(this.state),wa.batch(()=>{he(this,Sh).forEach(n=>{n.onMutationUpdate(e)}),he(this,Xl).notify({mutation:this,type:"updated",action:e})})},uW);function zQ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xc,RC,dW,x_e=(dW=class extends Kb{constructor(e={}){super();Wt(this,Xc);Wt(this,RC);this.config=e,Jt(this,Xc,new Map),Jt(this,RC,Date.now())}build(e,i,n){const o=new v_e({mutationCache:this,mutationId:++PA(this,RC)._,options:e.defaultMutationOptions(i),state:n});return this.add(o),o}add(e){const i=KA(e),n=he(this,Xc).get(i)??[];n.push(e),he(this,Xc).set(i,n),this.notify({type:"added",mutation:e})}remove(e){var n;const i=KA(e);if(he(this,Xc).has(i)){const o=(n=he(this,Xc).get(i))==null?void 0:n.filter(c=>c!==e);o&&(o.length===0?he(this,Xc).delete(i):he(this,Xc).set(i,o))}this.notify({type:"removed",mutation:e})}canRun(e){var n;const i=(n=he(this,Xc).get(KA(e)))==null?void 0:n.find(o=>o.state.status==="pending");return!i||i===e}runNext(e){var n;const i=(n=he(this,Xc).get(KA(e)))==null?void 0:n.find(o=>o!==e&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}clear(){wa.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...he(this,Xc).values()].flat()}find(e){const i={exact:!0,...e};return this.getAll().find(n=>m8(i,n))}findAll(e={}){return this.getAll().filter(i=>m8(e,i))}notify(e){wa.batch(()=>{this.listeners.forEach(i=>{i(e)})})}resumePausedMutations(){const e=this.getAll().filter(i=>i.state.isPaused);return wa.batch(()=>Promise.all(e.map(i=>i.continue().catch(Eu))))}},Xc=new WeakMap,RC=new WeakMap,dW);function KA(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function _8(t){return{onFetch:(e,i)=>{var C,I,N,D,V;const n=e.options,o=(N=(I=(C=e.fetchOptions)==null?void 0:C.meta)==null?void 0:I.fetchMore)==null?void 0:N.direction,c=((D=e.state.data)==null?void 0:D.pages)||[],f=((V=e.state.data)==null?void 0:V.pageParams)||[];let r={pages:[],pageParams:[]},x=0;const S=async()=>{let B=!1;const W=te=>{Object.defineProperty(te,"signal",{enumerable:!0,get:()=>(e.signal.aborted?B=!0:e.signal.addEventListener("abort",()=>{B=!0}),e.signal)})},$=PQ(e.options,e.fetchOptions),G=async(te,ce,_e)=>{if(B)return Promise.reject();if(ce==null&&te.pages.length)return Promise.resolve(te);const Te={queryKey:e.queryKey,pageParam:ce,direction:_e?"backward":"forward",meta:e.options.meta};W(Te);const we=await $(Te),{maxPages:Ne}=e.options,pe=_e?d_e:u_e;return{pages:pe(te.pages,we,Ne),pageParams:pe(te.pageParams,ce,Ne)}};if(o&&c.length){const te=o==="backward",ce=te?b_e:v8,_e={pages:c,pageParams:f},Te=ce(n,_e);r=await G(_e,Te,te)}else{const te=t??c.length;do{const ce=x===0?f[0]??n.initialPageParam:v8(n,r);if(x>0&&ce==null)break;r=await G(r,ce),x++}while(x<te)}return r};e.options.persister?e.fetchFn=()=>{var B,W;return(W=(B=e.options).persister)==null?void 0:W.call(B,S,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},i)}:e.fetchFn=S}}}function v8(t,{pages:e,pageParams:i}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,i[n],i):void 0}function b_e(t,{pages:e,pageParams:i}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,i[0],i):void 0}var Fo,Nm,Mm,V0,$0,Dm,q0,H0,hW,w_e=(hW=class{constructor(t={}){Wt(this,Fo);Wt(this,Nm);Wt(this,Mm);Wt(this,V0);Wt(this,$0);Wt(this,Dm);Wt(this,q0);Wt(this,H0);Jt(this,Fo,t.queryCache||new __e),Jt(this,Nm,t.mutationCache||new x_e),Jt(this,Mm,t.defaultOptions||{}),Jt(this,V0,new Map),Jt(this,$0,new Map),Jt(this,Dm,0)}mount(){PA(this,Dm)._++,he(this,Dm)===1&&(Jt(this,q0,B3.subscribe(async t=>{t&&(await this.resumePausedMutations(),he(this,Fo).onFocus())})),Jt(this,H0,Lk.subscribe(async t=>{t&&(await this.resumePausedMutations(),he(this,Fo).onOnline())})))}unmount(){var t,e;PA(this,Dm)._--,he(this,Dm)===0&&((t=he(this,q0))==null||t.call(this),Jt(this,q0,void 0),(e=he(this,H0))==null||e.call(this),Jt(this,H0,void 0))}isFetching(t){return he(this,Fo).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return he(this,Nm).findAll({...t,status:"pending"}).length}getQueryData(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=he(this,Fo).get(e.queryHash))==null?void 0:i.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const i=this.defaultQueryOptions(t),n=he(this,Fo).build(this,i);return t.revalidateIfStale&&n.isStaleByTime(T0(i.staleTime,n))&&this.prefetchQuery(i),Promise.resolve(e)}}getQueriesData(t){return he(this,Fo).findAll(t).map(({queryKey:e,state:i})=>{const n=i.data;return[e,n]})}setQueryData(t,e,i){const n=this.defaultQueryOptions({queryKey:t}),o=he(this,Fo).get(n.queryHash),c=o==null?void 0:o.state.data,f=l_e(e,c);if(f!==void 0)return he(this,Fo).build(this,n).setData(f,{...i,manual:!0})}setQueriesData(t,e,i){return wa.batch(()=>he(this,Fo).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,i)]))}getQueryState(t){var i;const e=this.defaultQueryOptions({queryKey:t});return(i=he(this,Fo).get(e.queryHash))==null?void 0:i.state}removeQueries(t){const e=he(this,Fo);wa.batch(()=>{e.findAll(t).forEach(i=>{e.remove(i)})})}resetQueries(t,e){const i=he(this,Fo),n={type:"active",...t};return wa.batch(()=>(i.findAll(t).forEach(o=>{o.reset()}),this.refetchQueries(n,e)))}cancelQueries(t={},e={}){const i={revert:!0,...e},n=wa.batch(()=>he(this,Fo).findAll(t).map(o=>o.cancel(i)));return Promise.all(n).then(Eu).catch(Eu)}invalidateQueries(t={},e={}){return wa.batch(()=>{if(he(this,Fo).findAll(t).forEach(n=>{n.invalidate()}),t.refetchType==="none")return Promise.resolve();const i={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(i,e)})}refetchQueries(t={},e){const i={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},n=wa.batch(()=>he(this,Fo).findAll(t).filter(o=>!o.isDisabled()).map(o=>{let c=o.fetch(void 0,i);return i.throwOnError||(c=c.catch(Eu)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(n).then(Eu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const i=he(this,Fo).build(this,e);return i.isStaleByTime(T0(e.staleTime,i))?i.fetch(e):Promise.resolve(i.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Eu).catch(Eu)}fetchInfiniteQuery(t){return t.behavior=_8(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Eu).catch(Eu)}ensureInfiniteQueryData(t){return t.behavior=_8(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Lk.isOnline()?he(this,Nm).resumePausedMutations():Promise.resolve()}getQueryCache(){return he(this,Fo)}getMutationCache(){return he(this,Nm)}getDefaultOptions(){return he(this,Mm)}setDefaultOptions(t){Jt(this,Mm,t)}setQueryDefaults(t,e){he(this,V0).set(F_(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...he(this,V0).values()];let i={};return e.forEach(n=>{YT(t,n.queryKey)&&(i={...i,...n.defaultOptions})}),i}setMutationDefaults(t,e){he(this,$0).set(F_(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...he(this,$0).values()];let i={};return e.forEach(n=>{YT(t,n.mutationKey)&&(i={...i,...n.defaultOptions})}),i}defaultQueryOptions(t){if(t._defaulted)return t;const e={...he(this,Mm).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=O3(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.enabled!==!0&&e.queryFn===F3&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...he(this,Mm).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){he(this,Fo).clear(),he(this,Nm).clear()}},Fo=new WeakMap,Nm=new WeakMap,Mm=new WeakMap,V0=new WeakMap,$0=new WeakMap,Dm=new WeakMap,q0=new WeakMap,H0=new WeakMap,hW),Ac,us,jC,Yl,d_,G0,Rm,Ch,zC,W0,K0,h_,p_,jm,Z0,Os,VS,$L,qL,HL,GL,WL,KL,ZL,LQ,pW,S_e=(pW=class extends Kb{constructor(e,i){super();Wt(this,Os);Wt(this,Ac);Wt(this,us);Wt(this,jC);Wt(this,Yl);Wt(this,d_);Wt(this,G0);Wt(this,Rm);Wt(this,Ch);Wt(this,zC);Wt(this,W0);Wt(this,K0);Wt(this,h_);Wt(this,p_);Wt(this,jm);Wt(this,Z0,new Set);this.options=i,Jt(this,Ac,e),Jt(this,Ch,null),Jt(this,Rm,VL()),this.options.experimental_prefetchInRender||he(this,Rm).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(he(this,us).addObserver(this),x8(he(this,us),this.options)?ci(this,Os,VS).call(this):this.updateResult(),ci(this,Os,GL).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return XL(he(this,us),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return XL(he(this,us),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ci(this,Os,WL).call(this),ci(this,Os,KL).call(this),he(this,us).removeObserver(this)}setOptions(e,i){const n=this.options,o=he(this,us);if(this.options=he(this,Ac).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Td(this.options.enabled,he(this,us))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ci(this,Os,ZL).call(this),he(this,us).setOptions(this.options),n._defaulted&&!zk(this.options,n)&&he(this,Ac).getQueryCache().notify({type:"observerOptionsUpdated",query:he(this,us),observer:this});const c=this.hasListeners();c&&b8(he(this,us),o,this.options,n)&&ci(this,Os,VS).call(this),this.updateResult(i),c&&(he(this,us)!==o||Td(this.options.enabled,he(this,us))!==Td(n.enabled,he(this,us))||T0(this.options.staleTime,he(this,us))!==T0(n.staleTime,he(this,us)))&&ci(this,Os,$L).call(this);const f=ci(this,Os,qL).call(this);c&&(he(this,us)!==o||Td(this.options.enabled,he(this,us))!==Td(n.enabled,he(this,us))||f!==he(this,jm))&&ci(this,Os,HL).call(this,f)}getOptimisticResult(e){const i=he(this,Ac).getQueryCache().build(he(this,Ac),e),n=this.createResult(i,e);return C_e(this,n)&&(Jt(this,Yl,n),Jt(this,G0,this.options),Jt(this,d_,he(this,us).state)),n}getCurrentResult(){return he(this,Yl)}trackResult(e,i){const n={};return Object.keys(e).forEach(o=>{Object.defineProperty(n,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),i==null||i(o),e[o])})}),n}trackProp(e){he(this,Z0).add(e)}getCurrentQuery(){return he(this,us)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const i=he(this,Ac).defaultQueryOptions(e),n=he(this,Ac).getQueryCache().build(he(this,Ac),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(e){return ci(this,Os,VS).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),he(this,Yl)))}createResult(e,i){var Ne;const n=he(this,us),o=this.options,c=he(this,Yl),f=he(this,d_),r=he(this,G0),S=e!==n?e.state:he(this,jC),{state:C}=e;let I={...C},N=!1,D;if(i._optimisticResults){const pe=this.hasListeners(),Pe=!pe&&x8(e,i),De=pe&&b8(e,n,i,o);(Pe||De)&&(I={...I,...jQ(C.data,e.options)}),i._optimisticResults==="isRestoring"&&(I.fetchStatus="idle")}let{error:V,errorUpdatedAt:B,status:W}=I;if(i.select&&I.data!==void 0)if(c&&I.data===(f==null?void 0:f.data)&&i.select===he(this,zC))D=he(this,W0);else try{Jt(this,zC,i.select),D=i.select(I.data),D=UL(c==null?void 0:c.data,D,i),Jt(this,W0,D),Jt(this,Ch,null)}catch(pe){Jt(this,Ch,pe)}else D=I.data;if(i.placeholderData!==void 0&&D===void 0&&W==="pending"){let pe;if(c!=null&&c.isPlaceholderData&&i.placeholderData===(r==null?void 0:r.placeholderData))pe=c.data;else if(pe=typeof i.placeholderData=="function"?i.placeholderData((Ne=he(this,K0))==null?void 0:Ne.state.data,he(this,K0)):i.placeholderData,i.select&&pe!==void 0)try{pe=i.select(pe),Jt(this,Ch,null)}catch(Pe){Jt(this,Ch,Pe)}pe!==void 0&&(W="success",D=UL(c==null?void 0:c.data,pe,i),N=!0)}he(this,Ch)&&(V=he(this,Ch),D=he(this,W0),B=Date.now(),W="error");const $=I.fetchStatus==="fetching",G=W==="pending",te=W==="error",ce=G&&$,_e=D!==void 0,we={status:W,fetchStatus:I.fetchStatus,isPending:G,isSuccess:W==="success",isError:te,isInitialLoading:ce,isLoading:ce,data:D,dataUpdatedAt:I.dataUpdatedAt,error:V,errorUpdatedAt:B,failureCount:I.fetchFailureCount,failureReason:I.fetchFailureReason,errorUpdateCount:I.errorUpdateCount,isFetched:I.dataUpdateCount>0||I.errorUpdateCount>0,isFetchedAfterMount:I.dataUpdateCount>S.dataUpdateCount||I.errorUpdateCount>S.errorUpdateCount,isFetching:$,isRefetching:$&&!G,isLoadingError:te&&!_e,isPaused:I.fetchStatus==="paused",isPlaceholderData:N,isRefetchError:te&&_e,isStale:U3(e,i),refetch:this.refetch,promise:he(this,Rm)};if(this.options.experimental_prefetchInRender){const pe=Je=>{we.status==="error"?Je.reject(we.error):we.data!==void 0&&Je.resolve(we.data)},Pe=()=>{const Je=Jt(this,Rm,we.promise=VL());pe(Je)},De=he(this,Rm);switch(De.status){case"pending":e.queryHash===n.queryHash&&pe(De);break;case"fulfilled":(we.status==="error"||we.data!==De.value)&&Pe();break;case"rejected":(we.status!=="error"||we.error!==De.reason)&&Pe();break}}return we}updateResult(e){const i=he(this,Yl),n=this.createResult(he(this,us),this.options);if(Jt(this,d_,he(this,us).state),Jt(this,G0,this.options),he(this,d_).data!==void 0&&Jt(this,K0,he(this,us)),zk(n,i))return;Jt(this,Yl,n);const o={},c=()=>{if(!i)return!0;const{notifyOnChangeProps:f}=this.options,r=typeof f=="function"?f():f;if(r==="all"||!r&&!he(this,Z0).size)return!0;const x=new Set(r??he(this,Z0));return this.options.throwOnError&&x.add("error"),Object.keys(he(this,Yl)).some(S=>{const C=S;return he(this,Yl)[C]!==i[C]&&x.has(C)})};(e==null?void 0:e.listeners)!==!1&&c()&&(o.listeners=!0),ci(this,Os,LQ).call(this,{...o,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ci(this,Os,GL).call(this)}},Ac=new WeakMap,us=new WeakMap,jC=new WeakMap,Yl=new WeakMap,d_=new WeakMap,G0=new WeakMap,Rm=new WeakMap,Ch=new WeakMap,zC=new WeakMap,W0=new WeakMap,K0=new WeakMap,h_=new WeakMap,p_=new WeakMap,jm=new WeakMap,Z0=new WeakMap,Os=new WeakSet,VS=function(e){ci(this,Os,ZL).call(this);let i=he(this,us).fetch(this.options,e);return e!=null&&e.throwOnError||(i=i.catch(Eu)),i},$L=function(){ci(this,Os,WL).call(this);const e=T0(this.options.staleTime,he(this,us));if(O_||he(this,Yl).isStale||!FL(e))return;const n=IQ(he(this,Yl).dataUpdatedAt,e)+1;Jt(this,h_,setTimeout(()=>{he(this,Yl).isStale||this.updateResult()},n))},qL=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(he(this,us)):this.options.refetchInterval)??!1},HL=function(e){ci(this,Os,KL).call(this),Jt(this,jm,e),!(O_||Td(this.options.enabled,he(this,us))===!1||!FL(he(this,jm))||he(this,jm)===0)&&Jt(this,p_,setInterval(()=>{(this.options.refetchIntervalInBackground||B3.isFocused())&&ci(this,Os,VS).call(this)},he(this,jm)))},GL=function(){ci(this,Os,$L).call(this),ci(this,Os,HL).call(this,ci(this,Os,qL).call(this))},WL=function(){he(this,h_)&&(clearTimeout(he(this,h_)),Jt(this,h_,void 0))},KL=function(){he(this,p_)&&(clearInterval(he(this,p_)),Jt(this,p_,void 0))},ZL=function(){const e=he(this,Ac).getQueryCache().build(he(this,Ac),this.options);if(e===he(this,us))return;const i=he(this,us);Jt(this,us,e),Jt(this,jC,e.state),this.hasListeners()&&(i==null||i.removeObserver(this),e.addObserver(this))},LQ=function(e){wa.batch(()=>{e.listeners&&this.listeners.forEach(i=>{i(he(this,Yl))}),he(this,Ac).getQueryCache().notify({query:he(this,us),type:"observerResultsUpdated"})})},pW);function T_e(t,e){return Td(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function x8(t,e){return T_e(t,e)||t.state.data!==void 0&&XL(t,e,e.refetchOnMount)}function XL(t,e,i){if(Td(e.enabled,t)!==!1){const n=typeof i=="function"?i(t):i;return n==="always"||n!==!1&&U3(t,e)}return!1}function b8(t,e,i,n){return(t!==e||Td(n.enabled,t)===!1)&&(!i.suspense||t.state.status!=="error")&&U3(t,i)}function U3(t,e){return Td(e.enabled,t)!==!1&&t.isStaleByTime(T0(e.staleTime,t))}function C_e(t,e){return!zk(t.getCurrentResult(),e)}var zm,Lm,Ic,Fp,Jp,$I,YL,fW,E_e=(fW=class extends Kb{constructor(i,n){super();Wt(this,Jp);Wt(this,zm);Wt(this,Lm);Wt(this,Ic);Wt(this,Fp);Jt(this,zm,i),this.setOptions(n),this.bindMethods(),ci(this,Jp,$I).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var o;const n=this.options;this.options=he(this,zm).defaultMutationOptions(i),zk(this.options,n)||he(this,zm).getMutationCache().notify({type:"observerOptionsUpdated",mutation:he(this,Ic),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&F_(n.mutationKey)!==F_(this.options.mutationKey)?this.reset():((o=he(this,Ic))==null?void 0:o.state.status)==="pending"&&he(this,Ic).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=he(this,Ic))==null||i.removeObserver(this)}onMutationUpdate(i){ci(this,Jp,$I).call(this),ci(this,Jp,YL).call(this,i)}getCurrentResult(){return he(this,Lm)}reset(){var i;(i=he(this,Ic))==null||i.removeObserver(this),Jt(this,Ic,void 0),ci(this,Jp,$I).call(this),ci(this,Jp,YL).call(this)}mutate(i,n){var o;return Jt(this,Fp,n),(o=he(this,Ic))==null||o.removeObserver(this),Jt(this,Ic,he(this,zm).getMutationCache().build(he(this,zm),this.options)),he(this,Ic).addObserver(this),he(this,Ic).execute(i)}},zm=new WeakMap,Lm=new WeakMap,Ic=new WeakMap,Fp=new WeakMap,Jp=new WeakSet,$I=function(){var n;const i=((n=he(this,Ic))==null?void 0:n.state)??zQ();Jt(this,Lm,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},YL=function(i){wa.batch(()=>{var n,o,c,f,r,x,S,C;if(he(this,Fp)&&this.hasListeners()){const I=he(this,Lm).variables,N=he(this,Lm).context;(i==null?void 0:i.type)==="success"?((o=(n=he(this,Fp)).onSuccess)==null||o.call(n,i.data,I,N),(f=(c=he(this,Fp)).onSettled)==null||f.call(c,i.data,null,I,N)):(i==null?void 0:i.type)==="error"&&((x=(r=he(this,Fp)).onError)==null||x.call(r,i.error,I,N),(C=(S=he(this,Fp)).onSettled)==null||C.call(S,void 0,i.error,I,N))}
48this.listeners.forEach(I=>{I(he(this,Lm))})})},fW),OQ=K.createContext(void 0),V3=t=>{const e=K.useContext(OQ);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},A_e=({client:t,children:e})=>(K.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),d.jsx(OQ.Provider,{value:t,children:e})),FQ=K.createContext(!1),I_e=()=>K.useContext(FQ);FQ.Provider;function k_e(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var P_e=K.createContext(k_e()),N_e=()=>K.useContext(P_e);function BQ(t,e){return typeof t=="function"?t(...e):!!t}function QL(){}var M_e=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},D_e=t=>{K.useEffect(()=>{t.clearReset()},[t])},R_e=({result:t,errorResetBoundary:e,throwOnError:i,query:n})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&BQ(i,[t.error,n]),j_e=t=>{t.suspense&&(t.staleTime===void 0&&(t.staleTime=1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},z_e=(t,e)=>t.isLoading&&t.isFetching&&!e,L_e=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,w8=(t,e,i)=>e.fetchOptimistic(t).catch(()=>{i.clearReset()});function O_e(t,e,i){var C,I,N,D,V;const n=V3(),o=I_e(),c=N_e(),f=n.defaultQueryOptions(t);(I=(C=n.getDefaultOptions().queries)==null?void 0:C._experimental_beforeQuery)==null||I.call(C,f),f._optimisticResults=o?"isRestoring":"optimistic",j_e(f),M_e(f,c),D_e(c);const r=!n.getQueryCache().get(f.queryHash),[x]=K.useState(()=>new e(n,f)),S=x.getOptimisticResult(f);if(K.useSyncExternalStore(K.useCallback(B=>{const W=o?QL:x.subscribe(wa.batchCalls(B));return x.updateResult(),W},[x,o]),()=>x.getCurrentResult(),()=>x.getCurrentResult()),K.useEffect(()=>{x.setOptions(f,{listeners:!1})},[f,x]),L_e(f,S))throw w8(f,x,c);if(R_e({result:S,errorResetBoundary:c,throwOnError:f.throwOnError,query:n.getQueryCache().get(f.queryHash)}))throw S.error;if((D=(N=n.getDefaultOptions().queries)==null?void 0:N._experimental_afterQuery)==null||D.call(N,f,S),f.experimental_prefetchInRender&&!O_&&z_e(S,o)){const B=r?w8(f,x,c):(V=n.getQueryCache().get(f.queryHash))==null?void 0:V.promise;B==null||B.catch(QL).finally(()=>{x.updateResult()})}return f.notifyOnChangeProps?S:x.trackResult(S)}function Xn(t,e){return O_e(t,S_e)}function $n(t,e){const i=V3(),[n]=K.useState(()=>new E_e(i,t));K.useEffect(()=>{n.setOptions(t)},[n,t]);const o=K.useSyncExternalStore(K.useCallback(f=>n.subscribe(wa.batchCalls(f)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),c=K.useCallback((f,r)=>{n.mutate(f,r).catch(QL)},[n]);if(o.error&&BQ(n.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}async function UQ(t){if(!t.ok){const e=await t.text()||t.statusText;throw new Error(`${t.status}: ${e}`)}}async function xn(t,e,i){const n=await fetch(e,{method:t,headers:i?{"Content-Type":"application/json"}:{},body:i?JSON.stringify(i):void 0,credentials:"include"});return await UQ(n),n}const VQ=({on401:t})=>async({queryKey:e})=>{const i=await fetch(e.join("/"),{credentials:"include"});return t==="returnNull"&&i.status===401?null:(await UQ(i),await i.json())},Qi=new w_e({defaultOptions:{queries:{queryFn:VQ({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0,retry:!1},mutations:{retry:!1}}}),F_e=1,B_e=1e6;let Tj=0;function U_e(){return Tj=(Tj+1)%Number.MAX_SAFE_INTEGER,Tj.toString()}const Cj=new Map,S8=t=>{if(Cj.has(t))return;const e=setTimeout(()=>{Cj.delete(t),hT({type:"REMOVE_TOAST",toastId:t})},B_e);Cj.set(t,e)},V_e=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,F_e)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(i=>i.id===e.toast.id?{...i,...e.toast}:i)};case"DISMISS_TOAST":{const{toastId:i}=e;return i?S8(i):t.toasts.forEach(n=>{S8(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===i||i===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(i=>i.id!==e.toastId)}}},qI=[];let HI={toasts:[]};function hT(t){HI=V_e(HI,t),qI.forEach(e=>{e(HI)})}function $_e({...t}){const e=U_e(),i=o=>hT({type:"UPDATE_TOAST",toast:{...o,id:e}}),n=()=>hT({type:"DISMISS_TOAST",toastId:e});return hT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:o=>{o||n()}}}),{id:e,dismiss:n,update:i}}function ks(){const[t,e]=K.useState(HI);return K.useEffect(()=>(qI.push(e),()=>{const i=qI.indexOf(e);i>-1&&qI.splice(i,1)}),[t]),{...t,toast:$_e,dismiss:i=>hT({type:"DISMISS_TOAST",toastId:i})}}function Ni(t,e,{checkForDefaultPrevented:i=!0}={}
vendor: 11,026 bytes, line 48
48){return function(o){if(t==null||t(o),i===!1||!o.defaultPrevented)return e==null?void 0:e(o)}}function T8(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function GN(...t){return e=>{let i=!1;const n=t.map(o=>{const c=T8(o,e);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let o=0;o<n.length;o++){const c=n[o];typeof c=="function"?c():T8(t[o],null)}}}}function wr(...t){return K.useCallback(GN(...t),t)}function q_e(t,e){const i=K.createContext(e),n=c=>{const{children:f,...r}=c,x=K.useMemo(()=>r,Object.values(r));return d.jsx(i.Provider,{value:x,children:f})};n.displayName=t+"Provider";function o(c){const f=K.useContext(i);if(f)return f;if(e!==void 0)return e;throw new Error(`\`${c}\` must be used within \`${t}\``)}return[n,o]}function Wa(t,e=[]){let i=[];function n(c,f){const r=K.createContext(f),x=i.length;i=[...i,f];const S=I=>{var $;const{scope:N,children:D,...V}=I,B=(($=N==null?void 0:N[t])==null?void 0:$[x])||r,W=K.useMemo(()=>V,Object.values(V));return d.jsx(B.Provider,{value:W,children:D})};S.displayName=c+"Provider";function C(I,N){var B;const D=((B=N==null?void 0:N[t])==null?void 0:B[x])||r,V=K.useContext(D);if(V)return V;if(f!==void 0)return f;throw new Error(`\`${I}\` must be used within \`${c}\``)}return[S,C]}const o=()=>{const c=i.map(f=>K.createContext(f));return function(r){const x=(r==null?void 0:r[t])||c;return K.useMemo(()=>({[`__scope${t}`]:{...r,[t]:x}}),[r,x])}};return o.scopeName=t,[n,H_e(o,...e)]}function H_e(...t){const e=t[0];if(t.length===1)return e;const i=()=>{const n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(c){const f=n.reduce((r,{useScope:x,scopeName:S})=>{const I=x(c)[`__scope${S}`];return{...r,...I}},{});return K.useMemo(()=>({[`__scope${e.scopeName}`]:f}),[f])}};return i.scopeName=e.scopeName,i}function hg(t){const e=G_e(t),i=K.forwardRef((n,o)=>{const{children:c,...f}=n,r=K.Children.toArray(c),x=r.find(W_e);if(x){const S=x.props.children,C=r.map(I=>I===x?K.Children.count(S)>1?K.Children.only(null):K.isValidElement(S)?S.props.children:null:I);return d.jsx(e,{...f,ref:o,children:K.isValidElement(S)?K.cloneElement(S,void 0,C):null})}return d.jsx(e,{...f,ref:o,children:c})});return i.displayName=`${t}.Slot`,i}var $Q=hg("Slot");function G_e(t){const e=K.forwardRef((i,n)=>{const{children:o,...c}=i;if(K.isValidElement(o)){const f=Z_e(o),r=K_e(c,o.props);return o.type!==K.Fragment&&(r.ref=n?GN(n,f):f),K.cloneElement(o,r)}return K.Children.count(o)>1?K.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var qQ=Symbol("radix.slottable");function HQ(t){const e=({children:i})=>d.jsx(d.Fragment,{children:i});return e.displayName=`${t}.Slottable`,e.__radixId=qQ,e}function W_e(t){return K.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===qQ}function K_e(t,e){const i={...e};for(const n in e){const o=t[n],c=e[n];/^on[A-Z]/.test(n)?o&&c?i[n]=(...r)=>{c(...r),o(...r)}:o&&(i[n]=o):n==="style"?i[n]={...o,...c}:n==="className"&&(i[n]=[o,c].filter(Boolean).join(" "))}return{...t,...i}}function Z_e(t){var n,o;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}function dE(t){const e=t+"CollectionProvider",[i,n]=Wa(e),[o,c]=i(e,{collectionRef:{current:null},itemMap:new Map}),f=B=>{const{scope:W,children:$}=B,G=Tn.useRef(null),te=Tn.useRef(new Map).current;return d.jsx(o,{scope:W,itemMap:te,collectionRef:G,children:$})};f.displayName=e;const r=t+"CollectionSlot",x=hg(r),S=Tn.forwardRef((B,W)=>{const{scope:$,children:G}=B,te=c(r,$),ce=wr(W,te.collectionRef);return d.jsx(x,{ref:ce,children:G})});S.displayName=r;const C=t+"CollectionItemSlot",I="data-radix-collection-item",N=hg(C),D=Tn.forwardRef((B,W)=>{const{scope:$,children:G,...te}=B,ce=Tn.useRef(null),_e=wr(W,ce),Te=c(C,$);return Tn.useEffect(()=>(Te.itemMap.set(ce,{ref:ce,...te}),()=>void Te.itemMap.delete(ce))),d.jsx(N,{[I]:"",ref:_e,children:G})});D.displayName=C;function V(B){const W=c(t+"CollectionConsumer",B);return Tn.useCallback(()=>{const G=W.collectionRef.current;if(!G)return[];const te=Array.from(G.querySelectorAll(`[${I}]`));return Array.from(W.itemMap.values()).sort((Te,we)=>te.indexOf(Te.ref.current)-te.indexOf(we.ref.current))},[W.collectionRef,W.itemMap])}return[{Provider:f,Slot:S,ItemSlot:D},V,n]}var X_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],vn=X_e.reduce((t,e)=>{const i=hg(`Primitive.${e}`),n=K.forwardRef((o,c)=>{const{asChild:f,...r}=o,x=f?i:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(x,{...r,ref:c})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function $3(t,e){t&&ov.flushSync(()=>t.dispatchEvent(e))}function go(t){const e=K.useRef(t);return K.useEffect(()=>{e.current=t}),K.useMemo(()=>(...i)=>{var n;return(n=e.current)==null?void 0:n.call(e,...i)},[])}function Y_e(t,e=globalThis==null?void 0:globalThis.document){const i=go(t);K.useEffect(()=>{const n=o=>{o.key==="Escape"&&i(o)};return e.addEventListener("keydown",n,{capture:!0}),()=>e.removeEventListener("keydown",n,{capture:!0})},[i,e])}var Q_e="DismissableLayer",JL="dismissableLayer.update",J_e="dismissableLayer.pointerDownOutside",eve="dismissableLayer.focusOutside",C8,GQ=K.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),av=K.forwardRef((t,e)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:f,onDismiss:r,...x}=t,S=K.useContext(GQ),[C,I]=K.useState(null),N=(C==null?void 0:C.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,D]=K.useState({}),V=wr(e,we=>I(we)),B=Array.from(S.layers),[W]=[...S.layersWithOutsidePointerEventsDisabled].slice(-1),$=B.indexOf(W),G=C?B.indexOf(C):-1,te=S.layersWithOutsidePointerEventsDisabled.size>0,ce=G>=$,_e=ive(we=>{const Ne=we.target,pe=[...S.branches].some(Pe=>Pe.contains(Ne));!ce||pe||(o==null||o(we),f==null||f(we),we.defaultPrevented||r==null||r())},N),Te=nve(we=>{const Ne=we.target;[...S.branches].some(Pe=>Pe.contains(Ne))||(c==null||c(we),f==null||f(we),we.defaultPrevented||r==null||r())},N);return Y_e(we=>{G===S.layers.size-1&&(n==null||n(we),!we.defaultPrevented&&r&&(we.preventDefault(),r()))},N),K.useEffect(()=>{if(C)return i&&(S.layersWithOutsidePointerEventsDisabled.size===0&&(C8=N.body.style.pointerEvents,N.body.style.pointerEvents="none"),S.layersWithOutsidePointerEventsDisabled.add(C)),S.layers.add(C),E8(),()=>{i&&S.layersWithOutsidePointerEventsDisabled.size===1&&(N.body.style.pointerEvents=C8)}},[C,N,i,S]),K.useEffect(()=>()=>{C&&(S.layers.delete(C),S.layersWithOutsidePointerEventsDisabled.delete(C),E8())},[C,S]),K.useEffect(()=>{const we=()=>D({});return document.addEventListener(JL,we),()=>document.removeEventListener(JL,we)},[]),d.jsx(vn.div,{...x,ref:V,style:{pointerEvents:te?ce?"auto":"none":void 0,...t.style},onFocusCapture:Ni(t.onFocusCapture,Te.onFocusCapture),onBlurCapture:Ni(t.onBlurCapture,Te.onBlurCapture),onPointerDownCapture:Ni(t.onPointerDownCapture,_e.onPointerDownCapture)})});av.displayName=Q_e;var tve="DismissableLayerBranch",WQ=K.forwardRef((t,e)=>{const i=K.useContext(GQ),n=K.useRef(null),o=wr(e,n);return K.useEffect(()=>{const c=n.current;if(c)return i.branches.add(c),()=>{i.branches.delete(c)}},[i.branches]),d.jsx(vn.div,{...t,ref:o})});WQ.displayName=tve;function ive(t,e=globalThis==null?void 0:globalThis.document){const i=go(t),n=K.useRef(!1),o=K.useRef(()=>{});return K.useEffect(()=>{const c=r=>{if(r.target&&!n.current){let x=function(){KQ(J_e,i,S,{discrete:!0})};const S={originalEvent:r};r.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=x,e.addEventListener("click",o.current,{once:!0})):x()}else e.removeEventListener("click",o.current);n.current=!1},f=window.setTimeout(()=>{e.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(f),e.removeEventListener("pointerdown",c),e.removeEventListener("click",o.current)}},[e,i]),{onPointerDownCapture:()=>n.current=!0}}function nve(t,e=globalThis==null?void 0:globalThis.document){const i=go(t),n=K.useRef(!1);return K.useEffect(()=>{const o=c=>{c.target&&!n.current&&KQ(eve,i,{originalEvent:c},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,i]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function E8(){const t=new CustomEvent(JL);document.dispatchEvent(t)}function KQ(t,e,i,{discrete:n}){const o=i.originalEvent.target,c=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:i});e&&o.addEventListener(t,e,{once:!0}),n?$3(o,c):o.dispatchEvent(c)}var rve=av,sve=WQ,Jo=globalThis!=null&&globalThis.document?K.useLayoutEffect:()=>{},ove="Portal",Zb=K.forwardRef((t,e)=>{var r;const{container:i,...n}=t,[o,c]=K.useState(!1);Jo(()=>c(!0),[]);const f=i||o&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return f?gQ.createPortal(d.jsx(vn.div,{...n,ref:e}),f):null});Zb.displayName=ove;function ave(t,e){return K.useReducer((i,n)=>e[i][n]??i,t)}var Ea=t=>{const{present:e,children:i}=t,n=lve(e),o=typeof i=="function"?i({present:n.isPresent}):K.Children.only(i),c=wr(n.ref,cve(o));return typeof i=="function"||n.isPresent?K.cloneElement(o,{ref:c}):null};Ea.displayName="Presence";function lve(t){const[e,i]=K.useState(),n=K.useRef({}),o=K.useRef(t),c=K.useRef("none"),f=t?"mounted":"unmounted",[r,x]=ave(f,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return K.useEffect(()=>{const S=ZA(n.current);c.current=r==="mounted"?S:"none"},[r]),Jo(()=>{const S=n.current,C=o.current;if(C!==t){const N=c.current,D=ZA(S);t?x("MOUNT"):D==="none"||(S==null?void 0:S.display)==="none"?x("UNMOUNT"):x(C&&N!==D?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,x]),Jo(()=>{if(e){let S;const C=e.ownerDocument.defaultView??window,I=D=>{const B=ZA(n.current).includes(D.animationName);if(D.target===e&&B&&(x("ANIMATION_END"),!o.current)){const W=e.style.animationFillMode;e.style.animationFillMode="forwards",S=C.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=W)})}},N=D=>{D.target===e&&(c.current=ZA(n.current))};return e.addEventListener("animationstart",N),e.addEventListener("animationcancel",I),e.addEventListener("animationend",I),()=>{C.clearTimeout(S),e.removeEventListener("animationstart",N),e.removeEventListener("animationcancel",I),e.removeEventListener("animationend",I)}}else x("ANIMATION_END")},[e,x]),{isPresent:["mounted","unmountSuspended"].includes(r),ref:K.useCallback(S=>{S&&(n.current=getComputedStyle(S)),i(S)},[])}}function ZA(t){return(t==null?void 0:t.animationName)||"none"}function cve(t){var n,o;let e=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,i=e&&"isReactWarning"in e&&e.
48isReactWarning;return i?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?t.props.ref:t.props.ref||t.ref)}function lu({prop:t,defaultProp:e,onChange:i=()=>{}}){const[n,o]=uve({defaultProp:e,onChange:i}),c=t!==void 0,f=c?t:n,r=go(i),x=K.useCallback(S=>{if(c){const I=typeof S=="function"?S(t):S;I!==t&&r(I)}else o(S)},[c,t,o,r]);return[f,x]}function uve({defaultProp:t,onChange:e}){const i=K.useState(t),[n]=i,o=K.useRef(n),c=go(e);return K.useEffect(()=>{o.current!==n&&(c(n),o.current=n)},[n,o,c]),i}var dve="VisuallyHidden",hE=K.forwardRef((t,e)=>d.jsx(vn.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));hE.displayName=dve;var hve=hE,q3="ToastProvider",[H3,pve,fve]=dE("Toast"),[ZQ,S8e]=Wa("Toast",[fve]),[mve,WN]=ZQ(q3),XQ=t=>{const{__scopeToast:e,label:i="Notification",duration:n=5e3,swipeDirection:o="right",swipeThreshold:c=50,children:f}=t,[r,x]=K.useState(null),[S,C]=K.useState(0),I=K.useRef(!1),N=K.useRef(!1);return i.trim()||console.error(`Invalid prop \`label\` supplied to \`${q3}\`. Expected non-empty \`string\`.`),d.jsx(H3.Provider,{scope:e,children:d.jsx(mve,{scope:e,label:i,duration:n,swipeDirection:o,swipeThreshold:c,toastCount:S,viewport:r,onViewportChange:x,onToastAdd:K.useCallback(()=>C(D=>D+1),[]),onToastRemove:K.useCallback(()=>C(D=>D-1),[]),isFocusedToastEscapeKeyDownRef:I,isClosePausedRef:N,children:f})})};XQ.displayName=q3;var YQ="ToastViewport",gve=["F8"],eO="toast.viewportPause",tO="toast.viewportResume",QQ=K.forwardRef((t,e)=>{const{__scopeToast:i,hotkey:n=gve,label:o="Notifications ({hotkey})",...c}=t,f=WN(YQ,i),r=pve(i),x=K.useRef(null),S=K.useRef(null),C=K.useRef(null),I=K.useRef(null),N=wr(e,I,f.onViewportChange),D=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),V=f.toastCount>0;K.useEffect(()=>{const W=$=>{var te;n.length!==0&&n.every(ce=>$[ce]||$.code===ce)&&((te=I.current)==null||te.focus())};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[n]),K.useEffect(()=>{const W=x.current,$=I.current;if(V&&W&&$){const G=()=>{if(!f.isClosePausedRef.current){const Te=new CustomEvent(eO);$.dispatchEvent(Te),f.isClosePausedRef.current=!0}},te=()=>{if(f.isClosePausedRef.current){const Te=new CustomEvent(tO);$.dispatchEvent(Te),f.isClosePausedRef.current=!1}},ce=Te=>{!W.contains(Te.relatedTarget)&&te()},_e=()=>{W.contains(document.activeElement)||te()};return W.addEventListener("focusin",G),W.addEventListener("focusout",ce),W.addEventListener("pointermove",G),W.addEventListener("pointerleave",_e),window.addEventListener("blur",G),window.addEventListener("focus",te),()=>{W.removeEventListener("focusin",G),W.removeEventListener("focusout",ce),W.removeEventListener("pointermove",G),W.removeEventListener("pointerleave",_e),window.removeEventListener("blur",G),window.removeEventListener("focus",te)}}},[V,f.isClosePausedRef]);const B=K.useCallback(({tabbingDirection:W})=>{const G=r().map(te=>{const ce=te.ref.current,_e=[ce,...kve(ce)];return W==="forwards"?_e:_e.reverse()});return(W==="forwards"?G.reverse():G).flat()},[r]);return K.useEffect(()=>{const W=I.current;if(W){const $=G=>{var _e,Te,we;const te=G.altKey||G.ctrlKey||G.metaKey;if(G.key==="Tab"&&!te){const Ne=document.activeElement,pe=G.shiftKey;if(G.target===W&&pe){(_e=S.current)==null||_e.focus();return}const Je=B({tabbingDirection:pe?"backwards":"forwards"}),dt=Je.findIndex(At=>At===Ne);Ej(Je.slice(dt+1))?G.preventDefault():pe?(Te=S.current)==null||Te.focus():(we=C.current)==null||we.focus()}};return W.addEventListener("keydown",$),()=>W.removeEventListener("keydown",$)}},[r,B]),d.jsxs(sve,{ref:x,role:"region","aria-label":o.replace("{hotkey}",D),tabIndex:-1,style:{pointerEvents:V?void 0:"none"},children:[V&&d.jsx(iO,{ref:S,onFocusFromOutsideViewport:()=>{const W=B({tabbingDirection:"forwards"});Ej(W)}}),d.jsx(H3.Slot,{scope:i,children:d.jsx(vn.ol,{tabIndex:-1,...c,ref:N})}),V&&d.jsx(iO,{ref:C,onFocusFromOutsideViewport:()=>{const W=B({tabbingDirection:"backwards"});Ej(W)}})]})});QQ.displayName=YQ;var JQ="ToastFocusProxy",iO=K.forwardRef((t,e)=>{const{__scopeToast:i,onFocusFromOutsideViewport:n,...o}=t,c=WN(JQ,i);return d.jsx(hE,{"aria-hidden":!0,tabIndex:0,...o,ref:e,style:{position:"fixed"},onFocus:f=>{var S;const r=f.relatedTarget;!((S=c.viewport)!=null&&S.contains(r))&&n()}})});iO.displayName=JQ;var KN="Toast",yve="toast.swipeStart",_ve="toast.swipeMove",vve="toast.swipeCancel",xve="toast.swipeEnd",eJ=K.forwardRef((t,e)=>{const{forceMount:i,open:n,defaultOpen:o,onOpenChange:c,...f}=t,[r=!0,x]=lu({prop:n,defaultProp:o,onChange:c});return d.jsx(Ea,{present:i||r,children:d.jsx(Sve,{open:r,...f,ref:e,onClose:()=>x(!1),onPause:go(t.onPause),onResume:go(t.onResume),onSwipeStart:Ni(t.onSwipeStart,S=>{S.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ni(t.onSwipeMove,S=>{const{x:C,y:I}=S.detail.delta;S.currentTarget.setAttribute("data-swipe","move"),S.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${C}px`),S.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${I}px`)}),onSwipeCancel:Ni(t.onSwipeCancel,S=>{S.currentTarget.setAttribute("data-swipe","cancel"),S.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),S.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),S.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),S.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ni(t.onSwipeEnd,S=>{const{x:C,y:I}=S.detail.delta;S.currentTarget.setAttribute("data-swipe","end"),S.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),S.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),S.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${C}px`),S.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${I}px`),x(!1)})})})});eJ.displayName=KN;var[bve,wve]=ZQ(KN,{onClose(){}}),Sve=K.forwardRef((t,e)=>{const{__scopeToast:i,type:n="foreground",duration:o,open:c,onClose:f,onEscapeKeyDown:r,onPause:x,onResume:S,onSwipeStart:C,onSwipeMove:I,onSwipeCancel:N,onSwipeEnd:D,...V}=t,B=WN(KN,i),[W,$]=K.useState(null),G=wr(e,At=>$(At)),te=K.useRef(null),ce=K.useRef(null),_e=o||B.duration,Te=K.useRef(0),we=K.useRef(_e),Ne=K.useRef(0),{onToastAdd:pe,onToastRemove:Pe}=B,De=go(()=>{var qt;
48(W==null?void 0:W.contains(document.activeElement))&&((qt=B.viewport)==null||qt.focus()),f()}),Je=K.useCallback(At=>{!At||At===1/0||(window.clearTimeout(Ne.current),Te.current=new Date().getTime(),Ne.current=window.setTimeout(De,At))},[De]);K.useEffect(()=>{const At=B.viewport;if(At){const qt=()=>{Je(we.current),S==null||S()},kt=()=>{const Vt=new Date().getTime()-Te.current;we.current=we.current-Vt,window.clearTimeout(Ne.current),x==null||x()};return At.addEventListener(eO,kt),At.addEventListener(tO,qt),()=>{At.removeEventListener(eO,kt),At.removeEventListener(tO,qt)}}},[B.viewport,_e,x,S,Je]),K.useEffect(()=>{c&&!B.isClosePausedRef.current&&Je(_e)},[c,_e,B.isClosePausedRef,Je]),K.useEffect(()=>(pe(),()=>Pe()),[pe,Pe]);const dt=K.useMemo(()=>W?aJ(W):null,[W]);return B.viewport?d.jsxs(d.Fragment,{children:[dt&&d.jsx(Tve,{__scopeToast:i,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:dt}),d.jsx(bve,{scope:i,onClose:De,children:ov.createPortal(d.jsx(H3.ItemSlot,{scope:i,children:d.jsx(rve,{asChild:!0,onEscapeKeyDown:Ni(r,()=>{B.isFocusedToastEscapeKeyDownRef.current||De(),B.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(vn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":B.swipeDirection,...V,ref:G,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ni(t.onKeyDown,At=>{At.key==="Escape"&&(r==null||r(At.nativeEvent),At.nativeEvent.defaultPrevented||(B.isFocusedToastEscapeKeyDownRef.current=!0,De()))}),onPointerDown:Ni(t.onPointerDown,At=>{At.button===0&&(te.current={x:At.clientX,y:At.clientY})}),onPointerMove:Ni(t.onPointerMove,At=>{if(!te.current)return;const qt=At.clientX-te.current.x,kt=At.clientY-te.current.y,Vt=!!ce.current,Fe=["left","right"].includes(B.swipeDirection),lt=["left","up"].includes(B.swipeDirection)?Math.min:Math.max,pt=Fe?lt(0,qt):0,Ge=Fe?
480:lt(0,kt),Rt=At.pointerType==="touch"?10:2,Ot={x:pt,y:Ge},Ci={originalEvent:At,delta:Ot};Vt?(ce.current=Ot,XA(_ve,I,Ci,{discrete:!1})):A8(Ot,B.swipeDirection,Rt)?(ce.current=Ot,XA(yve,C,Ci,{discrete:!1}),At.target.setPointerCapture(At.pointerId)):(Math.abs(qt)>Rt||Math.abs(kt)>Rt)&&(te.current=null)}),onPointerUp:Ni(t.onPointerUp,At=>{const qt=ce.current,kt=At.target;if(kt.hasPointerCapture(At.pointerId)&&kt.releasePointerCapture(At.pointerId),ce.current=null,te.current=null,qt){const Vt=At.currentTarget,Fe={originalEvent:At,delta:qt};A8(qt,B.swipeDirection,B.swipeThreshold)?XA(xve,D,Fe,{discrete:!0}):XA(vve,N,Fe,{discrete:!0}),Vt.addEventListener("click",lt=>lt.preventDefault(),{once:!0})}})})})}),B.viewport)})]}):null}),Tve=t=>{const{__scopeToast:e,children:i,...n}=t,o=WN(KN,e),[c,f]=K.useState(!1),[r,x]=K.useState(!1);return Ave(()=>f(!0)),K.useEffect(()=>{const S=window.setTimeout(()=>x(!0),1e3);return()=>window.clearTimeout(S)},[]),r?null:d.jsx(Zb,{asChild:!0,children:d.jsx(hE,{...n,children:c&&d.jsxs(d.Fragment,{children:[o.label," ",i]})})})},Cve="ToastTitle",tJ=K.forwardRef((t,e)=>{const{__scopeToast:i,...n}=t;return d.jsx(vn.div,{...n,ref:e})});tJ.displayName=Cve;var Eve="ToastDescription",iJ=K.forwardRef((t,e)=>{const{__scopeToast:i,...n}=t;return d.jsx(vn.div,{...n,ref:e})});iJ.displayName=Eve;var nJ="ToastAction",rJ=K.forwardRef((t,e)=>{const{altText:i,...n}=t;return i.trim()?d.jsx(oJ,{altText:i,asChild:!0,children:d.jsx(G3,{...n,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${nJ}\`. Expected non-empty \`string\`.`),null)});rJ.displayName=nJ;var sJ="ToastClose",G3=K.forwardRef((t,e)=>{const{__scopeToast:i,...n}=t,o=wve(sJ,i);return d.jsx(oJ,{asChild:!0,children:d.jsx(vn.button,{type:"button",...n,ref:e,onClick:Ni(t.onClick,o.onClose)})})});G3.displayName=sJ;var oJ=K.forwardRef((t,e)=>{const{__scopeToast:i,altText:n,...o}=t;return d.jsx(vn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...o,ref:e})});function aJ(t){const e=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&e.push(n.textContent),Ive(n)){const o=n.ariaHidden||n.hidden||n.style.display==="none",c=n.dataset.radixToastAnnounceExclude==="";if(!o)if(c){const f=n.dataset.radixToastAnnounceAlt;f&&e.push(f)}else e.push(...aJ(n))}}),e}function XA(t,e,i,{discrete:n}){const o=i.originalEvent.currentTarget,c=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:i});e&&o.addEventListener(t,e,{once:!0}),n?$3(o,c):o.dispatchEvent(c)}var A8=(t,e,i=0)=>{const n=Math.abs(t.x),o=Math.abs(t.y),c=n>o;return e==="left"||e==="right"?c&&n>i:!c&&o>i};function Ave(t=()=>{}){const e=go(t);Jo(()=>{let i=0,n=0;return i=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(i),window.cancelAnimationFrame(n)}},[e])}function Ive(t){return t.nodeType===t.ELEMENT_NODE}function kve(t){const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)e.push(i.currentNode);return e}function Ej(t){const e=document.activeElement;return t.some(i=>i===e?!0:(i.focus(),document.activeElement!==e))}var Pve=XQ,lJ=QQ,cJ=eJ,uJ=tJ,dJ=iJ,hJ=rJ,pJ=G3;function fJ(t){var e,i,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(i=fJ(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function mJ(){for(var t,e,i=0,n="",o=arguments.length;i<o;i++)(t=arguments[i])&&(e=fJ(t))&&(n&&(n+=" "),n+=e);return n}const I8=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,k8=mJ,Xb=(t,e)=>i=>{var n;if((e==null?void 0:e.variants)==null)return k8(t,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:o,defaultVariants:c}=e,f=Object.keys(o).map(S=>{const C=i==null?void 0:i[S],I=c==null?void 0:c[S];if(C===null)return null;const N=I8(C)||I8(I);return o[S][N]}),r=i&&Object.entries(i).reduce((S,C)=>{let[I,N]=C;return N===void 0||(S[I]=N),S},{}),x=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((S,C)=>{let{class:I,className:N,...D}=C;return Object.entries(D).every(V=>{let[B,W]=V;return Array.isArray(W)?W.includes({...c,...r}[B]):{...c,...r}[B]===W})?[...S,I,N]:S},[]);return k8(t,f,x,i==null?void 0:i.class,i==null?void 0:i.className)};/** 49 * @license lucide-react v0.453.0 - ISC 50 * 51 * This source code is licensed under the ISC license. 52 * See the LICENSE file in the root directory of this source tree. 53 */const Nve=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gJ=(...t)=>t.filter((e,i,n)=>!!e&&n.indexOf(e)===i).join(" ");/** 54 * @license lucide-react v0.453.0 - ISC 55 * 56 * This source code is licensed under the ISC license. 57 * See the LICENSE file in the root directory of this source tree. 58 */var Mve={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"};/** 59 * @license lucide-react v0.453.0 - ISC 60 * 61 * This source code is licensed under the ISC license. 62 * See the LICENSE file in the root directory of this source tree. 63 */const Dve=K.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:o="",children:c,iconNode:f,...r},x)=>K.createElement("svg",{ref:x,...Mve,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:gJ("lucide",o),...r},[...f.map(([S,C])=>
63K.createElement(S,C)),...Array.isArray(c)?c:[c]]));/** 64 * @license lucide-react v0.453.0 - ISC 65 * 66 * This source code is licensed under the ISC license. 67 * See the LICENSE file in the root directory of this source tree. 68 */const mi=(t,e)=>{const i=K.forwardRef(({className:n,...o},c)=>K.createElement(Dve,{ref:c,iconNode:e,className:gJ(`lucide-${Nve(t)}`,n),...o}));return i.displayName=`${t}`,i};/** 69 * @license lucide-react v0.453.0 - ISC 70 * 71 * This source code is licensed under the ISC license. 72 * See the LICENSE file in the root directory of this source tree. 73 */const Rve=mi("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 74 * @license lucide-react v0.453.0 - ISC 75 * 76 * This source code is licensed under the ISC license. 77 * See the LICENSE file in the root directory of this source tree. 78 */const jve=mi("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** 79 * @license lucide-react v0.453.0 - ISC 80 * 81 * This source code is licensed under the ISC license. 82 * See the LICENSE file in the root directory of this source tree. 83 */const zve=mi("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 84 * @license lucide-react v0.453.0 - ISC 85 * 86 * This source code is licensed under the ISC license. 87 * See the LICENSE file in the root directory of this source tree. 88 */const Lve=mi("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** 89 * @license lucide-react v0.453.0 - ISC 90 * 91 * This source code is licensed under the ISC license. 92 * See the LICENSE file in the root directory of this source tree. 93 */const Ove=mi("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** 94 * @license lucide-react v0.453.0 - ISC 95 * 96 * This source code is licensed under the ISC license. 97 * See the LICENSE file in the root directory of this source tree. 98 */const Fve=mi("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** 99 * @license lucide-react v0.453.0 - ISC 100 * 101 * This source code is licensed under the ISC license. 102 * See the LICENSE file in the root directory of this source tree. 103 */const Ao=mi("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 104 * @license lucide-react v0.453.0 - ISC 105 * 106 * This source code is licensed under the ISC license. 107 * See the LICENSE file in the root directory of this source tree. 108 */const Bve=mi("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 109 * @license lucide-react v0.453.0 - ISC 110 * 111 * This source code is licensed under the ISC license. 112 * See the LICENSE file in the root directory of this source tree. 113 */const Uve=mi("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** 114 * @license lucide-react v0.453.0 - ISC 115 * 116 * This source code is licensed under the ISC license. 117 * See the LICENSE file in the root directory of this source tree. 118 */const Vve=mi("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"}]]);/** 119 * @license lucide-react v0.453.0 - ISC 120 * 121 * This source code is licensed under the ISC license. 122 * See the LICENSE file in the root directory of this source tree. 123 */const $ve=mi("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** 124 * @license lucide-react v0.453.0 - ISC 125 * 126 * This source code is licensed under the ISC license. 127 * See the LICENSE file in the root directory of this source tree. 128 */const qve=mi("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** 129 * @license lucide-react v0.453.0 - ISC 130 * 131 * This source code is licensed under the ISC license. 132 * See the LICENSE file in the root directory of this source tree. 133 */const yJ=mi("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** 134 * @license lucide-react v0.453.0 - ISC 135 * 136 * This source code is licensed under the ISC license. 137 * See the LICENSE file in the root directory of this source tree. 138 */const W3=mi("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** 139 * @license lucide-react v0.453.0 - ISC 140 * 141 * This source code is licensed under the ISC license. 142 * See the LICENSE file in the root directory of this source tree. 143 */const Hp=mi("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** 144 * @license lucide-react v0.453.0 - ISC 145 * 146 * This source code is licensed under the ISC license. 147 * See the LICENSE file in the root directory of this source tree. 148 */const Yb=mi("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** 149 * @license lucide-react v0.453.0 - ISC 150 * 151 * This source code is licensed under the ISC license. 152 * See the LICENSE file in the root directory of this source tree. 153 */const Cd=mi("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 154 * @license lucide-react v0.453.0 - ISC 155 * 156 * This source code is licensed under the ISC license. 157 * See the LICENSE file in the root directory of this source tree. 158 */const Qb=mi("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 159 * @license lucide-react v0.453.0 - ISC 160 * 161 * This source code is licensed under the ISC license. 162 * See the LICENSE file in the root directory of this source tree. 163 */const Hve=mi("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 164 * @license lucide-react v0.453.0 - ISC 165 * 166 * This source code is licensed under the ISC license. 167 * See the LICENSE file in the root directory of this source tree. 168 */const _J=mi("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 169 * @license lucide-react v0.453.0 - ISC 170 * 171 * This source code is licensed under the ISC license. 172 * See the LICENSE file in the root directory of this source tree. 173 */const vJ=mi("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 174 * @license lucide-react v0.453.0 - ISC 175 * 176 * This source code is licensed under the ISC license. 177 * See the LICENSE file in the root directory of this source tree. 178 */const Jb=mi("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** 179 * @license lucide-react v0.453.0 - ISC 180 * 181 * This source code is licensed under the ISC license. 182 * See the LICENSE file in the root directory of this source tree. 183 */const Wo=mi("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 184 * @license lucide-react v0.453.0 - ISC 185 * 186 * This source code is licensed under the ISC license. 187 * See the LICENSE file in the root directory of this source tree. 188 */const Gve=mi("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** 189 * @license lucide-react v0.453.0 - ISC 190 * 191 * This source code is licensed under the ISC license. 192 * See the LICENSE file in the root directory of this source tree. 193 */const xJ=mi("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 194 * @license lucide-react v0.453.0 - ISC 195 * 196 * This source code is licensed under the ISC license. 197 * See the LICENSE file in the root directory of this source tree. 198 */const Wve=mi("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** 199 * @license lucide-react v0.453.0 - ISC 200 * 201 * This source code is licensed under the ISC license. 202 * See the LICENSE file in the root directory of this source tree. 203 */const B_=mi("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"}]]);/** 204 * @license lucide-react v0.453.0 - ISC 205 * 206 * This source code is licensed under the ISC license. 207 * See the LICENSE file in the root directory of this source tree. 208 */const Kve=mi("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 209 * @license lucide-react v0.453.0 - ISC 210 * 211 * This source code is licensed under the ISC license. 212 * See the LICENSE file in the root directory of this source tree. 213 */const Zve=mi("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** 214 * @license lucide-react v0.453.0 - ISC 215 * 216 * This source code is licensed under the ISC license. 217 * See the LICENSE file in the root directory of this source tree. 218 */const qh=mi("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 219 * @license lucide-react v0.453.0 - ISC 220 * 221 * This source code is licensed under the ISC license. 222 * See the LICENSE file in the root directory of this source tree. 223 */const e1=mi("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"}]]);/** 224 * @license lucide-react v0.453.0 - ISC 225 * 226 * This source code is licensed under the ISC license. 227 * See the LICENSE file in the root directory of this source tree.
228 */const QT=mi("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** 229 * @license lucide-react v0.453.0 - ISC 230 * 231 * This source code is licensed under the ISC license. 232 * See the LICENSE file in the root directory of this source tree. 233 */const Xve=mi("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** 234 * @license lucide-react v0.453.0 - ISC 235 * 236 * This source code is licensed under the ISC license. 237 * See the LICENSE file in the root directory of this source tree. 238 */const GI=mi("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** 239 * @license lucide-react v0.453.0 - ISC 240 * 241 * This source code is licensed under the ISC license. 242 * See the LICENSE file in the root directory of this source tree. 243 */const ZN=mi("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** 244 * @license lucide-react v0.453.0 - ISC 245 * 246 * This source code is licensed under the ISC license. 247 * See the LICENSE file in the root directory of this source tree. 248 */const Yve=mi("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** 249 * @license lucide-react v0.453.0 - ISC 250 * 251 * This source code is licensed under the ISC license. 252 * See the LICENSE file in the root directory of this source tree. 253 */const XN=mi("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** 254 * @license lucide-react v0.453.0 - ISC 255 * 256 * This source code is licensed under the ISC license. 257 * See the LICENSE file in the root directory of this source tree. 258 */const Ok=mi("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 259 * @license lucide-react v0.453.0 - ISC 260 * 261 * This source code is licensed under the ISC license. 262 * See the LICENSE file in the root directory of this source tree. 263 */const Tb=mi("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 264 * @license lucide-react v0.453.0 - ISC 265 * 266 * This source code is licensed under the ISC license. 267 * See the LICENSE file in the root directory of this source tree. 268 */const Qve=mi("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** 269 * @license lucide-react v0.453.0 - ISC 270 * 271 * This source code is licensed under the ISC license. 272 * See the LICENSE file in the root directory of this source tree. 273 */const Yp=mi("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** 274 * @license lucide-react v0.453.0 - ISC 275 * 276 * This source code is licensed under the ISC license. 277 * See the LICENSE file in the root directory of this source tree. 278 */const Jve=mi("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** 279 * @license lucide-react v0.453.0 - ISC 280 * 281 * This source code is licensed under the ISC license. 282 * See the LICENSE file in the root directory of this source tree. 283 */const exe=mi("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** 284 * @license lucide-react v0.453.0 - ISC 285 * 286 * This source code is licensed under the ISC license. 287 * See the LICENSE file in the root directory of this source tree. 288 */const t1=mi("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** 289 * @license lucide-react v0.453.0 - ISC 290 * 291 * This source code is licensed under the ISC license. 292 * See the LICENSE file in the root directory of this source tree. 293 */const YN=mi("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"}]]);/** 294 * @license lucide-react v0.453.0 - ISC 295 * 296 * This source code is licensed under the ISC license. 297 * See the LICENSE file in the root directory of this source tree. 298 */const bJ=mi("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** 299 * @license lucide-react v0.453.0 - ISC 300 * 301 * This source code is licensed under the ISC license. 302 * See the LICENSE file in the root directory of this source tree. 303 */const pT=mi("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** 304 * @license lucide-react v0.453.0 - ISC 305 * 306 * This source code is licensed under the ISC license. 307 * See the LICENSE file in the root directory of this source tree. 308 */const P8=mi("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}
308]]);/** 309 * @license lucide-react v0.453.0 - ISC 310 * 311 * This source code is licensed under the ISC license. 312 * See the LICENSE file in the root directory of this source tree. 313 */const ig=mi("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** 314 * @license lucide-react v0.453.0 - ISC 315 * 316 * This source code is licensed under the ISC license. 317 * See the LICENSE file in the root directory of this source tree. 318 */const txe=mi("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** 319 * @license lucide-react v0.453.0 - ISC 320 * 321 * This source code is licensed under the ISC license. 322 * See the LICENSE file in the root directory of this source tree. 323 */const ixe=mi("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** 324 * @license lucide-react v0.453.0 - ISC 325 * 326 * This source code is licensed under the ISC license. 327 * See the LICENSE file in the root directory of this source tree. 328 */const K3=mi("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** 329 * @license lucide-react v0.453.0 - ISC 330 * 331 * This source code is licensed under the ISC license. 332 * See the LICENSE file in the root directory of this source tree. 333 */const Fk=mi("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 334 * @license lucide-react v0.453.0 - ISC 335 * 336 * This source code is licensed under the ISC license. 337 * See the LICENSE file in the root directory of this source tree. 338 */const wJ=mi("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** 339 * @license lucide-react v0.453.0 - ISC 340 * 341 * This source code is licensed under the ISC license. 342 * See the LICENSE file in the root directory of this source tree. 343 */const nxe=mi("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** 344 * @license lucide-react v0.453.0 - ISC 345 * 346 * This source code is licensed under the ISC license. 347 * See the LICENSE file in the root directory of this source tree. 348 */const SJ=mi("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** 349 * @license lucide-react v0.453.0 - ISC 350 * 351 * This source code is licensed under the ISC license. 352 * See the LICENSE file in the root directory of this source tree. 353 */const rxe=mi("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** 354 * @license lucide-react v0.453.0 - ISC 355 * 356 * This source code is licensed under the ISC license. 357 * See the LICENSE file in the root directory of this source tree. 358 */const TJ=mi("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** 359 * @license lucide-react v0.453.0 - ISC 360 * 361 * This source code is licensed under the ISC license. 362 * See the LICENSE file in the root directory of this source tree. 363 */const lv=mi("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 364 * @license lucide-react v0.453.0 - ISC 365 * 366 * This source code is licensed under the ISC license. 367 * See the LICENSE file in the root directory of this source tree. 368 */const Aj=mi("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}
368],["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"}]]);/** 369 * @license lucide-react v0.453.0 - ISC 370 * 371 * This source code is licensed under the ISC license. 372 * See the LICENSE file in the root directory of this source tree. 373 */const sxe=mi("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"}]]);/** 374 * @license lucide-react v0.453.0 - ISC 375 * 376 * This source code is licensed under the ISC license. 377 * See the LICENSE file in the root directory of this source tree. 378 */const CJ=mi("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** 379 * @license lucide-react v0.453.0 - ISC 380 * 381 * This source code is licensed under the ISC license. 382 * See the LICENSE file in the root directory of this source tree. 383 */const Z3=mi("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** 384 * @license lucide-react v0.453.0 - ISC 385 * 386 * This source code is licensed under the ISC license. 387 * See the LICENSE file in the root directory of this source tree. 388 */const fo=mi("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"}]]);/** 389 * @license lucide-react v0.453.0 - ISC 390 * 391 * This source code is licensed under the ISC license. 392 * See the LICENSE file in the root directory of this source tree. 393 */const X3=mi("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** 394 * @license lucide-react v0.453.0 - ISC 395 * 396 * This source code is licensed under the ISC license. 397 * See the LICENSE file in the root directory of this source tree. 398 */const N8=mi("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** 399 * @license lucide-react v0.453.0 - ISC 400 * 401 * This source code is licensed under the ISC license. 402 * See the LICENSE file in the root directory of this source tree. 403 */const Cb=mi("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** 404 * @license lucide-react v0.453.0 - ISC 405 * 406 * This source code is licensed under the ISC license. 407 * See the LICENSE file in the root directory of this source tree. 408 */const sf=mi("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** 409 * @license lucide-react v0.453.0 - ISC 410 * 411 * This source code is licensed under the ISC license. 412 * See the LICENSE file in the root directory of this source tree. 413 */const EJ=mi("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** 414 * @license lucide-react v0.453.0 - ISC 415 * 416 * This source code is licensed under the ISC license. 417 * See the LICENSE file in the root directory of this source tree. 418 */const oxe=mi("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** 419 * @license lucide-react v0.453.0 - ISC 420 * 421 * This source code is licensed under the ISC license. 422 * See the LICENSE file in the root directory of this source tree. 423 */const AJ=mi("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** 424 * @license lucide-react v0.453.0 - ISC 425 * 426 * This source code is licensed under the ISC license. 427 * See the LICENSE file in the root directory of this source tree. 428 */const M8=mi("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** 429 * @license lucide-react v0.453.0 - ISC 430 * 431 * This source code is licensed under the ISC license. 432 * See the LICENSE file in the root directory of this source tree. 433 */const axe=mi("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** 434 * @license lucide-react v0.453.0 - ISC 435 * 436 * This source code is licensed under the ISC license. 437 * See the LICENSE file in the root directory of this source tree. 438 */const nO=mi("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** 439 * @license lucide-react v0.453.0 - ISC 440 * 441 * This source code is licensed under the ISC license. 442 * See the LICENSE file in the root directory of this source tree. 443 */const lxe=mi("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** 444 * @license lucide-react v0.453.0 - ISC 445 * 446 * This source code is licensed under the ISC license. 447 * See the LICENSE file in the root directory of this source tree. 448 */const cxe=mi("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** 449 * @license lucide-react v0.453.0 - ISC 450 * 451 * This source code is licensed under the ISC license. 452 * See the LICENSE file in the root directory of this source tree. 453 */const fT=mi("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 454 * @license lucide-react v0.453.0 - ISC 455 * 456 * This source code is licensed under the ISC license. 457 * See the LICENSE file in the root directory of this source tree. 458 */const of=mi("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 459 * @license lucide-react v0.453.0 - ISC 460 * 461 * This source code is licensed under the ISC license. 462 * See the LICENSE file in the root directory of this source tree. 463 */const uxe=mi("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** 464 * @license lucide-react v0.453.0 - ISC 465 * 466 * This source code is licensed under the ISC license. 467 * See the LICENSE file in the root directory of this source tree. 468 */const IJ=mi("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** 469 * @license lucide-react v0.453.0 - ISC 470 * 471 * This source code is licensed under the ISC license. 472 * See the LICENSE file in the root directory of this source tree. 473 */const kJ=mi("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}
473],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** 474 * @license lucide-react v0.453.0 - ISC 475 * 476 * This source code is licensed under the ISC license. 477 * See the LICENSE file in the root directory of this source tree. 478 */const jh=mi("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 479 * @license lucide-react v0.453.0 - ISC 480 * 481 * This source code is licensed under the ISC license. 482 * See the LICENSE file in the root directory of this source tree. 483 */const JT=mi("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** 484 * @license lucide-react v0.453.0 - ISC 485 * 486 * This source code is licensed under the ISC license. 487 * See the LICENSE file in the root directory of this source tree. 488 */const dxe=mi("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** 489 * @license lucide-react v0.453.0 - ISC 490 * 491 * This source code is licensed under the ISC license. 492 * See the LICENSE file in the root directory of this source tree. 493 */const Ij=mi("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 494 * @license lucide-react v0.453.0 - ISC 495 * 496 * This source code is licensed under the ISC license. 497 * See the LICENSE file in the root directory of this source tree. 498 */const D8=mi("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** 499 * @license lucide-react v0.453.0 - ISC 500 * 501 * This source code is licensed under the ISC license. 502 * See the LICENSE file in the root directory of this source tree. 503 */const i1=mi("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** 504 * @license lucide-react v0.453.0 - ISC 505 * 506 * This source code is licensed under the ISC license. 507 * See the LICENSE file in the root directory of this source tree. 508 */const hxe=mi("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** 509 * @license lucide-react v0.453.0 - ISC 510 * 511 * This source code is licensed under the ISC license. 512 * See the LICENSE file in the root directory of this source tree. 513 */const pxe=mi("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** 514 * @license lucide-react v0.453.0 - ISC 515 * 516 * This source code is licensed under the ISC license. 517 * See the LICENSE file in the root directory of this source tree. 518 */const fxe=mi("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** 519 * @license lucide-react v0.453.0 - ISC 520 * 521 * This source code is licensed under the ISC license. 522 * See the LICENSE file in the root directory of this source tree. 523 */const rO=mi("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"}]]);/** 524 * @license lucide-react v0.453.0 - ISC 525 * 526 * This source code is licensed under the ISC license. 527 * See the LICENSE file in the root directory of this source tree.
528 */const QN=mi("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** 529 * @license lucide-react v0.453.0 - ISC 530 * 531 * This source code is licensed under the ISC license. 532 * See the LICENSE file in the root directory of this source tree. 533 */const mxe=mi("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** 534 * @license lucide-react v0.453.0 - ISC 535 * 536 * This source code is licensed under the ISC license. 537 * See the LICENSE file in the root directory of this source tree. 538 */const Ru=mi("Star",[["polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2",key:"8f66p6"}]]);/** 539 * @license lucide-react v0.453.0 - ISC 540 * 541 * This source code is licensed under the ISC license. 542 * See the LICENSE file in the root directory of this source tree. 543 */const Bk=mi("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** 544 * @license lucide-react v0.453.0 - ISC 545 * 546 * This source code is licensed under the ISC license. 547 * See the LICENSE file in the root directory of this source tree. 548 */const PJ=mi("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** 549 * @license lucide-react v0.453.0 - ISC 550 * 551 * This source code is licensed under the ISC license. 552 * See the LICENSE file in the root directory of this source tree. 553 */const R8=mi("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** 554 * @license lucide-react v0.453.0 - ISC 555 * 556 * This source code is licensed under the ISC license. 557 * See the LICENSE file in the root directory of this source tree. 558 */const Ld=mi("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** 559 * @license lucide-react v0.453.0 - ISC 560 * 561 * This source code is licensed under the ISC license. 562 * See the LICENSE file in the root directory of this source tree. 563 */const j8=mi("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** 564 * @license lucide-react v0.453.0 - ISC 565 * 566 * This source code is licensed under the ISC license. 567 * See the LICENSE file in the root directory of this source tree. 568 */const gxe=mi("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 569 * @license lucide-react v0.453.0 - ISC 570 * 571 * This source code is licensed under the ISC license. 572 * See the LICENSE file in the root directory of this source tree. 573 */const yxe=mi("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** 574 * @license lucide-react v0.453.0 - ISC 575 * 576 * This source code is licensed under the ISC license. 577 * See the LICENSE file in the root directory of this source tree. 578 */const _xe=mi("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",ke
vendor: 9,313 bytes, lines 578-618
578y:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** 579 * @license lucide-react v0.453.0 - ISC 580 * 581 * This source code is licensed under the ISC license. 582 * See the LICENSE file in the root directory of this source tree. 583 */const JN=mi("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 584 * @license lucide-react v0.453.0 - ISC 585 * 586 * This source code is licensed under the ISC license. 587 * See the LICENSE file in the root directory of this source tree. 588 */const z8=mi("UserCheck",[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** 589 * @license lucide-react v0.453.0 - ISC 590 * 591 * This source code is licensed under the ISC license. 592 * See the LICENSE file in the root directory of this source tree. 593 */const kj=mi("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** 594 * @license lucide-react v0.453.0 - ISC 595 * 596 * This source code is licensed under the ISC license. 597 * See the LICENSE file in the root directory of this source tree. 598 */const ju=mi("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"}]]);/** 599 * @license lucide-react v0.453.0 - ISC 600 * 601 * This source code is licensed under the ISC license. 602 * See the LICENSE file in the root directory of this source tree. 603 */const Bc=mi("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"}]]);/** 604 * @license lucide-react v0.453.0 - ISC 605 * 606 * This source code is licensed under the ISC license. 607 * See the LICENSE file in the root directory of this source tree. 608 */const Eb=mi("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** 609 * @license lucide-react v0.453.0 - ISC 610 * 611 * This source code is licensed under the ISC license. 612 * See the LICENSE file in the root directory of this source tree. 613 */const eM=mi("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"}]]);/** 614 * @license lucide-react v0.453.0 - ISC 615 * 616 * This source code is licensed under the ISC license. 617 * See the LICENSE file in the root directory of this source tree. 618 */const Fa=mi("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Y3="-",vxe=t=>{const e=bxe(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:f=>{const r=f.split(Y3);return r[0]===""&&r.length!==1&&r.shift(),NJ(r,e)||xxe(f)},getConflictingClassGroupIds:(f,r)=>{const x=i[f]||[];return r&&n[f]?[...x,...n[f]]:x}}},NJ=(t,e)=>{var f;if(t.length===0)return e.classGroupId;const i=t[0],n=e.nextPart.get(i),o=n?NJ(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;const c=t.join(Y3);return(f=e.validators.find(({validator:r})=>r(c)))==null?void 0:f.classGroupId},L8=/^\[(.+)\]$/,xxe=t=>{if(L8.test(t)){const e=L8.exec(t)[1],i=e==null?void 0:e.substring(0,e.indexOf(":"));if(i)return"arbitrary.."+i}},bxe=t=>{const{theme:e,prefix:i}=t,n={nextPart:new Map,validators:[]};return Sxe(Object.entries(t.classGroups),i).forEach(([c,f])=>{sO(f,n,c,e)}),n},sO=(t,e,i,n)=>{t.forEach(o=>{if(typeof o=="string"){const c=o===""?e:O8(e,o);c.classGroupId=i;return}if(typeof o=="function"){if(wxe(o)){sO(o(n),e,i,n);return}e.validators.push({validator:o,classGroupId:i});return}Object.entries(o).forEach(([c,f])=>{sO(f,O8(e,c),i,n)})})},O8=(t,e)=>{let i=t;return e.split(Y3).forEach(n=>{i.nextPart.has(n)||i.nextPart.set(n,{nextPart:new Map,validators:[]}),i=i.nextPart.get(n)}),i},wxe=t=>t.isThemeGetter,Sxe=(t,e)=>e?t.map(([i,n])=>{const o=n.map(c=>typeof c=="string"?e+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([f,r])=>[e+f,r])):c);return[i,o]}):t,Txe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=new Map,n=new Map;const o=(c,f)=>{i.set(c,f),e++,e>t&&(e=0,n=i,i=new Map)};return{get(c){let f=i.get(c);if(f!==void 0)return f;if((f=n.get(c))!==void 0)return o(c,f),f},set(c,f){i.has(c)?i.set(c,f):o(c,f)}}},MJ="!",Cxe=t=>{const{separator:e,experimentalParseClassName:i}=t,n=e.length===1,o=e[0],c=e.length,f=r=>{const x=[];let S=0,C=0,I;for(let W=0;W<r.length;W++){let $=r[W];if(S===0){if($===o&&(n||r.slice(W,W+c)===e)){x.push(r.slice(C,W)),C=W+c;continue}if($==="/"){I=W;continue}}$==="["?S++:$==="]"&&S--}const N=x.length===0?r:r.substring(C),D=N.startsWith(MJ),V=D?N.substring(1):N,B=I&&I>C?I-C:void 0;return{modifiers:x,hasImportantModifier:D,baseClassName:V,maybePostfixModifierPosition:B}};return i?r=>i({className:r,parseClassName:f}):f},Exe=t=>{if(t.length<=1)return t;const e=[];let i=[];return t.forEach(n=>{n[0]==="["?(e.push(...i.sort(),n),i=[]):i.push(n)}),e.push(...i.sort()),e},Axe=t=>({cache:Txe(t.cacheSize),parseClassName:Cxe(t),...vxe(t)}),Ixe=/\s+/,kxe=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:o}=e,c=[],f=t.trim().split(Ixe);let r="";for(let x=f.length-1;x>=0;x-=1){const S=f[x],{modifiers:C,hasImportantModifier:I,baseClassName:N,maybePostfixModifierPosition:D}=i(S);let V=!!D,B=n(V?N.substring(0,D):N);if(!B){if(!V){r=S+(r.length>0?" "+r:r);continue}if(B=n(N),!B){r=S+(r.length>0?" "+r:r);continue}V=!1}const W=Exe(C).join(":"),$=I?W+MJ:W,G=$+B;if(c.includes(G))continue;c.push(G);const te=o(B,V);for(let ce=0;ce<te.length;++ce){const _e=te[ce];c.push($+_e)}r=S+(r.length>0?" "+r:r)}return r};function Pxe(){let t=0,e,i,n="";for(;t<arguments.length;)(e=arguments[t++])&&(i=DJ(e))&&(n&&(n+=" "),n+=i);return n}const DJ=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=DJ(t[n]))&&(i&&(i+=" "),i+=e);return i};function Nxe(t,...e){let i,n,o,c=f;function f(x){const S=e.reduce((C,I)=>I(C),t());return i=Axe(S),n=i.cache.get,o=i.cache.set,c=r,r(x)}function r(x){const S=n(x);if(S)return S;const C=kxe(x,i);return o(x,C),C}return function(){return c(Pxe.apply(null,arguments))}}const so=t=>{const e=i=>i[t]||[];return e.isThemeGetter=!0,e},RJ=/^\[(?:([a-z-]+):)?(.+)\]$/i,Mxe=/^\d+\/\d+$/,Dxe=new Set(["px","full","screen"]),Rxe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jxe=/\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$/,zxe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Lxe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Oxe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sp=t=>C0(t)||Dxe.has(t)||Mxe.test(t),cm=t=>n1(t,"length",Gxe),C0=t=>!!t&&!Number.isNaN(Number(t)),Pj=t=>n1(t,"number",C0),xS=t=>!!t&&Number.isInteger(Number(t)),Fxe=t=>t.endsWith("%")&&C0(t.slice(0,-1)),Dr=t=>RJ.test(t),um=t=>Rxe.test(t),Bxe=new Set(["length","size","percentage"]),Uxe=t=>n1(t,Bxe,jJ),Vxe=t=>n1(t,"position",jJ),$xe=new Set(["image","url"]),qxe=t=>n1(t,$xe,Kxe),Hxe=t=>n1(t,"",Wxe),bS=()=>!0,n1=(t,e,i)=>{const n=RJ.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):i(n[2]):!1},Gxe=t=>jxe.test(t)&&!zxe.test(t),jJ=()=>!1,Wxe=t=>Lxe.test(t),Kxe=t=>Oxe.test(t),Zxe=()=>{const t=so("colors"),e=so("spacing"),i=so("blur"),n=so("brightness"),o=so("borderColor"),c=so("borderRadius"),f=so("borderSpacing"),r=so("borderWidth"),x=so("contrast"),S=so("grayscale"),C=so("hueRotate"),I=so("invert"),N=so("gap"),D=so("gradientColorStops"),V=so("gradientColorStopPositions"),B=so("inset"),W=so("margin"),$=so("opacity"),G=so("padding"),te=so("saturate"),ce=so("scale"),_e=so("sepia"),Te=so("skew"),we=so("space"),Ne=so("translate"),pe=()=>["auto","contain","none"],Pe=()=>["auto","hidden","clip","visible","scroll"],De=()=>["auto",Dr,e],Je=()=>[Dr,e],dt=()=>["",Sp,cm],At=()=>["auto",C0,Dr],qt=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],kt=()=>["solid","dashed","dotted","double","none"],Vt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Fe=()=>["start","end","center","between","around","evenly","stretch"],lt=()=>["","0",Dr],pt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ge=()=>[C0,Dr];return{cacheSize:500,separator:":",theme:{colors:[bS],spacing:[Sp,cm],blur:["none","",um,Dr],brightness:Ge(),borderColor:[t],borderRadius:["none","","full",um,Dr],borderSpacing:Je(),borderWidth:dt(),contrast:Ge(),grayscale:lt(),hueRotate:Ge(),invert:lt(),gap:Je(),gradientColorStops:[t],gradientColorStopPositions:[Fxe,cm],inset:De(),margin:De(),opacity:Ge(),padding:Je(),saturate:Ge(),scale:Ge(),sepia:lt(),skew:Ge(),space:Je(),translate:Je()},classGroups:{aspect:[{aspect:["auto","square","video",Dr]}
vendor: 11,244 bytes, line 618
618],container:["container"],columns:[{columns:[um]}],"break-after":[{"break-after":pt()}],"break-before":[{"break-before":pt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...qt(),Dr]}],overflow:[{overflow:Pe()}],"overflow-x":[{"overflow-x":Pe()}],"overflow-y":[{"overflow-y":Pe()}],overscroll:[{overscroll:pe()}],"overscroll-x":[{"overscroll-x":pe()}],"overscroll-y":[{"overscroll-y":pe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[B]}],"inset-x":[{"inset-x":[B]}],"inset-y":[{"inset-y":[B]}],start:[{start:[B]}],end:[{end:[B]}],top:[{top:[B]}],right:[{right:[B]}],bottom:[{bottom:[B]}],left:[{left:[B]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xS,Dr]}],basis:[{basis:De()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Dr]}],grow:[{grow:lt()}],shrink:[{shrink:lt()}],order:[{order:["first","last","none",xS,Dr]}],"grid-cols":[{"grid-cols":[bS]}],"col-start-end":[{col:["auto",{span:["full",xS,Dr]},Dr]}],"col-start":[{"col-start":At()}],"col-end":[{"col-end":At()}],"grid-rows":[{"grid-rows":[bS]}],"row-start-end":[{row:["auto",{span:[xS,Dr]},Dr]}],"row-start":[{"row-start":At()}],"row-end":[{"row-end":At()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Dr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Dr]}],gap:[{gap:[N]}],"gap-x":[{"gap-x":[N]}],"gap-y":[{"gap-y":[N]}],"justify-content":[{justify:["normal",...Fe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Fe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Fe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[G]}],px:[{px:[G]}],py:[{py:[G]}],ps:[{ps:[G]}],pe:[{pe:[G]}],pt:[{pt:[G]}],pr:[{pr:[G]}],pb:[{pb:[G]}],pl:[{pl:[G]}],m:[{m:[W]}],mx:[{mx:[W]}],my:[{my:[W]}],ms:[{ms:[W]}],me:[{me:[W]}],mt:[{mt:[W]}],mr:[{mr:[W]}],mb:[{mb:[W]}],ml:[{ml:[W]}],"space-x":[{"space-x":[we]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[we]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Dr,e]}],"min-w":[{"min-w":[Dr,e,"min","max","fit"]}],"max-w":[{"max-w":[Dr,e,"none","full","min","max","fit","prose",{screen:[um]},um]}],h:[{h:[Dr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Dr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Dr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Dr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",um,cm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pj]}],"font-family":[{font:[bS]}],"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",Dr]}],"line-clamp":[{"line-clamp":["none",C0,Pj]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sp,Dr]}],"list-image":[{"list-image":["none",Dr]}],"list-style-type":[{list:["none","disc","decimal",Dr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[$]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[$]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...kt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sp,cm]}],"underline-offset":[{"underline-offset":["auto",Sp,Dr]}],"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:Je()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Dr]}],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",Dr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[$]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...qt(),Vxe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Uxe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},qxe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[V]}],"gradient-via-pos":[{via:[V]}],"gradient-to-pos":[{to:[V]}],"gradient-from":[{from:[D]}],"gradient-via":[{via:[D]}],"gradient-to":[{to:[D]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[r]}],"border-w-x":[{"border-x":[r]}],"border-w-y":[{"border-y":[r]}],"border-w-s":[{"border-s":[r]}],"border-w-e":[{"border-e":[r]}],"border-w-t":[{"border-t":[r]}],"border-w-r":[{"border-r":[r]}],"border-w-b":[{"border-b":[r]}],"border-w-l":[{"border-l":[r]}],"border-opacity":[{"border-opacity":[$]}],"border-style":[{border:[...kt(),"hidden"]}],"divide-x":[{"divide-x":[r]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[r]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[$]}],"divide-style":[{divide:kt()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...kt()]}],"outline-offset":[{"outline-offset":[Sp,Dr]}],"outline-w":[{outline:[Sp,cm]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:dt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[$]}],"ring-offset-w":[{"ring-offset":[Sp,cm]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",um,Hxe]}],"shadow-color":[{shadow:[bS]}],opacity:[{opacity:[$]}],"mix-blend":[{"mix-blend":[...Vt(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Vt()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[n]}],contrast:[{contrast:[x]}],"drop-shadow":[{"drop-shadow":["","none",um,Dr]}],grayscale:[{grayscale:[S]}],"hue-rotate":[{"hue-rotate":[C]}],invert:[{invert:[I]}],saturate:[{saturate:[te]}],sepia:[{sepia:[_e]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[x]}],"backdrop-grayscale":[{"backdrop-grayscale":[S]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[C]}],"backdrop-invert":[{"backdrop-invert":[I]}],"backdrop-opacity":[{"backdrop-opacity":[$]}],"backdrop-saturate":[{"backdrop-saturate":[te]}],"backdrop-sepia":[{"backdrop-sepia":[_e]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[f]}],"border-spacing-x":[{"border-spacing-x":[f]}],"border-spacing-y":[{"border-spacing-y":[f]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Dr]}],duration:[{duration:Ge()}],ease:[{ease:["linear","in","out","in-out",Dr]}],delay:[{delay:Ge()}],animate:[{animate:["none","spin","ping","pulse","bounce",Dr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[ce]}],"scale-x":[{"scale-x":[ce]}],"scale-y":[{"scale-y":[ce]}],rotate:[{rotate:[xS,Dr]}],"translate-x":[{"translate-x":[Ne]}],"translate-y":[{"translate-y":[Ne]}],"skew-x":[{"skew-x":[Te]}],"skew-y":[{"skew-y":[Te]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Dr]}],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",Dr]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Je()}],"scroll-mx":[{"scroll-mx":Je()}],"scroll-my":[{"scroll-my":Je()}],"scroll-ms":[{"scroll-ms":Je()}],"scroll-me":[{"scroll-me":Je()}],"scroll-mt":[{"scroll-mt":Je()}],"scroll-mr":[{"scroll-mr":Je()}],"scroll-mb":[{"scroll-mb":Je()}],"scroll-ml":[{"scroll-ml":Je()}],"scroll-p":[{"scroll-p":Je()}],"scroll-px":[{"scroll-px":Je()}],"scroll-py":[{"scroll-py":Je()}],"scroll-ps":[{"scroll-ps":Je()}],"scroll-pe":[{"scroll-pe":Je()}],"scroll-pt":[{"scroll-pt":Je()}],"scroll-pr":[{"scroll-pr":Je()}],"scroll-pb":[{"scroll-pb":Je()}],"scroll-pl":[{"scroll-pl":Je()}],"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"]}
vendor: 4,497 bytes, line 618
618],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",Dr]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sp,cm,Pj]}],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"]}}},Xxe=Nxe(Zxe);function nn(...t){return Xxe(mJ(t))}const Yxe=Pve,zJ=K.forwardRef(({className:t,...e},i)=>d.jsx(lJ,{ref:i,className:nn("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}));zJ.displayName=lJ.displayName;const Qxe=Xb("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"}}),LJ=K.forwardRef(({className:t,variant:e,...i},n)=>d.jsx(cJ,{ref:n,className:nn(Qxe({variant:e}),t),...i}));LJ.displayName=cJ.displayName;const Jxe=K.forwardRef(({className:t,...e},i)=>d.jsx(hJ,{ref:i,className:nn("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 hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));
618Jxe.displayName=hJ.displayName;const OJ=K.forwardRef(({className:t,...e},i)=>d.jsx(pJ,{ref:i,className:nn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:d.jsx(Fa,{className:"h-4 w-4"})}));OJ.displayName=pJ.displayName;const FJ=K.forwardRef(({className:t,...e},i)=>d.jsx(uJ,{ref:i,className:nn("text-sm font-semibold",t),...e}));FJ.displayName=uJ.displayName;const BJ=K.forwardRef(({className:t,...e},i)=>d.jsx(dJ,{ref:i,className:nn("text-sm opacity-90",t),...e}));BJ.displayName=dJ.displayName;function e0e(){const{toasts:t}=ks();return d.jsxs(Yxe,{children:[t.map(function({id:e,title:i,description:n,action:o,...c}){return d.jsxs(LJ,{...c,children:[d.jsxs("div",{className:"grid gap-1",children:[i&&d.jsx(FJ,{children:i}),n&&d.jsx(BJ,{children:n})]}),o,d.jsx(OJ,{})]},e)}),d.jsx(zJ,{})]})}var t0e=pX[" useId ".trim().toString()]||(()=>{}),i0e=0;function nu(t){const[e,i]=K.useState(t0e());return Jo(()=>{i(n=>n??String(i0e++))},[t]),e?`radix-${e}`:""}const n0e=["top","right","bottom","left"],pg=Math.min,Jc=Math.max,Uk=Math.round,YA=Math.floor,Uh=t=>({x:t,y:t}
vendor: 3,690 bytes, line 618
618),r0e={left:"right",right:"left",bottom:"top",top:"bottom"},s0e={start:"end",end:"start"};function oO(t,e,i){return Jc(t,pg(e,i))}function af(t,e){return typeof t=="function"?t(e):t}function lf(t){return t.split("-")[0]}function r1(t){return t.split("-")[1]}function Q3(t){return t==="x"?"y":"x"}function J3(t){return t==="y"?"height":"width"}function fg(t){return["top","bottom"].includes(lf(t))?"y":"x"}function e4(t){return Q3(fg(t))}function o0e(t,e,i){i===void 0&&(i=!1);const n=r1(t),o=e4(t),c=J3(o);let f=o==="x"?n===(i?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(f=Vk(f)),[f,Vk(f)]}function a0e(t){const e=Vk(t);return[aO(t),e,aO(e)]}function aO(t){return t.replace(/start|end/g,e=>s0e[e])}function l0e(t,e,i){const n=["left","right"],o=["right","left"],c=["top","bottom"],f=["bottom","top"];switch(t){case"top":case"bottom":return i?e?o:n:e?n:o;case"left":case"right":return e?c:f;default:return[]}}function c0e(t,e,i,n){const o=r1(t);let c=l0e(lf(t),i==="start",n);return o&&(c=c.map(f=>f+"-"+o),e&&(c=c.concat(c.map(aO)))),c}function Vk(t){return t.replace(/left|right|bottom|top/g,e=>r0e[e])}function u0e(t){return{top:0,right:0,bottom:0,left:0,...t}}function UJ(t){return typeof t!="number"?u0e(t):{top:t,right:t,bottom:t,left:t}}function $k(t){const{x:e,y:i,width:n,height:o}=t;return{width:n,height:o,top:i,left:e,right:e+n,bottom:i+o,x:e,y:i}}function F8(t,e,i){let{reference:n,floating:o}=t;const c=fg(e),f=e4(e),r=J3(f),x=lf(e),S=c==="y",C=n.x+n.width/2-o.width/2,I=n.y+n.height/2-o.height/2,N=n[r]/2-o[r]/2;let D;switch(x){case"top":D={x:C,y:n.y-o.height};break;case"bottom":D={x:C,y:n.y+n.height};break;case"right":D={x:n.x+n.width,y:I};break;case"left":D={x:n.x-o.width,y:I};break;default:D={x:n.x,y:n.y}}switch(r1(e)){case"start":D[f]-=N*(i&&S?-1:1);break;case"end":D[f]+=N*(i&&S?-1:1);break}return D}const d0e=async(t,e,i)=>{const{placement:n="bottom",strategy:o="absolute",middleware:c=[],platform:f}=i,r=c.filter(Boolean),x=await(f.isRTL==null?void 0:f.isRTL(e));let S=await f.getElementRects({reference:t,floating:e,strategy:o}),{x:C,y:I}=F8(S,n,x),N=n,D={},V=0;for(let B=0;B<r.length;B++){const{name:W,fn:$}=r[B],{x:G,y:te,data:ce,reset:_e}=await $({x:C,y:I,initialPlacement:n,placement:N,strategy:o,middlewareData:D,rects:S,platform:f,elements:{reference:t,floating:e}});C=G??C,I=te??I,D={...D,[W]:{...D[W],...ce}},_e&&V<=50&&(V++,typeof _e=="object"&&(_e.placement&&(N=_e.placement),_e.rects&&(S=_e.rects===!0?await f.getElementRects({reference:t,floating:e,strategy:o}):_e.rects),{x:C,y:I}=F8(S,N,x)),B=-1)}return{x:C,y:I,placement:N,strategy:o,middlewareData:D}};async function eC(t,e){var i;e===void 0&&(e={});const{x:n,y:o,platform:c,rects:f,elements:r,strategy:x}=t,{boundary:S="clippingAncestors",rootBoundary:C="viewport",elementContext:I="floating",altBoundary:N=!1,padding:D=0}=af(e,t),V=UJ(D),W=r[N?I==="floating"?"reference":"floating":I],$=$k(await c.getClippingRect({element:(i=await(c.isElement==null?void 0:c.isElement(W)))==null||i?W:W.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(r.floating)),boundary:S,rootBoundary:C,strategy:x})),G=I==="floating"?{x:n,y:o,width:f.floating.width,height:f.floating.height}:f.reference,te=await(c.getOffsetParent==null?void 0:c.getOffsetParent(r.floating)),ce=await(c.isElement==null?void 0:c.isElement(te))?await(c.getScale==null?void 0:c.getScale(te))||{x:1,y:1}:{x:1,y:1},_e=$k(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:G,offsetParent:te,strategy:x}):G);return{top:($.top-_e.top+V.top)/ce.y,bottom:(_e.bottom-$.bottom+V.bottom)/ce.
vendor: 8,286 bytes, line 618
618y,left:($.left-_e.left+V.left)/ce.x,right:(_e.right-$.right+V.right)/ce.x}}const h0e=t=>({name:"arrow",options:t,async fn(e){const{x:i,y:n,placement:o,rects:c,platform:f,elements:r,middlewareData:x}=e,{element:S,padding:C=0}=af(t,e)||{};if(S==null)return{};const I=UJ(C),N={x:i,y:n},D=e4(o),V=J3(D),B=await f.getDimensions(S),W=D==="y",$=W?"top":"left",G=W?"bottom":"right",te=W?"clientHeight":"clientWidth",ce=c.reference[V]+c.reference[D]-N[D]-c.floating[V],_e=N[D]-c.reference[D],Te=await(f.getOffsetParent==null?void 0:f.getOffsetParent(S));let we=Te?Te[te]:0;(!we||!await(f.isElement==null?void 0:f.isElement(Te)))&&(we=r.floating[te]||c.floating[V]);const Ne=ce/2-_e/2,pe=we/2-B[V]/2-1,Pe=pg(I[$],pe),De=pg(I[G],pe),Je=Pe,dt=we-B[V]-De,At=we/2-B[V]/2+Ne,qt=oO(Je,At,dt),kt=!x.arrow&&r1(o)!=null&&At!==qt&&c.reference[V]/2-(At<Je?Pe:De)-B[V]/2<0,Vt=kt?At<Je?At-Je:At-dt:0;return{[D]:N[D]+Vt,data:{[D]:qt,centerOffset:At-qt-Vt,...kt&&{alignmentOffset:Vt}},reset:kt}}}),p0e=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var i,n;const{placement:o,middlewareData:c,rects:f,initialPlacement:r,platform:x,elements:S}=e,{mainAxis:C=!0,crossAxis:I=!0,fallbackPlacements:N,fallbackStrategy:D="bestFit",fallbackAxisSideDirection:V="none",flipAlignment:B=!0,...W}=af(t,e);if((i=c.arrow)!=null&&i.alignmentOffset)return{};const $=lf(o),G=fg(r),te=lf(r)===r,ce=await(x.isRTL==null?void 0:x.isRTL(S.floating)),_e=N||(te||!B?[Vk(r)]:a0e(r)),Te=V!=="none";!N&&Te&&_e.push(...c0e(r,B,V,ce));const we=[r,..._e],Ne=await eC(e,W),pe=[];let Pe=((n=c.flip)==null?void 0:n.overflows)||[];if(C&&pe.push(Ne[$]),I){const At=o0e(o,f,ce);pe.push(Ne[At[0]],Ne[At[1]])}if(Pe=[...Pe,{placement:o,overflows:pe}],!pe.every(At=>At<=0)){var De,Je;const At=(((De=c.flip)==null?void 0:De.index)||0)+1,qt=we[At];if(qt)return{data:{index:At,overflows:Pe},reset:{placement:qt}};let kt=(Je=Pe.filter(Vt=>Vt.overflows[0]<=0).sort((Vt,Fe)=>Vt.overflows[1]-Fe.overflows[1])[0])==null?void 0:Je.placement;if(!kt)switch(D){case"bestFit":{var dt;const Vt=(dt=Pe.filter(Fe=>{if(Te){const lt=fg(Fe.placement);return lt===G||lt==="y"}return!0}).map(Fe=>[Fe.placement,Fe.overflows.filter(lt=>lt>0).reduce((lt,pt)=>lt+pt,0)]).sort((Fe,lt)=>Fe[1]-lt[1])[0])==null?void 0:dt[0];Vt&&(kt=Vt);break}case"initialPlacement":kt=r;break}if(o!==kt)return{reset:{placement:kt}}}return{}}}};function B8(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function U8(t){return n0e.some(e=>t[e]>=0)}const f0e=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:i}=e,{strategy:n="referenceHidden",...o}=af(t,e);switch(n){case"referenceHidden":{const c=await eC(e,{...o,elementContext:"reference"}),f=B8(c,i.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:U8(f)}}}case"escaped":{const c=await eC(e,{...o,altBoundary:!0}),f=B8(c,i.floating);return{data:{escapedOffsets:f,escaped:U8(f)}}}default:return{}}}}};async function m0e(t,e){const{placement:i,platform:n,elements:o}=t,c=await(n.isRTL==null?void 0:n.isRTL(o.floating)),f=lf(i),r=r1(i),x=fg(i)==="y",S=["left","top"].includes(f)?-1:1,C=c&&x?-1:1,I=af(e,t);let{mainAxis:N,crossAxis:D,alignmentAxis:V}=typeof I=="number"?{mainAxis:I,crossAxis:0,alignmentAxis:null}:{mainAxis:I.mainAxis||0,crossAxis:I.crossAxis||0,alignmentAxis:I.alignmentAxis};return r&&typeof V=="number"&&(D=r==="end"?V*-1:V),x?{x:D*C,y:N*S}:{x:N*S,y:D*C}}const g0e=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var i,n;const{x:o,y:c,placement:f,middlewareData:r}=e,x=await m0e(e,t);return f===((i=r.offset)==null?void 0:i.placement)&&(n=r.arrow)!=null&&n.alignmentOffset?{}:{x:o+x.x,y:c+x.y,data:{...x,placement:f}}}}},y0e=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:i,y:n,placement:o}=e,{mainAxis:c=!0,crossAxis:f=!1,limiter:r={fn:W=>{let{x:$,y:G}=W;return{x:$,y:G}}},...x}=af(t,e),S={x:i,y:n},C=await eC(e,x),I=fg(lf(o)),N=Q3(I);let D=S[N],V=S[I];if(c){const W=N==="y"?"top":"left",$=N==="y"?"bottom":"right",G=D+C[W],te=D-C[$];D=oO(G,D,te)}if(f){const W=I==="y"?"top":"left",$=I==="y"?"bottom":"right",G=V+C[W],te=V-C[$];V=oO(G,V,te)}const B=r.fn({...e,[N]:D,[I]:V});return{...B,data:{x:B.x-i,y:B.y-n,enabled:{[N]:c,[I]:f}}}}}},_0e=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:i,y:n,placement:o,rects:c,middlewareData:f}=e,{offset:r=0,mainAxis:x=!0,crossAxis:S=!0}=af(t,e),C={x:i,y:n},I=fg(o),N=Q3(I);let D=C[N],V=C[I];const B=af(r,e),W=typeof B=="number"?{mainAxis:B,crossAxis:0}:{mainAxis:0,crossAxis:0,...B};if(x){const te=N==="y"?"height":"width",ce=c.reference[N]-c.floating[te]+W.mainAxis,_e=c.reference[N]+c.reference[te]-W.mainAxis;D<ce?D=ce:D>_e&&(D=_e)}if(S){var $,G;const te=N==="y"?"width":"height",ce=["top","left"].includes(lf(o)),_e=c.reference[I]-c.floating[te]+(ce&&(($=f.offset)==null?void 0:$[I])||0)+(ce?0:W.crossAxis),Te=c.reference[I]+c.reference[te]+(ce?0:((G=f.offset)==null?void 0:G[I])||0)-(ce?W.crossAxis:0);V<_e?V=_e:V>Te&&(V=Te)}return{[N]:D,[I]:V}}}},v0e=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var i,n;const{placement:o,rects:c,platform:f,elements:r}=e,{apply:x=()=>{},...S}=af(t,e),C=await eC(e,S),I=lf(o),N=r1(o),D=fg(o)==="y",{width:V,height:B}=c.floating;let W,$;I==="top"||I==="bottom"?(W=I,$=N===(await(f.isRTL==null?void 0:f.isRTL(r.floating))?"start":"end")?"left":"right"):($=I,W=N==="end"?"top":"bottom");const G=B-C.top-C.bottom,te=V-C.left-C.right,ce=pg(B-C[W],G),_e=pg(V-C[$],te),Te=!e.middlewareData.shift;let we=ce,Ne=_e;if((i=e.middlewareData.shift)!=null&&i.enabled.x&&(Ne=te),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(we=G),Te&&!N){const Pe=Jc(C.left,0),De=Jc(C.right,0),Je=Jc(C.top,0),dt=Jc(C.bottom,0);D?Ne=V-2*(Pe!==0||De!==0?Pe+De:Jc(C.left,C.right)):we=B-2*(Je!==0||dt!==0?Je+dt:Jc(C.top,C.bottom))}await x({...e,availableWidth:Ne,availableHeight:we});const pe=await f.getDimensions(r.floating);return V!==pe.width||B!==pe.height?{reset:{rects:!0}}:{}}}};function tM(){return typeof window<"u"}function s1(t){return VJ(t)?(t.nodeName||"").toLowerCase():"#document"}function ru(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Yh(t){var e;return(e=(VJ(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function VJ(t){return tM()?t instanceof Node||t instanceof ru(t).Node:!1}function Od(t){return tM()?t instanceof Element||t instanceof ru(t).Element:!1}function Hh(t){return tM()?t instanceof HTMLElement||t instanceof ru(t).HTMLElement:!1}function V8(t){return!tM()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ru(t).ShadowRoot}function pE(t){const{overflow:e,overflowX:i,overflowY:n,display:o}=Fd(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+i)&&!["inline","contents"].includes(o)}function x0e(t){return["table","td","th"].includes(s1(t))}function iM(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function t4(t){const e=i4(),i=Od(t)?Fd(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>i[n]?i[n]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!e&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!e&&(i.filter?i.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(i.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(i.contain||"").includes(n))}function b0e(t){let e=mg(t);for(;Hh(e)&&!Ab(e);){if(t4(e))return e;if(iM(e))return null;e=mg(e)}return null}function i4(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ab(t){return["html","body","#document"].includes(s1(t))}function Fd(t){return ru(t).getComputedStyle(t)}function nM(t){return Od(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function mg(t){if(s1(t)==="html")return t;const e=t.assignedSlot||t.parentNode||V8(t)&&t.host||Yh(t);return V8(e)?e.host:e}function $J(t){const e=mg(t);return Ab(e)?t.ownerDocument?t.ownerDocument.body:t.body:Hh(e)&&pE(e)?e:$J(e)}function tC(t,e,i){var n;e===void 0&&(e=[]),i===void 0&&(i=!0);const o=$J(t),c=o===((n=t.ownerDocument)==null?void 0:n.body),f=ru(o);if(c){const r=lO(f);
vendor: 4,127 bytes, line 618
618return e.concat(f,f.visualViewport||[],pE(o)?o:[],r&&i?tC(r):[])}return e.concat(o,tC(o,[],i))}function lO(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function qJ(t){const e=Fd(t);let i=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const o=Hh(t),c=o?t.offsetWidth:i,f=o?t.offsetHeight:n,r=Uk(i)!==c||Uk(n)!==f;return r&&(i=c,n=f),{width:i,height:n,$:r}}function n4(t){return Od(t)?t:t.contextElement}function E0(t){const e=n4(t);if(!Hh(e))return Uh(1);const i=e.getBoundingClientRect(),{width:n,height:o,$:c}=qJ(e);let f=(c?Uk(i.width):i.width)/n,r=(c?Uk(i.height):i.height)/o;return(!f||!Number.isFinite(f))&&(f=1),(!r||!Number.isFinite(r))&&(r=1),{x:f,y:r}}const w0e=Uh(0);function HJ(t){const e=ru(t);return!i4()||!e.visualViewport?w0e:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function S0e(t,e,i){return e===void 0&&(e=!1),!i||e&&i!==ru(t)?!1:e}function U_(t,e,i,n){e===void 0&&(e=!1),i===void 0&&(i=!1);const o=t.getBoundingClientRect(),c=n4(t);let f=Uh(1);e&&(n?Od(n)&&(f=E0(n)):f=E0(t));const r=S0e(c,i,n)?HJ(c):Uh(0);let x=(o.left+r.x)/f.x,S=(o.top+r.y)/f.y,C=o.width/f.x,I=o.height/f.y;if(c){const N=ru(c),D=n&&Od(n)?ru(n):n;let V=N,B=lO(V);for(;B&&n&&D!==V;){const W=E0(B),$=B.getBoundingClientRect(),G=Fd(B),te=$.left+(B.clientLeft+parseFloat(G.paddingLeft))*W.x,ce=$.top+(B.clientTop+parseFloat(G.paddingTop))*W.y;x*=W.x,S*=W.y,C*=W.x,I*=W.y,x+=te,S+=ce,V=ru(B),B=lO(V)}}return $k({width:C,height:I,x,y:S})}function r4(t,e){const i=nM(t).scrollLeft;return e?e.left+i:U_(Yh(t)).left+i}function GJ(t,e,i){i===void 0&&(i=!1);const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-(i?0:r4(t,n)),c=n.top+e.scrollTop;return{x:o,y:c}}function T0e(t){let{elements:e,rect:i,offsetParent:n,strategy:o}=t;const c=o==="fixed",f=Yh(n),r=e?iM(e.floating):!1;if(n===f||r&&c)return i;let x={scrollLeft:0,scrollTop:0},S=Uh(1);const C=Uh(0),I=Hh(n);if((I||!I&&!c)&&((s1(n)!=="body"||pE(f))&&(x=nM(n)),Hh(n))){const D=U_(n);S=E0(n),C.x=D.x+n.clientLeft,C.y=D.y+n.clientTop}const N=f&&!I&&!c?GJ(f,x,!0):Uh(0);return{width:i.width*S.x,height:i.height*S.y,x:i.x*S.x-x.scrollLeft*S.x+C.x+N.x,y:i.y*S.y-x.scrollTop*S.y+C.y+N.y}}function C0e(t){return Array.from(t.getClientRects())}function E0e(t){const e=Yh(t),i=nM(t),n=t.ownerDocument.body,o=Jc(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),c=Jc(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let f=-i.scrollLeft+r4(t);const r=-i.scrollTop;return Fd(n).direction==="rtl"&&(f+=Jc(e.clientWidth,n.clientWidth)-o),{width:o,height:c,x:f,y:r}}function A0e(t,e){const i=ru(t),n=Yh(t),o=i.visualViewport;let c=n.clientWidth,f=n.clientHeight,r=0,x=0;if(o){c=o.width,f=o.height;const S=i4();(!S||S&&e==="fixed")&&(r=o.offsetLeft,x=o.offsetTop)}return{width:c,height:f,x:r,y:x}}function I0e(t,e){const i=U_(t,!0,e==="fixed"),n=i.top+t.clientTop,o=i.left+t.clientLeft,c=Hh(t)?E0(t):Uh(1),f=t.clientWidth*c.x,r=t.clientHeight*c.y,x=o*c.x,S=n*c.y;return{width:f,height:r,x,y:S}}function $8(t,e,i){let n;if(e==="viewport")n=A0e(t,i);else if(e==="document")n=E0e(Yh(t));else if(Od(e))n=I0e(e,i);else{const o=HJ(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return $k(n)}function WJ(t,e){const i=mg(t);return i===e||!Od(i)||Ab(i)?!1:Fd(i).position==="fixed"||WJ(i,e)}function k0e(t,e){const i=e.get(t);if(i)return i;let n=tC(t,[],!1).filter(r=>Od(r)&&s1(r)!=="body"),o=null;const c=Fd(t).position==="fixed";let f=c?mg(t):t;for(;Od(f)&&!Ab(f);){const r=Fd(f),x=t4(f);!x&&r.position==="fixed"&&(o=null),(c?!x&&!o:!x&&r.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||pE(f)&&!x&&WJ(t,f))?n=n.filter(C=>C!==f):o=r,f=mg(f)}return e.set(t,n),n}function P0e(t){let{element:e,boundary:i,rootBoundary:n,strategy:o}=t;const f=[...i==="clippingAncestors"?iM(e)?[]:k0e(e,this._c):[].concat(i),n],r=f[0],x=f.reduce((S,C)=>{const I=$8(e,C,o);return S.top=Jc(I.top,S.top),S.right=pg(I.right,S.right),S.bottom=pg(I.bottom,S.bottom),S.left=Jc(I.left,S.left),S},$8(e,r,o));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function N0e(t){const{width:e,height:i}=qJ(t);return{width:e,height:i}}
vendor: 10,012 bytes, line 618
618function M0e(t,e,i){const n=Hh(e),o=Yh(e),c=i==="fixed",f=U_(t,!0,c,e);let r={scrollLeft:0,scrollTop:0};const x=Uh(0);if(n||!n&&!c)if((s1(e)!=="body"||pE(o))&&(r=nM(e)),n){const N=U_(e,!0,c,e);x.x=N.x+e.clientLeft,x.y=N.y+e.clientTop}else o&&(x.x=r4(o));const S=o&&!n&&!c?GJ(o,r):Uh(0),C=f.left+r.scrollLeft-x.x-S.x,I=f.top+r.scrollTop-x.y-S.y;return{x:C,y:I,width:f.width,height:f.height}}function Nj(t){return Fd(t).position==="static"}function q8(t,e){if(!Hh(t)||Fd(t).position==="fixed")return null;if(e)return e(t);let i=t.offsetParent;return Yh(t)===i&&(i=i.ownerDocument.body),i}function KJ(t,e){const i=ru(t);if(iM(t))return i;if(!Hh(t)){let o=mg(t);for(;o&&!Ab(o);){if(Od(o)&&!Nj(o))return o;o=mg(o)}return i}let n=q8(t,e);for(;n&&x0e(n)&&Nj(n);)n=q8(n,e);return n&&Ab(n)&&Nj(n)&&!t4(n)?i:n||b0e(t)||i}const D0e=async function(t){const e=this.getOffsetParent||KJ,i=this.getDimensions,n=await i(t.floating);return{reference:M0e(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function R0e(t){return Fd(t).direction==="rtl"}const j0e={convertOffsetParentRelativeRectToViewportRelativeRect:T0e,getDocumentElement:Yh,getClippingRect:P0e,getOffsetParent:KJ,getElementRects:D0e,getClientRects:C0e,getDimensions:N0e,getScale:E0,isElement:Od,isRTL:R0e};function ZJ(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function z0e(t,e){let i=null,n;const o=Yh(t);function c(){var r;clearTimeout(n),(r=i)==null||r.disconnect(),i=null}function f(r,x){r===void 0&&(r=!1),x===void 0&&(x=1),c();const S=t.getBoundingClientRect(),{left:C,top:I,width:N,height:D}=S;if(r||e(),!N||!D)return;const V=YA(I),B=YA(o.clientWidth-(C+N)),W=YA(o.clientHeight-(I+D)),$=YA(C),te={rootMargin:-V+"px "+-B+"px "+-W+"px "+-$+"px",threshold:Jc(0,pg(1,x))||1};let ce=!0;function _e(Te){const we=Te[0].intersectionRatio;if(we!==x){if(!ce)return f();we?f(!1,we):n=setTimeout(()=>{f(!1,1e-7)},1e3)}we===1&&!ZJ(S,t.getBoundingClientRect())&&f(),ce=!1}try{i=new IntersectionObserver(_e,{...te,root:o.ownerDocument})}catch{i=new IntersectionObserver(_e,te)}i.observe(t)}return f(!0),c}function L0e(t,e,i,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:x=!1}=n,S=n4(t),C=o||c?[...S?tC(S):[],...tC(e)]:[];C.forEach($=>{o&&$.addEventListener("scroll",i,{passive:!0}),c&&$.addEventListener("resize",i)});const I=S&&r?z0e(S,i):null;let N=-1,D=null;f&&(D=new ResizeObserver($=>{let[G]=$;G&&G.target===S&&D&&(D.unobserve(e),cancelAnimationFrame(N),N=requestAnimationFrame(()=>{var te;(te=D)==null||te.observe(e)})),i()}),S&&!x&&D.observe(S),D.observe(e));let V,B=x?U_(t):null;x&&W();function W(){const $=U_(t);B&&!ZJ(B,$)&&i(),B=$,V=requestAnimationFrame(W)}return i(),()=>{var $;C.forEach(G=>{o&&G.removeEventListener("scroll",i),c&&G.removeEventListener("resize",i)}),I==null||I(),($=D)==null||$.disconnect(),D=null,x&&cancelAnimationFrame(V)}}const O0e=g0e,F0e=y0e,B0e=p0e,U0e=v0e,V0e=f0e,H8=h0e,$0e=_0e,q0e=(t,e,i)=>{const n=new Map,o={platform:j0e,...i},c={...o.platform,_c:n};return d0e(t,e,{...o,platform:c})};var WI=typeof document<"u"?K.useLayoutEffect:K.useEffect;function qk(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 i,n,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(i=t.length,i!==e.length)return!1;for(n=i;n--!==0;)if(!qk(t[n],e[n]))return!1;return!0}if(o=Object.keys(t),i=o.length,i!==Object.keys(e).length)return!1;for(n=i;n--!==0;)if(!{}.hasOwnProperty.call(e,o[n]))return!1;for(n=i;n--!==0;){const c=o[n];if(!(c==="_owner"&&t.$$typeof)&&!qk(t[c],e[c]))return!1}return!0}return t!==t&&e!==e}function XJ(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function G8(t,e){const i=XJ(t);return Math.round(e*i)/i}function Mj(t){const e=K.useRef(t);return WI(()=>{e.current=t}),e}function H0e(t){t===void 0&&(t={});const{placement:e="bottom",strategy:i="absolute",middleware:n=[],platform:o,elements:{reference:c,floating:f}={},transform:r=!0,whileElementsMounted:x,open:S}=t,[C,I]=K.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[N,D]=K.useState(n);qk(N,n)||D(n);const[V,B]=K.useState(null),[W,$]=K.useState(null),G=K.useCallback(Fe=>{Fe!==Te.current&&(Te.current=Fe,B(Fe))},[]),te=K.useCallback(Fe=>{Fe!==we.current&&(we.current=Fe,$(Fe))},[]),ce=c||V,_e=f||W,Te=K.useRef(null),we=K.useRef(null),Ne=K.useRef(C),pe=x!=null,Pe=Mj(x),De=Mj(o),Je=Mj(S),dt=K.useCallback(()=>{if(!Te.current||!we.current)return;const Fe={placement:e,strategy:i,middleware:N};De.current&&(Fe.platform=De.current),q0e(Te.current,we.current,Fe).then(lt=>{const pt={...lt,isPositioned:Je.current!==!1};At.current&&!qk(Ne.current,pt)&&(Ne.current=pt,ov.flushSync(()=>{I(pt)}))})},[N,e,i,De,Je]);WI(()=>{S===!1&&Ne.current.isPositioned&&(Ne.current.isPositioned=!1,I(Fe=>({...Fe,isPositioned:!1})))},[S]);const At=K.useRef(!1);WI(()=>(At.current=!0,()=>{At.current=!1}),[]),WI(()=>{if(ce&&(Te.current=ce),_e&&(we.current=_e),ce&&_e){if(Pe.current)return Pe.current(ce,_e,dt);dt()}},[ce,_e,dt,Pe,pe]);const qt=K.useMemo(()=>({reference:Te,floating:we,setReference:G,setFloating:te}),[G,te]),kt=K.useMemo(()=>({reference:ce,floating:_e}),[ce,_e]),Vt=K.useMemo(()=>{const Fe={position:i,left:0,top:0};if(!kt.floating)return Fe;const lt=G8(kt.floating,C.x),pt=G8(kt.floating,C.y);return r?{...Fe,transform:"translate("+lt+"px, "+pt+"px)",...XJ(kt.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:lt,top:pt}},[i,r,kt.floating,C.x,C.y]);return K.useMemo(()=>({...C,update:dt,refs:qt,elements:kt,floatingStyles:Vt}),[C,dt,qt,kt,Vt])}const G0e=t=>{function e(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:t,fn(i){const{element:n,padding:o}=typeof t=="function"?t(i):t;return n&&e(n)?n.current!=null?H8({element:n.current,padding:o}).fn(i):{}:n?H8({element:n,padding:o}).fn(i):{}}}},W0e=(t,e)=>({...O0e(t),options:[t,e]}),K0e=(t,e)=>({...F0e(t),options:[t,e]}),Z0e=(t,e)=>({...$0e(t),options:[t,e]}),X0e=(t,e)=>({...B0e(t),options:[t,e]}),Y0e=(t,e)=>({...U0e(t),options:[t,e]}),Q0e=(t,e)=>({...V0e(t),options:[t,e]}),J0e=(t,e)=>({...G0e(t),options:[t,e]});var ebe="Arrow",YJ=K.forwardRef((t,e)=>{const{children:i,width:n=10,height:o=5,...c}=t;return d.jsx(vn.svg,{...c,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?i:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});YJ.displayName=ebe;var tbe=YJ;function s4(t){const[e,i]=K.useState(void 0);return Jo(()=>{if(t){i({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const c=o[0];let f,r;if("borderBoxSize"in c){const x=c.borderBoxSize,S=Array.isArray(x)?x[0]:x;f=S.inlineSize,r=S.blockSize}else f=t.offsetWidth,r=t.offsetHeight;i({width:f,height:r})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else i(void 0)},[t]),e}var o4="Popper",[QJ,Dg]=Wa(o4),[ibe,JJ]=QJ(o4),eee=t=>{const{__scopePopper:e,children:i}=t,[n,o]=K.useState(null);return d.jsx(ibe,{scope:e,anchor:n,onAnchorChange:o,children:i})};eee.displayName=o4;var tee="PopperAnchor",iee=K.forwardRef((t,e)=>{const{__scopePopper:i,virtualRef:n,...o}=t,c=JJ(tee,i),f=K.useRef(null),r=wr(e,f);return K.useEffect(()=>{c.onAnchorChange((n==null?void 0:n.current)||f.current)}),n?null:d.jsx(vn.div,{...o,ref:r})});iee.displayName=tee;var a4="PopperContent",[nbe,rbe]=QJ(a4),nee=K.forwardRef((t,e)=>{var si,Oi,Ei,Ai,Xi,Nn;const{__scopePopper:i,side:n="bottom",sideOffset:o=0,align:c="center",alignOffset:f=0,arrowPadding:r=0,avoidCollisions:x=!0,collisionBoundary:S=[],collisionPadding:C=0,sticky:I="partial",hideWhenDetached:N=!1,updatePositionStrategy:D="optimized",onPlaced:V,...B}=t,W=JJ(a4,i),[$,G]=K.useState(null),te=wr(e,zi=>G(zi)),[ce,_e]=K.useState(null),Te=s4(ce),we=(Te==null?void 0:Te.width)??0,Ne=(Te==null?void 0:Te.height)??0,pe=n+(c!=="center"?"-"+c:""),Pe=typeof C=="number"?C:{top:0,right:0,bottom:0,left:0,...C},De=Array.isArray(S)?S:[S],Je=De.length>0,dt={padding:Pe,boundary:De.filter(obe),altBoundary:Je},{refs:At,floatingStyles:qt,placement:kt,isPositioned:Vt,middlewareData:Fe}=H0e({strategy:"fixed",placement:pe,whileElementsMounted:(...zi)=>L0e(...zi,{animationFrame:D==="always"}),elements:{reference:W.anchor},middleware:[W0e({mainAxis:o+Ne,alignmentAxis:f}),x&&K0e({mainAxis:!0,crossAxis:!1,limiter:I==="partial"?Z0e():void 0,...dt}),x&&X0e({...dt}),Y0e({...dt,apply:({elements:zi,rects:Gi,availableWidth:Sr,availableHeight:Kr})=>{const{width:rs,height:Yn}=Gi.reference,Ys=zi.floating.style;Ys.setProperty("--radix-popper-available-width",`${Sr}px`),Ys.setProperty("--radix-popper-available-height",`${Kr}px`),Ys.setProperty("--radix-popper-anchor-width",`${rs}px`),Ys.setProperty("--radix-popper-anchor-height",`${Yn}px`)}}),ce&&J0e({element:ce,padding:r}),abe({arrowWidth:we,arrowHeight:Ne}),N&&Q0e({strategy:"referenceHidden",...dt})]}),[lt,pt]=oee(kt),Ge=go(V);Jo(()=>{Vt&&(Ge==null||Ge())},[Vt,Ge]);const Rt=(si=Fe.arrow)==null?void 0:si.x,Ot=(Oi=Fe.arrow)==null?void 0:Oi.y,Ci=((Ei=Fe.arrow)==null?void 0:Ei.centerOffset)!==0,[Hi,ei]=K.useState();return Jo(()=>{$&&ei(window.getComputedStyle($).zIndex)},[$]),d.jsx("div",{ref:At.setFloating,"data-radix-popper-content-wrapper":"",style:{...qt,transform:Vt?qt.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Hi,"--radix-popper-transform-origin":[(Ai=Fe.transformOrigin)==null?void 0:Ai.x,(Xi=Fe.transformOrigin)==null?void 0:Xi.y].join(" "),...((Nn=Fe.hide)==null?void 0:Nn.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(nbe,{scope:i,placedSide:lt,onArrowChange:_e,arrowX:Rt,arrowY:Ot,shouldHideArrow:Ci,children:d.jsx(vn.div,{"data-side":lt,"data-align":pt,...B,ref:te,style:{...B.style,animation:Vt?void 0:"none"}})})})});nee.displayName=a4;var ree="PopperArrow",sbe={top:"bottom",right:"left",bottom:"top",left:"r
618ight"},see=K.forwardRef(function(e,i){const{__scopePopper:n,...o}=e,c=rbe(ree,n),f=sbe[c.placedSide];return d.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:d.jsx(tbe,{...o,ref:i,style:{...o.style,display:"block"}})})});see.displayName=ree;function obe(t){return t!==null}var abe=t=>({name:"transformOrigin",options:t,fn(e){var W,$,G;const{placement:i,rects:n,middlewareData:o}=e,f=((W=o.arrow)==null?void 0:W.centerOffset)!==0,r=f?0:t.arrowWidth,x=f?0:t.arrowHeight,[S,C]=oee(i),I={start:"0%",center:"50%",end:"100%"}[C],N=((($=o.arrow)==null?void 0:$.x)??0)+r/2,D=(((G=o.arrow)==null?void 0:G.y)??0)+x/2;let V="",B="";return S==="bottom"?(V=f?I:`${N}px`,B=`${-x}px`):S==="top"?(V=f?I:`${N}px`,B=`${n.floating.height+x}px`):S==="right"?(V=`${-x}px`,B=f?I:`${D}px`):S==="left"&&(V=`${n.floating.width+x}px`,B=f?I:`${D}px`),{data:{x:V,y:B}}}});function oee(t){const[e,i="center"]=t.split("-");return[e,i]}var l4=eee,fE=iee,rM=nee,sM=see,[oM,T8e]=Wa("Tooltip",[Dg]),c4=Dg(),aee="TooltipProvider",lbe=700,W8="tooltip.open",[cbe,lee]=oM(aee),cee=t=>{const{__scopeTooltip:e,delayDuration:i=lbe,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:c}=t,f=K.useRef(!0),r=K.useRef(!1),x=K.useRef(0);return K.useEffect(()=>{const S=x.current;return()=>window.clearTimeout(S)},[]),d.jsx(cbe,{scope:e,isOpenDelayedRef:f,delayDuration:i,onOpen:K.useCallback(()=>{window.clearTimeout(x.current),f.current=!1},[]),onClose:K.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>f.current=!0,n)},[n]),isPointerInTransitRef:r,onPointerInTransitChange:K.useCallback(S=>{r.current=S},[]),disableHoverableContent:o,children:c})};cee.displayName=aee;var uee="Tooltip",[C8e,aM]=oM(uee),cO="TooltipTrigger",ube=K.forwardRef((t,e)=>{const{__scopeTooltip:i,...n}=t,o=aM(cO,i),c=lee(cO,i),f=c4(i),r=K.useRef(null),x=wr(e,r,o.onTriggerChange),S=K.useRef(!1),C=K.useRef(!1),I=K.useCallback(()=>S.current=!1,[]);return K.useEffect(()=>()=>document.removeEventListener("pointerup",I),[I]),d.jsx(fE,{asChild:!0,...f,children:d.jsx(vn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:x,onPointerMove:Ni(t.onPointerMove,N=>{N.pointerType!=="touch"&&!C.current&&!c.isPointerInTransitRef.current&&(o.onTriggerEnter(),C.current=!0)}),onPointerLeave:Ni(t.onPointerLeave,()=>{o.onTriggerLeave(),C.current=!1}),onPointerDown:Ni(t.onPointerDown,()=>{o.open&&o.onClose(),S.current=!0,document.addEventListener("pointerup",I,{once:!0})}),onFocus:Ni(t.onFocus,()=>{S.current||o.onOpen()}),onBlur:Ni(t.onBlur,o.onClose),onClick:Ni(t.onClick,o.onClose)})})});ube.displayName=cO;var dbe="TooltipPortal",[E8e,hbe]=oM(dbe,{forceMount:void 0}),Ib="TooltipContent",dee=K.forwardRef((t,e)=>{const i=hbe(Ib,t.__scopeTooltip),{forceMount:n=i.forceMount,side:o="top",...c}=t,f=aM(Ib,t.__scopeTooltip);return d.jsx(Ea,{present:n||f.open,children:f.disableHoverableContent?d.jsx(hee,{side:o,...c,ref:e}):d.jsx(pbe,{side:o,...c,ref:e})})}),pbe=K.forwardRef((t,e)=>{const i=aM(Ib,t.__scopeTooltip),n=lee(Ib,t.__scopeTooltip),o=K.useRef(null),c=wr(e,o),[f,r]=K.useState(null),{trigger:x,onClose:S}=i,C=o.current,{onPointerInTransitChange:I}=n,N=K.useCallback(()=>{r(null),I(!1)},[I]),D=K.useCallback((V,B)=>{const W=V.currentTarget,$={x:V.clientX,y:V.clientY},G=_be($,W.getBoundingClientRect()),te=vbe($,G),ce=xbe(B.getBoundingClientRect()),_e=wbe([...te,...ce]);r(_e),I(!0)},[I]);return K.useEffect(()=>()=>N(),[N]),K.useEffect(()=>{if(x&&C){const V=W=>D(W,C),B=W=>D(W,x);return x.addEventListener("pointerleave",V),C.addEventListener("pointerleave",B),()=>{x.removeEventListener("pointerleave",V),C.removeEventListener("pointerleave",B)}}},[x,C,D,N]),K.useEffect(()=>{if(f){const V=B=>{const W=B.target,$={x:B.clientX,y:B.clientY},G=(x==null?void 0:x.contains(W))||(C==null?void 0:C.contains(W)),te=!bbe($,f);G?N():te&&(N(),S())};return document.addEventListener("pointermove",V),()=>document.removeEventListener("pointermove",V)}},[x,C,f,S,N]),d.jsx(hee,{...t,ref:c})}),[fbe,mbe]=oM(uee,{isInside:!1}),gbe=HQ("TooltipContent"),hee=K.forwardRef((t,e)=>{const{__scopeTooltip:i,children:n,"aria-label":o,onEscapeKeyDown:c,onPointerDownOutside:f,...r}=t,x=aM(Ib,i),S=c4(i),{onClose:C}=x;return K.useEffect(()=>(document.addEventListener(W8,C),()=>document.removeEventListener(W8,C)),[C]),K.useEffect(()=>{if(x.trigger){const I=N=>{const D=N.target;D!=null&&D.contains(x.trigger)&&C()};return window.addEventListener("scroll",I,{capture:!0}),()=>window.removeEventListener("scroll",I,{capture:!0})}},[x.trigger,C]),d.jsx(av,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:I=>I.preventDefault(),onDismiss:C,children:d.jsxs(rM,{"data-state":x.stateAttribute,...S,...r,ref:e,style:{...r.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:[d.jsx(gbe,{children:n}),d.jsx(fbe,{scope:i,isInside:!0,children:d.jsx(hve,{id:x.contentId,role:"tooltip",children:o||n})})]})})});dee.displayName=Ib;var pee="TooltipArrow",ybe=K.forwardRef((t,e)=>{const{__scopeTooltip:i,...n}=t,o=c4(i);return mbe(pee,i).isInside?null:d.jsx(sM,{...o,...n,ref:e})});ybe.displayName=pee;function _be(t,e){const i=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),c=Math.abs(e.left-t.x);switch(Math.min(i,n,o,c)){case c:return"left";case o:return"right";case i:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function vbe(t,e,i=5){const n=[];
618switch(e){case"top":n.push({x:t.x-i,y:t.y+i},{x:t.x+i,y:t.y+i});break;case"bottom":n.push({x:t.x-i,y:t.y-i},{x:t.x+i,y:t.y-i});break;case"left":n.push({x:t.x+i,y:t.y-i},{x:t.x+i,y:t.y+i});break;case"right":n.push({x:t.x-i,y:t.y-i},{x:t.x-i,y:t.y+i});break}return n}function xbe(t){const{top:e,right:i,bottom:n,left:o}=t;return[{x:o,y:e},{x:i,y:e},{x:i,y:n},{x:o,y:n}]}function bbe(t,e){const{x:i,y:n}=t;let o=!1;for(let c=0,f=e.length-1;c<e.length;f=c++){const r=e[c].x,x=e[c].y,S=e[f].x,C=e[f].y;x>n!=C>n&&i<(S-r)*(n-x)/(C-x)+r&&(o=!o)}return o}function wbe(t){const e=t.slice();return e.sort((i,n)=>i.x<n.x?-1:i.x>n.x?1:i.y<n.y?-1:i.y>n.y?1:0),Sbe(e)}function Sbe(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const o=t[n];for(;e.length>=2;){const c=e[e.length-1],f=e[e.length-2];if((c.x-f.x)*(o.y-f.y)>=(c.y-f.y)*(o.x-f.x))e.pop();else break}e.push(o)}e.pop();const i=[];for(let n=t.length-1;n>=0;n--){const o=t[n];for(;i.length>=2;){const c=i[i.length-1],f=i[i.length-2];if((c.x-f.x)*(o.y-f.y)>=(c.y-f.y)*(o.x-f.x))i.pop();else break}i.push(o)}return i.pop(),e.length===1&&i.length===1&&e[0].x===i[0].x&&e[0].y===i[0].y?e:e.concat(i)}var Tbe=cee,fee=dee;const Cbe=Tbe,Ebe=K.forwardRef(({className:t,sideOffset:e=4,...i},n)=>d.jsx(fee,{ref:n,sideOffset:e,className:nn("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 origin-[--radix-tooltip-content-transform-origin]",t),...i}));Ebe.displayName=fee.displayName;function Ka(){const{data:t,isLoading:e,isFetching:i,isRefetching:n}=Xn({queryKey:["/api/auth/user"],queryFn:VQ({on401:"returnNull"}),retry:!1,staleTime:1e3,refetchOnWindowFocus:!0});return{user:t,isLoading:e||i&&!t||n,isAuthenticated:!!t,isAdmin:(t==null?void 0:t.isAdmin)||!1,privacyAccepted:!!(t!=null&&t.privacyAcceptedAt)}}const gr=t=>typeof t=="string",wS=()=>{let t,e;const i=new Promise((n,o)=>{t=n,e=o});return i.resolve=t,i.reject=e,i},K8=t=>t==null?"":""+t,Abe=(t,e,i)=>{t.forEach(n=>{e[n]&&(i[n]=e[n])})},Ibe=/###/g,Z8=t=>t&&t.indexOf("###")>-1?t.replace(Ibe,"."):t,X8=t=>!t||gr(t),mT=(t,e,i)=>{const n=gr(e)?e.split("."):e;let o=0;for(;o<n.length-1;){if(X8(t))return{};
vendor: 4,746 bytes, line 618
618const c=Z8(n[o]);!t[c]&&i&&(t[c]=new i),Object.prototype.hasOwnProperty.call(t,c)?t=t[c]:t={},++o}return X8(t)?{}:{obj:t,k:Z8(n[o])}},Y8=(t,e,i)=>{const{obj:n,k:o}=mT(t,e,Object);if(n!==void 0||e.length===1){n[o]=i;return}let c=e[e.length-1],f=e.slice(0,e.length-1),r=mT(t,f,Object);for(;r.obj===void 0&&f.length;)c=`${f[f.length-1]}.${c}`,f=f.slice(0,f.length-1),r=mT(t,f,Object),r!=null&&r.obj&&typeof r.obj[`${r.k}.${c}`]<"u"&&(r.obj=void 0);r.obj[`${r.k}.${c}`]=i},kbe=(t,e,i,n)=>{const{obj:o,k:c}=mT(t,e,Object);o[c]=o[c]||[],o[c].push(i)},Hk=(t,e)=>{const{obj:i,k:n}=mT(t,e);if(i&&Object.prototype.hasOwnProperty.call(i,n))return i[n]},Pbe=(t,e,i)=>{const n=Hk(t,i);return n!==void 0?n:Hk(e,i)},mee=(t,e,i)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?gr(t[n])||t[n]instanceof String||gr(e[n])||e[n]instanceof String?i&&(t[n]=e[n]):mee(t[n],e[n],i):t[n]=e[n]);return t},Vx=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Nbe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Mbe=t=>gr(t)?t.replace(/[&<>"'\/]/g,e=>Nbe[e]):t;class Dbe{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const i=this.regExpMap.get(e);if(i!==void 0)return i;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const Rbe=[" ",",","?","!",";"],jbe=new Dbe(20),zbe=(t,e,i)=>{e=e||"",i=i||"";const n=Rbe.filter(f=>e.indexOf(f)<0&&i.indexOf(f)<0);if(n.length===0)return!0;const o=jbe.getRegExp(`(${n.map(f=>f==="?"?"\\?":f).join("|")})`);let c=!o.test(t);if(!c){const f=t.indexOf(i);f>0&&!o.test(t.substring(0,f))&&(c=!0)}return c},uO=(t,e,i=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(i);let o=t;for(let c=0;c<n.length;){if(!o||typeof o!="object")return;let f,r="";for(let x=c;x<n.length;++x)if(x!==c&&(r+=i),r+=n[x],f=o[r],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&x<n.length-1)continue;c+=x-c+1;break}o=f}return o},iC=t=>t==null?void 0:t.replace("_","-"),Lbe={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var i,n;(n=(i=console==null?void 0:console[t])==null?void 0:i.apply)==null||n.call(i,console,e)}};class Gk{constructor(e,i={}){this.init(e,i)}init(e,i={}){this.prefix=i.prefix||"i18next:",this.logger=e||Lbe,this.options=i,this.debug=i.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,i,n,o){return o&&!this.debug?null:(gr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[i](e))}create(e){return new Gk(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Gk(this.logger,e)}}var zh=new Gk;let lM=class{constructor(){this.observers={}}on(e,i){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const o=this.observers[n].get(i)||0;this.observers[n].set(i,o+1)}),this}off(e,i){if(this.observers[e]){if(!i){delete this.observers[e];return}this.observers[e].delete(i)}}emit(e,...i){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o(...i)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,c])=>{for(let f=0;f<c;f++)o.apply(o,[e,...i])})}};class Q8 extends lM{constructor(e,i={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=i,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 i=this.options.ns.indexOf(e);i>-1&&this.options.ns.splice(i,1)}getResource(e,i,n,o={}){var S,C;const c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let r;e.indexOf(".")>-1?r=e.split("."):(r=[e,i],n&&(Array.isArray(n)?r.push(...n):gr(n)&&c?r.push(...n.split(c)):r.push(n)));const x=Hk(this.data,r);return!x&&!i&&!n&&e.indexOf(".")>-1&&(e=r[0],i=r[1],n=r.slice(2).join(".")),x||!f||!gr(n)?x:uO((C=(S=this.data)==null?void 0:S[e])==null?void 0:C[i],n,c)}addResource(e,i,n,o,c={silent:!1}){const f=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator;let r=[e,i];n&&(r=r.concat(f?n.split(f):n)),e.indexOf(".")>-1&&(r=e.split("."),o=i,i=r[1]),this.addNamespaces(i),Y8(this.data,r,o),c.silent||this.emit
vendor: 1,703 bytes, line 618
618("added",e,i,n,o)}addResources(e,i,n,o={silent:!1}){for(const c in n)(gr(n[c])||Array.isArray(n[c]))&&this.addResource(e,i,c,n[c],{silent:!0});o.silent||this.emit("added",e,i,n)}addResourceBundle(e,i,n,o,c,f={silent:!1,skipCopy:!1}){let r=[e,i];e.indexOf(".")>-1&&(r=e.split("."),o=n,n=i,i=r[1]),this.addNamespaces(i);let x=Hk(this.data,r)||{};f.skipCopy||(n=JSON.parse(JSON.stringify(n))),o?mee(x,n,c):x={...x,...n},Y8(this.data,r,x),f.silent||this.emit("added",e,i,n)}removeResourceBundle(e,i){this.hasResourceBundle(e,i)&&delete this.data[e][i],this.removeNamespaces(i),this.emit("removed",e,i)}hasResourceBundle(e,i){return this.getResource(e,i)!==void 0}getResourceBundle(e,i){return i||(i=this.options.defaultNS),this.getResource(e,i)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const i=this.getDataByLanguage(e);return!!(i&&Object.keys(i)||[]).find(o=>i[o]&&Object.keys(i[o]).length>0)}toJSON(){return this.data}}var gee={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,i,n,o){return t.forEach(c=>{var f;e=((f=this.processors[c])==null?void 0:f.process(e,i,n,o))??e}),e}};const yee=Symbol("i18next/PATH_KEY");function Obe(){const t=[],e=Object.create(null);let i;return e.get=(n,o)=>{var c;return(c=i==null?void 0:i.revoke)==null||c.call(i),o===yee?t:(t.push(o),i=Proxy.revocable(n,e),i.proxy)},Proxy.revocable(Object.create(null),e).proxy}function dO(t,e){const{[yee]:i}=t(Obe());return i.join((e==null?void 0:e.keySeparator)??".")}const J8={},Dj=t=>!gr(t)&&typeof t!="boolean"&&typeof t!="number";let eq=class _ee extends lM{constructor(e,i={}){super(),Abe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","
618i18nFormat","utils"],e,this),this.options=i,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=zh.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,i={interpolation:{}}){const n={...i};if(e==null)return!1;const o=this.resolve(e,n);if((o==null?void 0:o.res)===void 0)return!1;const c=Dj(o.res);return!(n.returnObjects===!1&&c)}extractFromKey(e,i){let n=i.nsSeparator!==void 0?i.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let c=i.ns||this.options.defaultNS||[];const f=n&&e.indexOf(n)>-1,r=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!zbe(e,n,o);if(f&&!r){const x=e.match(this.interpolator.nestingRegexp);if(x&&x.length>0)return{key:e,namespaces:gr(c)?[c]:c};const S=e.split(n);(n!==o||n===o&&this.options.ns.indexOf(S[0])>-1)&&(c=S.shift()),e=S.join(o)}return{key:e,namespaces:gr(c)?[c]:c}}translate(e,i,n){let o=typeof i=="object"?{...i}:i;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),e==null)return"";typeof e=="function"&&(e=dO(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const c=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,f=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:r,namespaces:x}=this.extractFromKey(e[e.length-1],o),S=x[x.length-1];let C=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;C===void 0&&(C=":");const I=o.lng||this.language,N=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((I==null?void 0:I.toLowerCase())==="cimode")return N?c?{res:`${S}${C}${r}`,usedKey:r,exactUsedKey:r,usedLng:I,usedNS:S,usedParams:this.getUsedParamsDetails(o)}:`${S}${C}${r}`:c?{res:r,usedKey:r,exactUsedKey:r,usedLng:I,usedNS:S,usedParams:this.getUsedParamsDetails(o)}:r;const D=this.resolve(e,o);let V=D==null?void 0:D.res;const B=(D==null?void 0:D.usedKey)||r,W=(D==null?void 0:D.exactUsedKey)||r,$=["[object Number]","[object Function]","[object RegExp]"],G=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,te=!this.i18nFormat||this.i18nFormat.handleAsObject,ce=o.count!==void 0&&!gr(o.count),_e=_ee.hasDefaultValue(o),Te=ce?this.pluralResolver.getSuffix(I,o.count,o):"",we=o.ordinal&&ce?this.pluralResolver.getSuffix(I,o.count,{ordinal:!1}):"",Ne=ce&&!o.ordinal&&o.count===0,pe=Ne&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${Te}`]||o[`defaultValue${we}`]||o.defaultValue;let Pe=V;te&&!V&&_e&&(Pe=pe);const De=Dj(Pe),Je=Object.prototype.toString.apply(Pe);if(te&&Pe&&De&&$.indexOf(Je)<0&&!(gr(G)&&Array.isArray(Pe))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const dt=this.options.returnedObjectHandler?this.options.returnedObjectHandler(B,Pe,{...o,ns:x}):`key '${r} (${this.language})' returned an object instead of string.`;return c?(D.res=dt,D.usedParams=this.getUsedParamsDetails(o),D):dt}if(f){const dt=Array.isArray(Pe),At=dt?[]:{},qt=dt?W:B;for(const kt in Pe)if(Object.prototype.hasOwnProperty.call(Pe,kt)){const Vt=`${qt}${f}${kt}`;_e&&!V?At[kt]=this.translate(Vt,{...o,defaultValue:Dj(pe)?pe[kt]:void 0,joinArrays:!1,ns:x}):At[kt]=this.translate(Vt,{...o,joinArrays:!1,ns:x}),At[kt]===Vt&&(At[kt]=Pe[kt])}V=At}}else if(te&&gr(G)&&Array.isArray(V))V=V.join(G),V&&(V=this.extendTranslation(V,e,o,n));else{let dt=!1,At=!1;!this.isValidLookup(V)&&_e&&(dt=!0,V=pe),this.isValidLookup(V)||(At=!0,V=r);const kt=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&At?void 0:V,Vt=_e&&pe!==V&&this.options.updateMissing;if(At||dt||Vt){if(this.logger.log(Vt?"updateKey":"missingKey",I,S,r,Vt?pe:V),f){const Ge=this.resolve(r,{...o,keySeparator:!1});Ge&&Ge.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 Fe=[];const lt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&<&<[0])for(let Ge=0;Ge<lt.length;Ge++)Fe.push(lt[Ge]);else this.options.saveMissingTo==="all"?Fe=this.languageUtils.toResolveHierarchy(o.lng||this.language):Fe.push(o.lng||this.language);const pt=(Ge,Rt,Ot)=>{var Hi;const Ci=_e&&Ot!==V?Ot:kt;this.options.missingKeyHandler?this.options.missingKeyHandler(Ge,S,Rt,Ci,Vt,o):(Hi=this.backendConnector)!=null&&Hi.saveMissing&&this.backendConnector.saveMissing(Ge,S,Rt,Ci,Vt,o),this.emit
vendor: 33,025 bytes, line 618
618("missingKey",Ge,S,Rt,V)};this.options.saveMissing&&(this.options.saveMissingPlurals&&ce?Fe.forEach(Ge=>{const Rt=this.pluralResolver.getSuffixes(Ge,o);Ne&&o[`defaultValue${this.options.pluralSeparator}zero`]&&Rt.indexOf(`${this.options.pluralSeparator}zero`)<0&&Rt.push(`${this.options.pluralSeparator}zero`),Rt.forEach(Ot=>{pt([Ge],r+Ot,o[`defaultValue${Ot}`]||pe)})}):pt(Fe,r,pe))}V=this.extendTranslation(V,e,o,D,n),At&&V===r&&this.options.appendNamespaceToMissingKey&&(V=`${S}${C}${r}`),(At||dt)&&this.options.parseMissingKeyHandler&&(V=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${S}${C}${r}`:r,dt?V:void 0,o))}return c?(D.res=V,D.usedParams=this.getUsedParamsDetails(o),D):V}extendTranslation(e,i,n,o,c){var x,S;if((x=this.i18nFormat)!=null&&x.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const C=gr(e)&&(((S=n==null?void 0:n.interpolation)==null?void 0:S.skipOnVariables)!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let I;if(C){const D=e.match(this.interpolator.nestingRegexp);I=D&&D.length}let N=n.replace&&!gr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(N={...this.options.interpolation.defaultVariables,...N}),e=this.interpolator.interpolate(e,N,n.lng||this.language||o.usedLng,n),C){const D=e.match(this.interpolator.nestingRegexp),V=D&&D.length;I<V&&(n.nest=!1)}!n.lng&&o&&o.res&&(n.lng=this.language||o.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...D)=>(c==null?void 0:c[0])===D[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${D[0]} in key: ${i[0]}`),null):this.translate(...D,i),n)),n.interpolation&&this.interpolator.reset()}const f=n.postProcess||this.options.postProcess,r=gr(f)?[f]:f;return e!=null&&(r!=null&&r.length)&&n.applyPostProcessor!==!1&&(e=gee.handle(r,e,i,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,i={}){let n,o,c,f,r;return gr(e)&&(e=[e]),e.forEach(x=>{if(this.isValidLookup(n))return;const S=this.extractFromKey(x,i),C=S.key;o=C;let I=S.namespaces;this.options.fallbackNS&&(I=I.concat(this.options.fallbackNS));const N=i.count!==void 0&&!gr(i.count),D=N&&!i.ordinal&&i.count===0,V=i.context!==void 0&&(gr(i.context)||typeof i.context=="number")&&i.context!=="",B=i.lngs?i.lngs:this.languageUtils.toResolveHierarchy(i.lng||this.language,i.fallbackLng);I.forEach(W=>{var $,G;this.isValidLookup(n)||(r=W,!J8[`${B[0]}-${W}`]&&(($=this.utils)!=null&&$.hasLoadedNamespace)&&!((G=this.utils)!=null&&G.hasLoadedNamespace(r))&&(J8[`${B[0]}-${W}`]=!0,this.logger.warn(`key "${o}" for languages "${B.join(", ")}" won't get resolved as namespace "${r}" 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!!!")),B.forEach(te=>{var Te;if(this.isValidLookup(n))return;f=te;const ce=[C];if((Te=this.i18nFormat)!=null&&Te.addLookupKeys)this.i18nFormat.addLookupKeys(ce,C,te,W,i);else{let we;N&&(we=this.pluralResolver.getSuffix(te,i.count,i));const Ne=`${this.options.pluralSeparator}zero`,pe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(N&&(i.ordinal&&we.indexOf(pe)===0&&ce.push(C+we.replace(pe,this.options.pluralSeparator)),ce.push(C+we),D&&ce.push(C+Ne)),V){const Pe=`${C}${this.options.contextSeparator||"_"}${i.context}`;ce.push(Pe),N&&(i.ordinal&&we.indexOf(pe)===0&&ce.push(Pe+we.replace(pe,this.options.pluralSeparator)),ce.push(Pe+we),D&&ce.push(Pe+Ne))}}let _e;for(;_e=ce.pop();)this.isValidLookup(n)||(c=_e,n=this.getResource(te,W,_e,i))}))})}),{res:n,usedKey:o,exactUsedKey:c,usedLng:f,usedNS:r}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,i,n,o={}){var c;return(c=this.i18nFormat)!=null&&c.getResource?this.i18nFormat.getResource(e,i,n,o):this.resourceStore.getResource(e,i,n,o)}getUsedParamsDetails(e={}){const i=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!gr(e.replace);let o=n?e.replace:e;if(n&&typeof e.count<"u"&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!n){o={...o};for(const c of i)delete o[c]}return o}static hasDefaultValue(e){const i="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&i===n.substring(0,i.length)&&e[n]!==void 0)return!0;return!1}};class tq{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=zh.create("languageUtils")}getScriptPartFromCode(e){if(e=iC(e),!e||e.indexOf("-")<0)return null;const i=e.split("-");return i.length===2||(i.pop(),i[i.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(i.join("-"))}getLanguagePartFromCode(e){if(e=iC(e),!e||e.indexOf("-")<0)return e;const i=e.split("-");return this.formatLanguageCode(i[0])}formatLanguageCode(e){if(gr(e)&&e.indexOf("-")>-1){let i;try{i=Intl.getCanonicalLocales(e)[0]}catch{}return i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i||(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 i;return e.forEach(n=>{if(i)return;const o=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(o))&&(i=o)}),!i&&this.options.supportedLngs&&e.forEach(n=>{if(i)return;const o=this.getScriptPartFromCode(n);if(this.isSupportedCode(o))return i=o;const c=this.getLanguagePartFromCode(n);if(this.isSupportedCode(c))return i=c;i=this.options.supportedLngs.find(f=>{if(f===c)return f;if(!(f.indexOf("-")<0&&c.indexOf("-")<0)&&(f.indexOf("-")>0&&c.indexOf("-")<0&&f.substring(0,f.indexOf("-"))===c||f.indexOf(c)===0&&c.length>1))return f})}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}getFallbackCodes(e,i){if(!e)return[];if(typeof e=="function"&&(e=e(i)),gr(e)&&(e=[e]),Array.isArray(e))return e;if(!i)return e.default||[];let n=e[i];return n||(n=e[this.getScriptPartFromCode(i)]),n||(n=e[this.formatLanguageCode(i)]),n||(n=e[this.getLanguagePartFromCode(i)]),n||(n=e.default),n||[]}toResolveHierarchy(e,i){const n=this.getFallbackCodes((i===!1?[]:i)||this.options.fallbackLng||[],e),o=[],c=f=>{f&&(this.isSupportedCode(f)?o.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return gr(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&c(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&c(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&c(this.getLanguagePartFromCode(e))):gr(e)&&c(this.formatLanguageCode(e)),n.forEach(f=>{o.indexOf(f)<0&&c(this.formatLanguageCode(f))}),o}}const iq={zero:0,one:1,two:2,few:3,many:4,other:5},nq={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Fbe{constructor(e,i={}){this.languageUtils=e,this.options=i,this.logger=zh.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,i){this.rules[e]=i}clearCache(){this.pluralRulesCache={}}getRule(e,i={}){const n=iC(e==="dev"?"en":e),o=i.ordinal?"ordinal":"cardinal",c=JSON.stringify({cleanedCode:n,type:o});if(c in this.pluralRulesCache)return this.pluralRulesCache[c];let f;try{f=new Intl.PluralRules(n,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),nq;if(!e.match(/-|_/))return nq;const x=this.languageUtils.getLanguagePartFromCode(e);f=this.getRule(x,i)}return this.pluralRulesCache[c]=f,f}needsPlural(e,i={}){let n=this.getRule(e,i);return n||(n=this.getRule("dev",i)),(n==null?void 0:n.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,i,n={}){return this.getSuffixes(e,n).map(o=>`${i}${o}`)}getSuffixes(e,i={}){let n=this.getRule(e,i);return n||(n=this.getRule("dev",i)),n?n.resolvedOptions().pluralCategories.sort((o,c)=>iq[o]-iq[c]).map(o=>`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(e,i,n={}){const o=this.getRule(e,n);return o?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o.select(i)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",i,n))}}const rq=(t,e,i,n=".",o=!0)=>{let c=Pbe(t,e,i);return!c&&o&&gr(i)&&(c=uO(t,i,n),c===void 0&&(c=uO(e,i,n))),c},Rj=t=>t.replace(/\$/g,"$$$$");class Bbe{constructor(e={}){var i;this.logger=zh.create("interpolator"),this.options=e,this.format=((i=e==null?void 0:e.interpolation)==null?void 0:i.format)||(n=>n),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:i,escapeValue:n,useRawValueToEscape:o,prefix:c,prefixEscaped:f,suffix:r,suffixEscaped:x,formatSeparator:S,unescapeSuffix:C,unescapePrefix:I,nestingPrefix:N,nestingPrefixEscaped:D,nestingSuffix:V,nestingSuffixEscaped:B,nestingOptionsSeparator:W,maxReplaces:$,alwaysFormat:G}=e.interpolation;this.escape=i!==void 0?i:Mbe,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=c?Vx(c):f||"{{",this.suffix=r?Vx(r):x||"}}",this.formatSeparator=S||",",this.unescapePrefix=C?"":I||"-",this.unescapeSuffix=this.unescapePrefix?"":C||"",this.nestingPrefix=N?Vx(N):D||Vx("$t("),this.nestingSuffix=V?Vx(V):B||Vx(")"),this.nestingOptionsSeparator=W||",",this.maxReplaces=$||1e3,this.alwaysFormat=G!==void 0?G:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(i,n)=>(i==null?void 0:i.source)===n?(i.lastIndex=0,i):new RegExp(n,"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,i,n,o){var D;let c,f,r;const x=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},S=V=>{if(V.indexOf(this.formatSeparator)<0){const G=rq(i,x,V,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(G,void 0,n,{...o,...i,interpolationkey:V}):G}const B=V.split(this.formatSeparator),W=B.shift().trim(),$=B.join(this.formatSeparator).trim();return this.format(rq(i,x,W,this.options.keySeparator,this.options.ignoreJSONStructure),$,n,{...o,...i,interpolationkey:W})};this.resetRegExp();const C=(o==null?void 0:o.missingInterpolationHandler)||this.options.missingInterpolationHandler,I=((D=o==null?void 0:o.interpolation)==null?void 0:D.skipOnVariables)!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:V=>Rj(V)},{regex:this.regexp,safeValue:V=>this.escapeValue?Rj(this.escape(V)):Rj(V)}].forEach(V=>{for(r=0;c=V.regex.exec(e);){const B=c[1].trim();if(f=S(B),f===void 0)if(typeof C=="function"){const $=C(e,c,o);f=gr($)?$:""}else if(o&&Object.prototype.hasOwnProperty.call(o,B))f="";else if(I){f=c[0];continue}else this.logger.warn(`missed to pass in variable ${B} for interpolating ${e}`),f="";else!gr(f)&&!this.useRawValueToEscape&&(f=K8(f));const W=V.safeValue(f);if(e=e.replace(c[0],W),I?(V.regex.lastIndex+=f.length,V.regex.lastIndex-=c[0].length):V.regex.lastIndex=0,r++,r>=this.maxReplaces)break}}),e}nest(e,i,n={}){let o,c,f;const r=(x,S)=>{const C=this.nestingOptionsSeparator;if(x.indexOf(C)<0)return x;const I=x.split(new RegExp(`${C}[ ]*{`));let N=`{${I[1]}`;x=I[0],N=this.interpolate(N,f);const D=N.match(/'/g),V=N.match(/"/g);(((D==null?void 0:D.length)??0)%2===0&&!V||V.length%2!==0)&&(N=N.replace(/'/g,'"'));try{f=JSON.parse(N),S&&(f={...S,...f})}catch(B){return this.logger.warn(`failed parsing options string in nesting for key ${x}`,B),`${x}${C}${N}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,x};for(;o=this.nestingRegexp.exec(e);){let x=[];f={...n},f=f.replace&&!gr(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;const S=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(S!==-1&&(x=o[1].slice(S).split(this.formatSeparator).map(C=>C.trim()).filter(Boolean),o[1]=o[1].slice(0,S)),c=i(r.call(this,o[1].trim(),f),f),c&&o[0]===e&&!gr(c))return c;gr(c)||(c=K8(c)),c||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),c=""),x.length&&(c=x.reduce((C,I)=>this.format(C,I,n.lng,{...n,interpolationkey:o[1].trim()}),c.trim())),e=e.replace(o[0],c),this.regexp.lastIndex=0}return e}}const Ube=t=>{let e=t.toLowerCase().trim();const i={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const o=n[1].substring(0,n[1].length-1);e==="currency"&&o.indexOf(":")<0?i.currency||(i.currency=o.trim()):e==="relativetime"&&o.indexOf(":")<0?i.range||(i.range=o.trim()):o.split(";").forEach(f=>{if(f){const[r,...x]=f.split(":"),S=x.join(":").trim().replace(/^'+|'+$/g,""),C=r.trim();i[C]||(i[C]=S),S==="false"&&(i[C]=!1),S==="true"&&(i[C]=!0),isNaN(S)||(i[C]=parseInt(S,10))}})}return{formatName:e,formatOptions:i}},sq=t=>{const e={};return(i,n,o)=>{let c=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(c={...c,[o.interpolationkey]:void 0});const f=n+JSON.stringify(c);let r=e[f];return r||(r=t(iC(n),o),e[f]=r),r(i)}},Vbe=t=>(e,i,n)=>t(iC(i),n)(e);class $be{constructor(e={}){this.logger=zh.create("formatter"),this.options=e,this.init(e)}init(e,i={interpolation:{}}){this.formatSeparator=i.interpolation.formatSeparator||",";const n=i.cacheInBuiltFormats?sq:Vbe;this.formats={number:n((o,c)=>{const f=new Intl.NumberFormat(o,{...c});return r=>f.format(r)}),currency:n((o,c)=>{const f=new Intl.NumberFormat(o,{...c,style:"currency"});return r=>f.format(r)}),datetime:n((o,c)=>{const f=new Intl.DateTimeFormat(o,{...c});return r=>f.format(r)}),relativetime:n((o,c)=>{const f=new Intl.RelativeTimeFormat(o,{...c});return r=>f.format(r,c.range||"day")}),list:n((o,c)=>{const f=new Intl.ListFormat(o,{...c});return r=>f.format(r)})}}add(e,i){this.formats[e.toLowerCase().trim()]=i}addCached(e,i){this.formats[e.toLowerCase().trim()]=sq(i)}format(e,i,n,o={}){const c=i.split(this.formatSeparator);if(c.length>1&&c[0].indexOf("(")>1&&c[0].indexOf(")")<0&&c.find(r=>r.indexOf(")")>-1)){const r=c.findIndex(x=>x.indexOf(")")>-1);c[0]=[c[0],...c.splice(1,r)].join(this.formatSeparator)}return c.reduce((r,x)=>{var I;const{formatName:S,formatOptions:C}=Ube(x);if(this.formats[S]){let N=r;try{const D=((I=o==null?void 0:o.formatParams)==null?void 0:I[o.interpolationkey])||{},V=D.locale||D.lng||o.locale||o.lng||n;N=this.formats[S](r,V,{...C,...o,...D})}catch(D){this.logger.warn(D)}return N}else this.logger.warn(`there was no format function for ${S}`);return r},e)}}const qbe=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class Hbe extends lM{constructor(e,i,n,o={}){var c,f;super(),this.backend=e,this.store=i,this.services=n,this.languageUtils=n.languageUtils,this.options=o,this.logger=zh.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],(f=(c=this.backend)==null?void 0:c.init)==null||f.call(c,n,o.backend,o)}queueLoad(e,i,n,o){const c={},f={},r={},x={};return e.forEach(S=>{let C=!0;i.forEach(I=>{const N=`${S}|${I}`;!n.reload&&this.store.hasResourceBundle(S,I)?this.state[N]=2:this.state[N]<0||(this.state[N]===1?f[N]===void 0&&(f[N]=!0):(this.state[N]=1,C=!1,f[N]===void 0&&(f[N]=!0),c[N]===void 0&&(c[N]=!0),x[I]===void 0&&(x[I]=!0)))}),C||(r[S]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(x)}}loaded(e,i,n){const o=e.split("|"),c=o[0],f=o[1];i&&this.emit("failedLoading",c,f,i),!i&&n&&this.store.addResourceBundle(c,f,n,void 0,void 0,{skipCopy:!0}),this.state[e]=i?-1:2,i&&n&&(this.state[e]=0);const r={};this.queue.forEach(x=>{kbe(x.loaded,[c],f),qbe(x,e),i&&x.errors.push(i),x.pendingCount===0&&!x.done&&(Object.keys(x.loaded).forEach(S=>{r[S]||(r[S]={});const C=x.loaded[S];C.length&&C.forEach(I=>{r[S][I]===void 0&&(r[S][I]=!0)})}),x.done=!0,x.errors.length?x.callback(x.errors):x.callback())}),this.emit("loaded",r),this.queue=this.queue.filter(x=>!x.done)}read(e,i,n,o=0,c=this.retryTimeout,f){if(!e.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:i,fcName:n,tried:o,wait:c,callback:f});return}this.readingCalls++;const r=(S,C)=>{if(this.readingCalls--,this.waitingReads.length>0){const I=this.waitingReads.shift();this.read(I.lng,I.ns,I.fcName,I.tried,I.wait,I.callback)}if(S&&C&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,e,i,n,o+1,c*2,f)},c);return}f(S,C)},x=this.backend[n].bind(this.backend);if(x.length===2){try{const S=x(e,i);S&&typeof S.then=="function"?S.then(C=>r(null,C)).catch(r):r(null,S)}catch(S){r(S)}return}return x(e,i,r)}prepareLoading(e,i,n={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();gr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),gr(i)&&(i=[i]);const c=this.queueLoad(e,i,n,o);if(!c.toLoad.length)return c.pending.length||o(),null;c.toLoad.forEach(f=>{this.loadOne(f)})}load(e,i,n){this.prepareLoading(e,i,{},n)}reload(e,i,n){this.prepareLoading(e,i,{reload:!0},n)}loadOne(e,i=""){const n=e.split("|"),o=n[0],c=n[1];this.read(o,c,"read",void 0,void 0,(f,r)=>{f&&this.logger.warn(`${i}loading namespace ${c} for language ${o} failed`,f),!f&&r&&this.logger.log(`${i}loaded namespace ${c} for language ${o}`,r),this.loaded(e,f,r)})}saveMissing(e,i,n,o,c,f={},r=()=>{}){var x,S,C,I,N;if((S=(x=this.services)==null?void 0:x.utils)!=null&&S.hasLoadedNamespace&&!((I=(C=this.services)==null?void 0:C.utils)!=null&&I.hasLoadedNamespace(i))){this.logger.warn(`did not save key "${n}" as the namespace "${i}" 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(!(n==null||n==="")){if((N=this.backend)!=null&&N.create){const D={...f,isUpdate:c},V=this.backend.create.bind(this.backend);if(V.length<6)try{let B;V.length===5?B=V(e,i,n,o,D):B=V(e,i,n,o),B&&typeof B.then=="function"?B.then(W=>r(null,W)).catch(r):r(null,B)}catch(B){r(B)}else V(e,i,n,o,r,D)}!e||!e[0]||this.store.addResource(e[0],i,n,o)}}}const oq=()=>({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]),gr(t[1])&&(e.defaultValue=t[1]),gr(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const i=t[3]||t[2];Object.keys(i).forEach(n=>{e[n]=i[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),aq=t=>{var e,i;return gr(t.ns)&&(t.ns=[t.ns]),gr(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),gr(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),((i=(e=t.supportedLngs)==null?void 0:e.indexOf)==null?void 0:i.call(e,"cimode"))<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t},QA=()=>{},Gbe=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(i=>{typeof t[i]=="function"&&(t[i]=t[i].bind(t))})};class gT extends lM{constructor(e={},i){if(super(),this.options=aq(e),this.services={},this.logger=zh,this.modules={external:[]},Gbe(this),i&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,i),this;setTimeout(()=>{this.init(e,i)},0)}}init(e={},i){this.isInitializing=!0,typeof e=="function"&&(i=e,e={}),e.defaultNS==null&&e.ns&&(gr(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=oq();this.options={...n,...this.options,...aq(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const o=S=>S?typeof S=="function"?new S:S:null;if(!this.options.isClone){this.modules.logger?zh.init(o(this.modules.logger),this.options):zh.init(null,this.options);let S;this.modules.formatter?S=this.modules.formatter:S=$be;const C=new tq(this.options);this.store=new Q8(this.options.resources,this.options);const I=this.services;I.logger=zh,I.resourceStore=this.store,I.languageUtils=C,I.pluralResolver=new Fbe(C,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.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"),S&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(I.formatter=o(S),I.formatter.init&&I.formatter.init(I,this.options),this.options.interpolation.format=I.formatter.format.bind(I.formatter)),I.interpolator=new Bbe(this.options),I.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},I.backendConnector=new Hbe(o(this.modules.backend),I.resourceStore,I,this.options),I.backendConnector.on("*",(D,...V)=>{this.emit(D,...V)}),this.modules.languageDetector&&(I.languageDetector=o(this.modules.languageDetector),I.languageDetector.init&&I.languageDetector.init(I,this.options.detection,this.options)),this.modules.i18nFormat&&(I.i18nFormat=o(this.modules.i18nFormat),I.i18nFormat.init&&I.i18nFormat.init(this)),this.translator=new eq(this.services,this.options),this.translator.on("*",(D,...V)=>{this.emit(D,...V)}),this.modules.external.forEach(D=>{D.init&&D.init(this)})}if(this.format=this.options.interpolation.format,i||(i=QA),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const S=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);S.length>0&&S[0]!=="dev"&&(this.options.lng=S[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(S=>{this[S]=(...C)=>this.store[S](...C)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(S=>{this[S]=(...C)=>(this.store[S](...C),this)});const r=wS(),x=()=>{const S=(C,I)=>{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),r.resolve(I),i(C,I)};if(this.languages&&!this.isInitialized)return S(null,this.t.bind(this));this.changeLanguage(this.options.lng,S)};return this.options.resources||!this.options.initAsync?x():setTimeout(x,0),r}loadResources(e,i=QA){var c,f;let n=i;const o=gr(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if((o==null?void 0:o.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const r=[],x=S=>{if(!S||S==="cimode")return;this.services.languageUtils.toResolveHierarchy(S).forEach(I=>{I!=="cimode"&&r.indexOf(I)<0&&r.push(I)})};o?x(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(C=>x(C)),(f=(c=this.options.preload)==null?void 0:c.forEach)==null||f.call(c,S=>x(S)),this.services.backendConnector.load(r,this.options.ns,S=>{!S&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(S)})}else n(null)}reloadResources(e,i,n){const o=wS();return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=void 0),e||(e=this.languages),i||(i=this.options.ns),n||(n=QA),this.services.backendConnector.reload(e,i,c=>{o.resolve(),n(c)}),o}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"&&gee.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 i=0;i<this.languages.length;i++){const n=this.languages[i];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,i){this.isLanguageChangingTo=e;const n=wS();this.emit("languageChanging",e);const o=r=>{this.language=r,this.languages=this.services.languageUtils.toResolveHierarchy(r),this.resolvedLanguage=void 0,this.setResolvedLanguage(r)},c=(r,x)=>{x?this.isLanguageChangingTo===e&&(o(x),this.translator.changeLanguage(x),this.isLanguageChangingTo=void 0,this.emit("languageChanged",x),this.logger.log("languageChanged",x)):this.isLanguageChangingTo=void 0,n.resolve((...S)=>this.t(...S)),i&&i(r,(...S)=>this.t(...S))},f=r=>{var C,I;!e&&!r&&this.services.languageDetector&&(r=[]);const x=gr(r)?r:r&&r[0],S=this.store.hasLanguageSomeTranslations(x)?x:this.services.languageUtils.getBestMatchFromCodes(gr(r)?[r]:r);S&&(this.language||o(S),this.translator.language||this.translator.changeLanguage(S),(I=(C=this.services.languageDetector)==null?void 0:C.cacheUserLanguage)==null||I.call(C,S)),this.loadResources(S,N=>{c(N,S)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(e),n}getFixedT(e,i,n){const o=(c,f,...r)=>{let x;typeof f!="object"?x=this.options.overloadTranslationOptionHandler([c,f].concat(r)):x={...f},x.lng=x.lng||o.lng,x.lngs=x.lngs||o.lngs,x.ns=x.ns||o.ns,x.keyPrefix!==""&&(x.keyPrefix=x.keyPrefix||n||o.keyPrefix);const S=this.options.keySeparator||".";let C;return x.keyPrefix&&Array.isArray(c)?C=c.map(I=>(typeof I=="function"&&(I=dO(I,{...this.options,...f})),`${x.keyPrefix}${S}${I}`)):(typeof c=="function"&&(c=dO(c,{...this.options,...f})),C=x.keyPrefix?`${x.keyPrefix}${S}${c}`:c),this.t(C,x)};return gr(e)?o.lng=e:o.lngs=e,o.ns=i,o.keyPrefix=n,o}t(...e){var i;return(i=this.translator)==null?void 0:i.translate(...e)}exists(...e){var i;return(i=this.translator)==null?void 0:i.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,i={}){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 n=i.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const f=(r,x)=>{const S=this.services.backendConnector.state[`${r}|${x}`];return S===-1||S===0||S===2};if(i.precheck){const r=i.precheck(this,f);if(r!==void 0)return r}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(n,e)&&(!o||f(c,e)))}loadNamespaces(e,i){const n=wS();return this.options.ns?(gr(e)&&(e=[e]),e.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{n.resolve(),i&&i(o)}),n):(i&&i(),Promise.resolve())}loadLanguages(e,i){const n=wS();gr(e)&&(e=[e]);const o=this.options.preload||[],c=e.filter(f=>o.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return c.length?(this.options.preload=o.concat(c),this.loadResources(f=>{n.resolve(),i&&i(f)}),n):(i&&i(),Promise.resolve())}dir(e){var o,c;if(e||(e=this.resolvedLanguage||(((o=this.languages)==null?void 0:o.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const f=new Intl.Locale(e);if(f&&f.getTextInfo){const r=f.getTextInfo();if(r&&r.direction)return r.direction}}catch{}const i=["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"],n=((c=this.services)==null?void 0:c.languageUtils)||new tq(oq());return e.toLowerCase().indexOf("-latn")>1?"ltr":i.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},i){const n=new gT(e,i);return n.createInstance=gT.createInstance,n}cloneInstance(e={},i=QA){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},c=new gT(o);if((e.debug!==void 0||e.prefix!==void 0)&&(c.logger=c.logger.clone(e)),["store","services","language"].forEach(r=>{c[r]=this[r]}),c.services={...this.services},c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},n){const r=Object.keys(this.store.data).reduce((x,S)=>(x[S]={...this.store.data[S]},x[S]=Object.keys(x[S]).reduce((C,I)=>(C[I]={...x[S][I]},C),x[S]),x),{});c.store=new Q8(r,o),c.services.resourceStore=c.store}return c.translator=new eq(c.services,o),c.translator.on("*",(r,...x)=>{c.emit(r,...x)}),c.init(o,i),c.translator.options=o,c.translator.backendConnector.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const kl=gT.createInstance();kl.createInstance;kl.dir;kl.init;kl.loadResources;kl.reloadResources;kl.use;kl.changeLanguage;kl.getFixedT;kl.t;kl.exists;kl.setDefaultNamespace;kl.hasLoadedNamespace;kl.loadNamespaces;kl.loadLanguages;const Wbe=(t,e,i,n)=>{var c,f,r,x;const o=[i,{code:e,...n||{}}];if((f=(c=t==null?void 0:t.services)==null?void 0:c.logger)!=null&&f.forward)return t.services.logger.forward(o,"warn","react-i18next::",!0);V_(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),(x=(r=t==null?void 0:t.services)==null?void 0:r.logger)!=null&&x.warn?t.services.logger.warn(...o):console!=null&&console.warn&&console.warn(...o)},lq={},vee=(t,e,i,n)=>{V_(i)&&lq[i]||(V_(i)&&(lq[i]=new Date),Wbe(t,e,i,n))},xee=(t,e)=>()=>{if(t.isInitialized)e();else{const i=()=>{setTimeout(()=>{t.off("initialized",i)},0),e()};t.on("initialized",i)}},hO=(t,e,i)=>{t.loadNamespaces(e,xee(t,i))},cq=(t,e,i,n)=>{if(V_(i)&&(i=[i]),t.options.preload&&t.options.preload.indexOf(e)>-1)return hO(t,i,n);i.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,xee(t,n))},Kbe=(t,e,i={})=>
618!e.languages||!e.languages.length?(vee(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:i.lng,precheck:(n,o)=>{if(i.bindI18n&&i.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,t))return!1}}),V_=t=>typeof t=="string",Zbe=t=>typeof t=="object"&&t!==null,Xbe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ybe={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"â¦","…":"â¦","/":"/","/":"/"},Qbe=t=>Ybe[t],Jbe=t=>t.replace(Xbe,Qbe);let pO={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:Jbe};const e1e=(t={})=>{pO={...pO,...t}},t1e=()=>pO;let bee;const i1e=t=>{bee=t},n1e=()=>bee,r1e={type:"3rdParty",init(t){e1e(t.options.react),i1e(t)}},s1e=K.createContext();class o1e{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(i=>{this.usedNamespaces[i]||(this.usedNamespaces[i]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const a1e=(t,e)=>V_(e)?e:Zbe(e)&&V_(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,l1e={t:a1e,ready:!1},c1e=()=>()=>{},pr=(t,e={})=>{var ce,_e;const{i18n:i}=e,{i18n:n,defaultNS:o}=K.useContext(s1e)||{},c=i||n||n1e();c&&!c.reportNamespaces&&(c.reportNamespaces=new o1e),c||vee(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const f=K.useMemo(()=>{var Te;return{...t1e(),...(Te=c==null?void 0:c.options)==null?void 0:Te.react,...e}},[c,e]),{useSuspense:r,keyPrefix:x}=f,S=K.useMemo(()=>{var we;const Te=o||((we=c==null?void 0:c.options)==null?void 0:we.defaultNS);return V_(Te)?[Te]:Te||["translation"]},[t,o,c]);(_e=(ce=c==null?void 0:c.reportNamespaces)==null?void 0:ce.addUsedNamespaces)==null||_e.call(ce,S);const C=K.useRef(0),I=K.useCallback(Te=>{if(!c)return c1e;const{bindI18n:we,bindI18nStore:Ne}=f,pe=()=>{C.current+=1,Te()};return we&&c.on(we,pe),Ne&&c.store.on(Ne,pe),()=>{we&&we.split(" ").forEach(Pe=>c.off(Pe,pe)),Ne&&Ne.split(" ").forEach(Pe=>c.store.off(Pe,pe))}},[c,f]),N=K.useRef(),D=K.useCallback(()=>{if(!c)return l1e;const Te=!!(c.isInitialized||c.initializedStoreOnce)&&S.every(Je=>Kbe(Je,c,f)),we=e.lng||c.language,Ne=C.current,pe=N.current;if(pe&&pe.ready===Te&&pe.lng===we&&pe.keyPrefix===x&&pe.revision===Ne)return pe;const De={t:c.getFixedT(we,f.nsMode==="fallback"?S:S[0],x),ready:Te,lng:we,keyPrefix:x,revision:Ne};return N.current=De,De},[c,S,x,f,e.lng]),[V,B]=K.useState(0),{t:W,ready:$}=cE.useSyncExternalStore(I,D,D);K.useEffect(()=>{if(c&&!$&&!r){const Te=()=>B(we=>we+1);e.lng?cq(c,e.lng,S,Te):hO(c,S,Te)}},[c,e.lng,S,$,r,V]);const G=c||{},te=K.useMemo(()=>{const Te=[W,G,$];return Te.t=W,Te.i18n=G,Te.ready=$,Te},[W,G,$]);if(c&&r&&!$)throw new Promise(Te=>{const we=()=>Te();e.lng?cq(c,e.lng,S,we):hO(c,S,we)});return te};var jj="focusScope.autoFocusOnMount",zj="focusScope.autoFocusOnUnmount",uq={bubbles:!1,cancelable:!0},u1e="FocusScope",mE=K.forwardRef((t,e)=>{const{loop:i=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:c,...f}=t,[r,x]=K.useState(null),S=go(o),C=go(c),I=K.useRef(null),N=wr(e,B=>x(B)),D=K.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;K.useEffect(()=>{if(n){let B=function(te){if(D.paused||!r)return;const ce=te.target;r.contains(ce)?I.current=ce:fm(I.current,{select:!0})},W=function(te){if(D.paused||!r)return;const ce=te.relatedTarget;ce!==null&&(r.contains(ce)||fm(I.current,{select:!0}))},$=function(te){if(document.activeElement===document.body)for(const _e of te)_e.removedNodes.length>0&&fm(r)};document.addEventListener("focusin",B),document.addEventListener("focusout",W);const G=new MutationObserver($);return r&&G.observe(r,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",B),document.removeEventListener("focusout",W),G.disconnect()}}},[n,r,D.paused]),K.useEffect(()=>{if(r){hq.add(D);const B=document.activeElement;if(!r.contains(B)){const $=new CustomEvent(jj,uq);r.addEventListener(jj,S),r.dispatchEvent($),$.defaultPrevented||(d1e(g1e(wee(r)),{select:!0}),document.activeElement===B&&fm(r))}return()=>{r.removeEventListener(jj,S),setTimeout(()=>{const $=new CustomEvent(zj,uq);r.addEventListener(zj,C),r.dispatchEvent($),$.defaultPrevented||fm(B??document.body,{select:!0}),r.removeEventListener(zj,C),hq.remove(D)},0)}}},[r,S,C,D]);const V=K.useCallback(B=>{if(!i&&!n||D.paused)return;
vendor: 4,335 bytes, line 618
618const W=B.key==="Tab"&&!B.altKey&&!B.ctrlKey&&!B.metaKey,$=document.activeElement;if(W&&$){const G=B.currentTarget,[te,ce]=h1e(G);te&&ce?!B.shiftKey&&$===ce?(B.preventDefault(),i&&fm(te,{select:!0})):B.shiftKey&&$===te&&(B.preventDefault(),i&&fm(ce,{select:!0})):$===G&&B.preventDefault()}},[i,n,D.paused]);return d.jsx(vn.div,{tabIndex:-1,...f,ref:N,onKeyDown:V})});mE.displayName=u1e;function d1e(t,{select:e=!1}={}){const i=document.activeElement;for(const n of t)if(fm(n,{select:e}),document.activeElement!==i)return}function h1e(t){const e=wee(t),i=dq(e,t),n=dq(e.reverse(),t);return[i,n]}function wee(t){const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)e.push(i.currentNode);return e}function dq(t,e){for(const i of t)if(!p1e(i,{upTo:e}))return i}function p1e(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 f1e(t){return t instanceof HTMLInputElement&&"select"in t}function fm(t,{select:e=!1}={}){if(t&&t.focus){const i=document.activeElement;t.focus({preventScroll:!0}),t!==i&&f1e(t)&&e&&t.select()}}var hq=m1e();function m1e(){let t=[];return{add(e){const i=t[0];e!==i&&(i==null||i.pause()),t=pq(t,e),t.unshift(e)},remove(e){var i;t=pq(t,e),(i=t[0])==null||i.resume()}}}function pq(t,e){const i=[...t],n=i.indexOf(e);return n!==-1&&i.splice(n,1),i}function g1e(t){return t.filter(e=>e.tagName!=="A")}var Lj=0;function cM(){K.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??fq()),document.body.insertAdjacentElement("beforeend",t[1]??fq()),Lj++,()=>{Lj===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Lj--}},[])}function fq(){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 Mh=function(){return Mh=Object.assign||function(e){for(var i,n=1,o=arguments.length;n<o;n++){i=arguments[n];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c])}return e},Mh.apply(this,arguments)};function See(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(i[n[o]]=t[n[o]]);return i}function y1e(t,e,i){if(i||arguments.length===2)for(var n=0,o=e.length,c;n<o;n++)(c||!(n in e))&&(c||(c=Array.prototype.slice.call(e,0,n)),c[n]=e[n]);return t.concat(c||Array.prototype.slice.call(e))}var KI="right-scroll-bar-position",ZI="width-before-scroll-bar",_1e="with-scroll-bars-hidden",v1e="--removed-body-scroll-bar-size";function Oj(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function x1e(t,e){var i=K.useState(function(){return{value:t,callback:e,facade:{get current(){return i.value},set current(n){var o=i.value;o!==n&&(i.value=n,i.callback(n,o))}}}})[0];return i.callback=e,i.facade}var b1e=typeof window<"u"?K.useLayoutEffect:K.useEffect,mq=new WeakMap;function w1e(t,e){var i=x1e(null,function(n){return t.forEach(function(o){return Oj(o,n)})});return b1e(function(){var n=mq.get(i);if(n){var o=new Set(n),c=new Set(t),f=i.current;o.forEach(function(r){c.has(r)||Oj(r,null)}),c.forEach(function(r){o.has(r)||Oj(r,f)})}mq.set(i,t)},[t]),i}function S1e(t){return t}function T1e(t,e){e===void 0&&(e=S1e);var i=[],n=!1,o={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:t},useMedium:function(c){var f=e(c,n);return i.push(f),function(){i=i.filter(function(r){return r!==f})}},assignSyncMedium:function(c){for(n=!0;i.length;){var f=i;i=[],f.forEach(c)}i={push:function(r){return c(r)},filter:function(){return i}}},assignMedium:function(c){n=!0;var f=[];if(i.length){var r=i;i=[],r.forEach(c),f=i}var x=function(){var C=f;
vendor: 5,464 bytes, lines 618-655
618f=[],C.forEach(c)},S=function(){return Promise.resolve().then(x)};S(),i={push:function(C){f.push(C),S()},filter:function(C){return f=f.filter(C),i}}}};return o}function C1e(t){t===void 0&&(t={});var e=T1e(null);return e.options=Mh({async:!0,ssr:!1},t),e}var Tee=function(t){var e=t.sideCar,i=See(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=e.read();if(!n)throw new Error("Sidecar medium not found");return K.createElement(n,Mh({},i))};Tee.isSideCarExport=!0;function E1e(t,e){return t.useMedium(e),Tee}var Cee=C1e(),Fj=function(){},uM=K.forwardRef(function(t,e){var i=K.useRef(null),n=K.useState({onScrollCapture:Fj,onWheelCapture:Fj,onTouchMoveCapture:Fj}),o=n[0],c=n[1],f=t.forwardProps,r=t.children,x=t.className,S=t.removeScrollBar,C=t.enabled,I=t.shards,N=t.sideCar,D=t.noIsolation,V=t.inert,B=t.allowPinchZoom,W=t.as,$=W===void 0?"div":W,G=t.gapMode,te=See(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),ce=N,_e=w1e([i,e]),Te=Mh(Mh({},te),o);return K.createElement(K.Fragment,null,C&&K.createElement(ce,{sideCar:Cee,removeScrollBar:S,shards:I,noIsolation:D,inert:V,setCallbacks:c,allowPinchZoom:!!B,lockRef:i,gapMode:G}),f?K.cloneElement(K.Children.only(r),Mh(Mh({},Te),{ref:_e})):K.createElement($,Mh({},Te,{className:x,ref:_e}),r))});uM.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};uM.classNames={fullWidth:ZI,zeroRight:KI};var A1e=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function I1e(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=A1e();return e&&t.setAttribute("nonce",e),t}function k1e(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function P1e(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var N1e=function(){var t=0,e=null;return{add:function(i){t==0&&(e=I1e())&&(k1e(e,i),P1e(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},M1e=function(){var t=N1e();return function(e,i){K.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&i])}},Eee=function(){var t=M1e(),e=function(i){var n=i.styles,o=i.dynamic;return t(n,o),null};return e},D1e={left:0,top:0,right:0,gap:0},Bj=function(t){return parseInt(t||"",10)||0},R1e=function(t){var e=window.getComputedStyle(document.body),i=e[t==="padding"?"paddingLeft":"marginLeft"],n=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[Bj(i),Bj(n),Bj(o)]},j1e=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return D1e;var e=R1e(t),i=document.documentElement.clientWidth,n=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,n-i+e[2]-e[0])}},z1e=Eee(),A0="data-scroll-locked",L1e=function(t,e,i,n){var o=t.left,c=t.top,f=t.right,r=t.gap;return i===void 0&&(i="margin"),` 619 .`.concat(_1e,` { 620 overflow: hidden `).concat(n,`; 621 padding-right: `).concat(r,"px ").concat(n,`; 622 } 623 body[`).concat(A0,`] { 624 overflow: hidden `).concat(n,`; 625 overscroll-behavior: contain; 626 `).concat([e&&"position: relative ".concat(n,";"),i==="margin"&&` 627 padding-left: `.concat(o,`px; 628 padding-top: `).concat(c,`px; 629 padding-right: `).concat(f,`px; 630 margin-left:0; 631 margin-top:0; 632 margin-right: `).concat(r,"px ").concat(n,`; 633 `),i==="padding"&&"padding-right: ".concat(r,"px ").concat(n,";")].filter(Boolean).join(""),` 634 } 635 636 .`).concat(KI,` { 637 right: `).concat(r,"px ").concat(n,`; 638 } 639 640 .`).concat(ZI,` { 641 margin-right: `).concat(r,"px ").concat(n,`; 642 } 643 644 .`).concat(KI," .").concat(KI,` { 645 right: 0 `).concat(n,`; 646 } 647 648 .`).concat(ZI," .").concat(ZI,` { 649 margin-right: 0 `).concat(n,`; 650 } 651 652 body[`).concat(A0,`] { 653 `).concat(v1e,": ").concat(r,`px; 654 } 655`)},gq=function(){var t=parseInt(document.body.getAttribute(A0)||"0",10);return isFinite(t)?t:0},O1e=function(){K.useEffect(function(){return document.body.setAttribute(A0,(gq()+1).toString()),function(){var t=gq()-1;t<=0?document.body.removeAttribute(A0):document.body.setAttribute(A0,t.toString())}},[])},F1e=function(t){var e=t.noRelative,i=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;O1e();var c=K.useMemo(function(){return j1e(o)},[o]);return K.createElement(z1e,{styles:L1e(c,!e,o,i?"":"!important")})},fO=!1;if(typeof window<"u")try{var JA=Object.defineProperty({},"passive",{get:function(){return fO=!0,!0}});window.addEventListener("test",JA,JA),window.removeEventListener("test",JA,JA)}catch{fO=!1}var $x=fO?{passive:!1}:!1,B1e=function(t){return t.tagName==="TEXTAREA"},Aee=function(t,e){if(!(t instanceof Element))return!1;var i=window.getComputedStyle(t);return i[e]!=="hidden"&&!(i.overflowY===i.overflowX&&!B1e(t)&&i[e]==="visible")},U1e=function(t){return Aee(t,"overflowY")},V1e=function(t){return Aee(t,"overflowX")},yq=function(t,e){var i=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=Iee(t,n);if(o){var c=kee(t,n),f=c[1],r=c[2];if(f>r)return!0}n=n.parentNode}while(n&&n!==i.body);return!1},$1e=function(t){var e=t.scrollTop,i=t.scrollHeight,n=t.clientHeight;return[e,i,n]},q1e=function(t){var e=t.scrollLeft,i=t.scrollWidth,n=t.clientWidth;return[e,i,n]},Iee=function(t,e){return t==="v"?U1e(e):V1e(e)},kee=function(t,e){return t==="v"?$1e(e):q1e(e)},H1e=function(t,e){return t==="h"&&e==="rtl"?-1:1}
vendor: 8,441 bytes, lines 655-658
655,G1e=function(t,e,i,n,o){var c=H1e(t,window.getComputedStyle(e).direction),f=c*n,r=i.target,x=e.contains(r),S=!1,C=f>0,I=0,N=0;do{var D=kee(t,r),V=D[0],B=D[1],W=D[2],$=B-W-c*V;(V||$)&&Iee(t,r)&&(I+=$,N+=V),r instanceof ShadowRoot?r=r.host:r=r.parentNode}while(!x&&r!==document.body||x&&(e.contains(r)||e===r));return(C&&(Math.abs(I)<1||!o)||!C&&(Math.abs(N)<1||!o))&&(S=!0),S},eI=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},_q=function(t){return[t.deltaX,t.deltaY]},vq=function(t){return t&&"current"in t?t.current:t},W1e=function(t,e){return t[0]===e[0]&&t[1]===e[1]},K1e=function(t){return` 656 .block-interactivity-`.concat(t,` {pointer-events: none;} 657 .allow-interactivity-`).concat(t,` {pointer-events: all;} 658`)},Z1e=0,qx=[];function X1e(t){var e=K.useRef([]),i=K.useRef([0,0]),n=K.useRef(),o=K.useState(Z1e++)[0],c=K.useState(Eee)[0],f=K.useRef(t);K.useEffect(function(){f.current=t},[t]),K.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var B=y1e([t.lockRef.current],(t.shards||[]).map(vq),!0).filter(Boolean);return B.forEach(function(W){return W.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),B.forEach(function(W){return W.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var r=K.useCallback(function(B,W){if("touches"in B&&B.touches.length===2||B.type==="wheel"&&B.ctrlKey)return!f.current.allowPinchZoom;var $=eI(B),G=i.current,te="deltaX"in B?B.deltaX:G[0]-$[0],ce="deltaY"in B?B.deltaY:G[1]-$[1],_e,Te=B.target,we=Math.abs(te)>Math.abs(ce)?"h":"v";if("touches"in B&&we==="h"&&Te.type==="range")return!1;var Ne=yq(we,Te);if(!Ne)return!0;if(Ne?_e=we:(_e=we==="v"?"h":"v",Ne=yq(we,Te)),!Ne)return!1;if(!n.current&&"changedTouches"in B&&(te||ce)&&(n.current=_e),!_e)return!0;var pe=n.current||_e;return G1e(pe,W,B,pe==="h"?te:ce,!0)},[]),x=K.useCallback(function(B){var W=B;if(!(!qx.length||qx[qx.length-1]!==c)){var $="deltaY"in W?_q(W):eI(W),G=e.current.filter(function(_e){return _e.name===W.type&&(_e.target===W.target||W.target===_e.shadowParent)&&W1e(_e.delta,$)})[0];if(G&&G.should){W.cancelable&&W.preventDefault();return}if(!G){var te=(f.current.shards||[]).map(vq).filter(Boolean).filter(function(_e){return _e.contains(W.target)}),ce=te.length>0?r(W,te[0]):!f.current.noIsolation;ce&&W.cancelable&&W.preventDefault()}}},[]),S=K.useCallback(function(B,W,$,G){var te={name:B,delta:W,target:$,should:G,shadowParent:Y1e($)};e.current.push(te),setTimeout(function(){e.current=e.current.filter(function(ce){return ce!==te})},1)},[]),C=K.useCallback(function(B){i.current=eI(B),n.current=void 0},[]),I=K.useCallback(function(B){S(B.type,_q(B),B.target,r(B,t.lockRef.current))},[]),N=K.useCallback(function(B){S(B.type,eI(B),B.target,r(B,t.lockRef.current))},[]);K.useEffect(function(){return qx.push(c),t.setCallbacks({onScrollCapture:I,onWheelCapture:I,onTouchMoveCapture:N}),document.addEventListener("wheel",x,$x),document.addEventListener("touchmove",x,$x),document.addEventListener("touchstart",C,$x),function(){qx=qx.filter(function(B){return B!==c}),document.removeEventListener("wheel",x,$x),document.removeEventListener("touchmove",x,$x),document.removeEventListener("touchstart",C,$x)}},[]);var D=t.removeScrollBar,V=t.inert;return K.createElement(K.Fragment,null,V?K.createElement(c,{styles:K1e(o)}):null,D?K.createElement(F1e,{gapMode:t.gapMode}):null)}function Y1e(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Q1e=E1e(Cee,X1e);var gE=K.forwardRef(function(t,e){return K.createElement(uM,Mh({},t,{ref:e,sideCar:Q1e}))});gE.classNames=uM.classNames;var J1e=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Hx=new WeakMap,tI=new WeakMap,iI={},Uj=0,Pee=function(t){return t&&(t.host||Pee(t.parentNode))},ewe=function(t,e){return e.map(function(i){if(t.contains(i))return i;var n=Pee(i);return n&&t.contains(n)?n:(console.error("aria-hidden",i,"in not contained inside",t,". Doing nothing"),null)}).filter(function(i){return!!i})},twe=function(t,e,i,n){var o=ewe(e,Array.isArray(t)?t:[t]);iI[i]||(iI[i]=new WeakMap);var c=iI[i],f=[],r=new Set,x=new Set(o),S=function(I){!I||r.has(I)||(r.add(I),S(I.parentNode))};o.forEach(S);var C=function(I){!I||x.has(I)||Array.prototype.forEach.call(I.children,function(N){if(r.has(N))C(N);else try{var D=N.getAttribute(n),V=D!==null&&D!=="false",B=(Hx.get(N)||0)+1,W=(c.get(N)||0)+1;Hx.set(N,B),c.set(N,W),f.push(N),B===1&&V&&tI.set(N,!0),W===1&&N.setAttribute(i,"true"),V||N.setAttribute(n,"true")}catch($){console.error("aria-hidden: cannot operate on ",N,$)}})};return C(e),r.clear(),Uj++,function(){f.forEach(function(I){var N=Hx.get(I)-1,D=c.get(I)-1;Hx.set(I,N),c.set(I,D),N||(tI.has(I)||I.removeAttribute(n),tI.delete(I)),D||I.removeAttribute(i)}),Uj--,Uj||(Hx=new WeakMap,Hx=new WeakMap,tI=new WeakMap,iI={})}},dM=function(t,e,i){i===void 0&&(i="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=J1e(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),twe(n,o,i,"aria-hidden")):function(){return null}},u4="Dialog",[Nee,Mee]=Wa(u4),[iwe,qd]=Nee(u4),Dee=t=>{const{__scopeDialog:e,children:i,open:n,defaultOpen:o,onOpenChange:c,modal:f=!0}=t,r=K.useRef(null),x=K.useRef(null),[S=!1,C]=lu({prop:n,defaultProp:o,onChange:c});return d.jsx(iwe,{scope:e,triggerRef:r,contentRef:x,contentId:nu(),titleId:nu(),descriptionId:nu(),open:S,onOpenChange:C,onOpenToggle:K.useCallback(()=>C(I=>!I),[C]),modal:f,children:i})};Dee.displayName=u4;var Ree="DialogTrigger",jee=K.forwardRef((t,e)=>{const{__scopeDialog:i,...n}=t,o=qd(Ree,i),c=wr(e,o.triggerRef);return d.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":p4(o.open),...n,ref:c,onClick:Ni(t.onClick,o.onOpenToggle)})});jee.displayName=Ree;var d4="DialogPortal",[nwe,zee]=Nee(d4,{forceMount:void 0}),Lee=t=>{const{__scopeDialog:e,forceMount:i,children:n,container:o}=t,c=qd(d4,e);return d.jsx(nwe,{scope:e,forceMount:i,children:K.Children.map(n,f=>d.jsx(Ea,{present:i||c.open,children:d.jsx(Zb,{asChild:!0,container:o,children:f})}))})};Lee.displayName=d4;var Wk="DialogOverlay",Oee=K.forwardRef((t,e)=>{const i=zee(Wk,t.__scopeDialog),{forceMount:n=i.forceMount,...o}=t,c=qd(Wk,t.__scopeDialog);return c.modal?d.jsx(Ea,{present:n||c.open,children:d.jsx(swe,{...o,ref:e})}):null});Oee.displayName=Wk;var rwe=hg("DialogOverlay.RemoveScroll"),swe=K.forwardRef((t,e)=>{const{__scopeDialog:i,...n}=t,o=qd(Wk,i);return d.jsx(gE,{as:rwe,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(vn.div,{"data-state":p4(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),$_="DialogContent",Fee=K.forwardRef((t,e)=>{const i=zee($_,t.__scopeDialog),{forceMount:n=i.forceMount,...o}=t,c=qd($_,t.__scopeDialog);return d.jsx(Ea,{present:n||c.open,children:c.modal?d.jsx(owe,{...o,ref:e}):d.jsx(awe,{...o,ref:e})})});Fee.displayName=$_;var owe=K.forwardRef((t,e)=>{const i=qd($_,t.__scopeDialog),n=K.useRef(null),o=wr(e,i.contentRef,n);return K.useEffect(()=>{const c=n.current;if(c)return dM(c)},[]),d.jsx(Bee,{...t,ref:o,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ni(t.onCloseAutoFocus,c=>{var f;c.preventDefault(),(f=i.triggerRef.current)==null||f.focus()}),onPointerDownOutside:Ni(t.onPointerDownOutside,c=>{const f=c.detail.originalEvent,r=f.button===0&&f.ctrlKey===!0;(f.button===2||r)&&c.preventDefault()}),onFocusOutside:Ni(t.onFocusOutside,c=>c.preventDefault())})}),awe=K.forwardRef((t,e)=>{const i=qd($_,t.__scopeDialog),n=K.useRef(!1),o=K.useRef(!1);return d.jsx(Bee,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var f,r;(f=t.onCloseAutoFocus)==null||f.call(t,c),c.defaultPrevented||(n.current||(r=i.triggerRef.current)==null||r.focus(),c.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:c=>{var x,S;(x=t.onInteractOutside)==null||x.call(t,c),c.defaultPrevented||(n.current=!0,c.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const f=c.target;((S=i.triggerRef.current)==null?void 0:S.contains(f))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&o.current&&c.preventDefault()}})}),Bee=K.forwardRef((t,e)=>{const{__scopeDialog:i,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:c,...f}
vendor: 4,570 bytes, lines 658-668
658=t,r=qd($_,i),x=K.useRef(null),S=wr(e,x);return cM(),d.jsxs(d.Fragment,{children:[d.jsx(mE,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:c,children:d.jsx(av,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":p4(r.open),...f,ref:S,onDismiss:()=>r.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(cwe,{titleId:r.titleId}),d.jsx(dwe,{contentRef:x,descriptionId:r.descriptionId})]})]})}),h4="DialogTitle",Uee=K.forwardRef((t,e)=>{const{__scopeDialog:i,...n}=t,o=qd(h4,i);return d.jsx(vn.h2,{id:o.titleId,...n,ref:e})});Uee.displayName=h4;var Vee="DialogDescription",$ee=K.forwardRef((t,e)=>{const{__scopeDialog:i,...n}=t,o=qd(Vee,i);return d.jsx(vn.p,{id:o.descriptionId,...n,ref:e})});$ee.displayName=Vee;var qee="DialogClose",Hee=K.forwardRef((t,e)=>{const{__scopeDialog:i,...n}=t,o=qd(qee,i);return d.jsx(vn.button,{type:"button",...n,ref:e,onClick:Ni(t.onClick,()=>o.onOpenChange(!1))})});Hee.displayName=qee;function p4(t){return t?"open":"closed"}var Gee="DialogTitleWarning",[lwe,Wee]=q_e(Gee,{contentName:$_,titleName:h4,docsSlug:"dialog"}),cwe=({titleId:t})=>{const e=Wee(Gee),i=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. 659 660If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. 661 662For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return K.useEffect(()=>{t&&(document.getElementById(t)||console.error(i))},[i,t]),null},uwe="DialogDescriptionWarning",dwe=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Wee(uwe).contentName}}.`;return K.useEffect(()=>{var c;const o=(c=t.current)==null?void 0:c.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},f4=Dee,Kee=jee,m4=Lee,yE=Oee,_E=Fee,vE=Uee,xE=$ee,hM=Hee,Zee="AlertDialog",[hwe,I8e]=Wa(Zee,[Mee]),hf=Mee(),Xee=t=>{const{__scopeAlertDialog:e,...i}=t,n=hf(e);return d.jsx(f4,{...n,...i,modal:!0})};Xee.displayName=Zee;var pwe="AlertDialogTrigger",fwe=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,o=hf(i);return d.jsx(Kee,{...o,...n,ref:e})});fwe.displayName=pwe;var mwe="AlertDialogPortal",Yee=t=>{const{__scopeAlertDialog:e,...i}=t,n=hf(e);return d.jsx(m4,{...n,...i})};Yee.displayName=mwe;var gwe="AlertDialogOverlay",Qee=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,o=hf(i);return d.jsx(yE,{...o,...n,ref:e})});Qee.displayName=gwe;var I0="AlertDialogContent",[ywe,_we]=hwe(I0),vwe=HQ("AlertDialogContent"),Jee=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,children:n,...o}=t,c=hf(i),f=K.useRef(null),r=wr(e,f),x=K.useRef(null);return d.jsx(lwe,{contentName:I0,titleName:ete,docsSlug:"alert-dialog",children:d.jsx(ywe,{scope:i,cancelRef:x,children:d.jsxs(_E,{role:"alertdialog",...c,...o,ref:r,onOpenAutoFocus:Ni(o.onOpenAutoFocus,S=>{var C;S.preventDefault(),(C=x.current)==null||C.focus({preventScroll:!0})}),onPointerDownOutside:S=>S.preventDefault(),onInteractOutside:S=>S.preventDefault(),children:[d.jsx(vwe,{children:n}),d.jsx(bwe,{contentRef:f})]})})})});Jee.displayName=I0;var ete="AlertDialogTitle",tte=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,o=hf(i);return d.jsx(vE,{...o,...n,ref:e})});tte.displayName=ete;var ite="AlertDialogDescription",nte=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,o=hf(i);return d.jsx(xE,{...o,...n,ref:e})});nte.displayName=ite;var xwe="AlertDialogAction",rte=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,o=hf(i);return d.jsx(hM,{...o,...n,ref:e})});rte.displayName=xwe;var ste="AlertDialogCancel",ote=K.forwardRef((t,e)=>{const{__scopeAlertDialog:i,...n}=t,{cancelRef:o}=_we(ste,i),c=hf(i),f=wr(e,o);return d.jsx(hM,{...c,...n,ref:f})});ote.displayName=ste;var bwe=({contentRef:t})=>{const e=`\`${I0}\` requires a description for the component to be accessible for screen reader users. 663 664You can add a description to the \`${I0}\` by passing a \`${ite}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 665 666Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${I0}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 667 668For more information, see https://radix-ui.com/primitives/docs/components/
668alert-dialog`;return K.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},wwe=Xee,Swe=Yee,ate=Qee,lte=Jee,cte=rte,ute=ote,dte=tte,hte=nte;const g4=Xb("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",{variants:{variant:{default:"bg-primary text-primary-foreground border border-primary-border",destructive:"bg-destructive text-destructive-foreground border border-destructive-border",outline:" border [border-color:var(--button-outline)] shadow-xs active:shadow-none ",secondary:"border bg-secondary text-secondary-foreground border border-secondary-border ",ghost:"border border-transparent"},size:{default:"min-h-9 px-4 py-2",sm:"min-h-8 rounded-md px-3 text-xs",lg:"min-h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),tt=K.forwardRef(({className:t,variant:e,size:i,asChild:n=!1,...o},c)=>{const f=n?$Q:"button";return d.jsx(f,{className:nn(g4({variant:e,size:i,className:t})),ref:c,...o})});tt.displayName="Button";const q_=wwe,Twe=Swe,pte=K.forwardRef(({className:t,...e},i)=>d.jsx(ate,{className:nn("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,ref:i}));pte.displayName=ate.displayName;const gg=K.forwardRef(({className:t,...e},i)=>d.jsxs(Twe,{children:[d.jsx(pte,{}),d.jsx(lte,{ref:i,className:nn("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),...e})]}));gg.displayName=lte.displayName;const yg=({className:t,...e})=>d.jsx("div",{className:nn("flex flex-col space-y-2 text-center sm:text-left",t),...e});yg.displayName="AlertDialogHeader";const _g=({className:t,...e})=>d.jsx("div",{className:nn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});_g.displayName="AlertDialogFooter";const vg=K.forwardRef(({className:t,...e},i)=>d.jsx(dte,{ref:i,className:nn("text-lg font-semibold",t),...e}));vg.displayName=dte.displayName;const xg=K.forwardRef(({className:t,...e},i)=>d.jsx(hte,{ref:i,className:nn("text-sm text-muted-foreground",t),...e}));xg.displayName=hte.displayName;const H_=K.forwardRef(({className:t,...e},i)=>d.jsx(cte,{ref:i,className:nn(g4(),t),...e}));H_.displayName=cte.displayName;const G_=K.forwardRef(({className:t,...e},i)=>d.jsx(ute,{ref:i,className:nn(g4({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));G_.displayName=ute.displayName;function y4(t){const e=K.useRef({value:t,previous:t});return K.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var _4="Checkbox",[Cwe,k8e]=Wa(_4),[Ewe,Awe]=Cwe(_4),fte=K.forwardRef((t,e)=>{const{__scopeCheckbox:i,name:n,checked:o,defaultChecked:c,required:f,disabled:r,value:x="on",onCheckedChange:S,form:C,...I}=t,[N,D]=K.useState(null),V=wr(e,ce=>D(ce)),B=K.useRef(!1),W=N?C||!!N.closest("form"):!0,[$=!1,G]=lu({prop:o,defaultProp:c,onChange:S}),te=K.useRef($);return K.useEffect(()=>{const ce=N==null?void 0:N.form;if(ce){const _e=()=>G(te.current);return ce.addEventListener("reset",_e),()=>ce.removeEventListener("reset",_e)}},[N,G]),d.jsxs(Ewe,{scope:i,state:$,disabled:r,children:[d.jsx(vn.button,{type:"button",role:"checkbox","aria-checked":ng($)?"mixed":$,"aria-required":f,"data-state":yte($),"data-disabled":r?"":void 0,disabled:r,value:x,...I,ref:V,onKeyDown:Ni(t.onKeyDown,ce=>{ce.key==="Enter"&&ce.preventDefault()}),onClick:Ni(t.onClick,ce=>{G(_e=>ng(_e)?!0:!_e),W&&(B.current=ce.isPropagationStopped(),B.current||ce.stopPropagation())})}),W&&d.jsx(Iwe,{control:N,bubbles:!B.current,name:n,value:x,checked:$,required:f,disabled:r,form:C,style:{transform:"translateX(-100%)"},defaultChecked:ng(c)?!1:c})]})});fte.displayName=_4;var mte="CheckboxIndicator",gte=K.forwardRef((t,e)=>{const{__scopeCheckbox:i,forceMount:n,...o}=t,c=Awe(mte,i);return d.jsx(Ea,{present:n||ng(c.state)||c.state===!0,children:d.jsx(vn.span,{"data-state":yte(c.state),"data-disabled":c.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});gte.displayName=mte;var Iwe=t=>{const{control:e,checked:i,bubbles:n=!0,defaultChecked:o,...c}=t,f=K.useRef(null),r=y4(i),x=s4(e);K.useEffect(()=>{const C=f.current,I=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(I,"checked").set;if(r!==i&&D){const V=new Event("click",{bubbles:n});C.indeterminate=ng(i),D.call(C,ng(i)?!1:i),C.dispatchEvent(V)}},[r,i,n]);const S=K.useRef(ng(i)?!1:i);return d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??S.current,...c,tabIndex:-1,ref:f,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ng(t){return t==="indeterminate"}function yte(t){return ng(t)?"indeterminate":t?"checked":"unchecked"}var _te=fte,kwe=gte;const vte=K.forwardRef(({className:t,...e},i)=>d.jsx(_te,{ref:i,className:nn("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:d.jsx(kwe,{className:nn("flex items-center justify-center text-current"),children:d.jsx(Cd,{className:"h-4 w-4"})})}));vte.displayName=_te.displayName;var Pwe=K.createContext(void 0);function o1(t){const e=K.useContext(Pwe);return t||e||"ltr"}function mO(t,[e,i]){return Math.min(i,Math.max(e,t))}function Nwe(t,e){return K.useReducer((i,n)=>e[i][n]??i,t)}var v4="ScrollArea",[xte,P8e]=Wa(v4),[Mwe,qu]=xte(v4),bte=K.forwardRef((t,e)=>{const{__scopeScrollArea:i,type:n="hover",dir:o,scrollHideDelay:c=600,...f}=t,[r,x]=K.useState(null),[S,C]=K.useState(null),[I,N]=K.useState(null),[D,V]=K.useState(null),[B,W]=K.useState(null),[$,G]=K.useState(0),[te,ce]=K.useState(0),[_e,Te]=K.useState(!1),[we,Ne]=K.useState(!1),pe
vendor: 8,666 bytes, line 668
668=wr(e,De=>x(De)),Pe=o1(o);return d.jsx(Mwe,{scope:i,type:n,dir:Pe,scrollHideDelay:c,scrollArea:r,viewport:S,onViewportChange:C,content:I,onContentChange:N,scrollbarX:D,onScrollbarXChange:V,scrollbarXEnabled:_e,onScrollbarXEnabledChange:Te,scrollbarY:B,onScrollbarYChange:W,scrollbarYEnabled:we,onScrollbarYEnabledChange:Ne,onCornerWidthChange:G,onCornerHeightChange:ce,children:d.jsx(vn.div,{dir:Pe,...f,ref:pe,style:{position:"relative","--radix-scroll-area-corner-width":$+"px","--radix-scroll-area-corner-height":te+"px",...t.style}})})});bte.displayName=v4;var wte="ScrollAreaViewport",Ste=K.forwardRef((t,e)=>{const{__scopeScrollArea:i,children:n,nonce:o,...c}=t,f=qu(wte,i),r=K.useRef(null),x=wr(e,r,f.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(vn.div,{"data-radix-scroll-area-viewport":"",...c,ref:x,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Ste.displayName=wte;var Qh="ScrollAreaScrollbar",x4=K.forwardRef((t,e)=>{const{forceMount:i,...n}=t,o=qu(Qh,t.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:f}=o,r=t.orientation==="horizontal";return K.useEffect(()=>(r?c(!0):f(!0),()=>{r?c(!1):f(!1)}),[r,c,f]),o.type==="hover"?d.jsx(Dwe,{...n,ref:e,forceMount:i}):o.type==="scroll"?d.jsx(Rwe,{...n,ref:e,forceMount:i}):o.type==="auto"?d.jsx(Tte,{...n,ref:e,forceMount:i}):o.type==="always"?d.jsx(b4,{...n,ref:e}):null});x4.displayName=Qh;var Dwe=K.forwardRef((t,e)=>{const{forceMount:i,...n}=t,o=qu(Qh,t.__scopeScrollArea),[c,f]=K.useState(!1);return K.useEffect(()=>{const r=o.scrollArea;let x=0;if(r){const S=()=>{window.clearTimeout(x),f(!0)},C=()=>{x=window.setTimeout(()=>f(!1),o.scrollHideDelay)};return r.addEventListener("pointerenter",S),r.addEventListener("pointerleave",C),()=>{window.clearTimeout(x),r.removeEventListener("pointerenter",S),r.removeEventListener("pointerleave",C)}}},[o.scrollArea,o.scrollHideDelay]),d.jsx(Ea,{present:i||c,children:d.jsx(Tte,{"data-state":c?"visible":"hidden",...n,ref:e})})}),Rwe=K.forwardRef((t,e)=>{const{forceMount:i,...n}=t,o=qu(Qh,t.__scopeScrollArea),c=t.orientation==="horizontal",f=fM(()=>x("SCROLL_END"),100),[r,x]=Nwe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return K.useEffect(()=>{if(r==="idle"){const S=window.setTimeout(()=>x("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(S)}},[r,o.scrollHideDelay,x]),K.useEffect(()=>{const S=o.viewport,C=c?"scrollLeft":"scrollTop";if(S){let I=S[C];const N=()=>{const D=S[C];I!==D&&(x("SCROLL"),f()),I=D};return S.addEventListener("scroll",N),()=>S.removeEventListener("scroll",N)}},[o.viewport,c,x,f]),d.jsx(Ea,{present:i||r!=="hidden",children:d.jsx(b4,{"data-state":r==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:Ni(t.onPointerEnter,()=>x("POINTER_ENTER")),onPointerLeave:Ni(t.onPointerLeave,()=>x("POINTER_LEAVE"))})})}),Tte=K.forwardRef((t,e)=>{const i=qu(Qh,t.__scopeScrollArea),{forceMount:n,...o}=t,[c,f]=K.useState(!1),r=t.orientation==="horizontal",x=fM(()=>{if(i.viewport){const S=i.viewport.offsetWidth<i.viewport.scrollWidth,C=i.viewport.offsetHeight<i.viewport.scrollHeight;f(r?S:C)}},10);return kb(i.viewport,x),kb(i.content,x),d.jsx(Ea,{present:n||c,children:d.jsx(b4,{"data-state":c?"visible":"hidden",...o,ref:e})})}),b4=K.forwardRef((t,e)=>{const{orientation:i="vertical",...n}=t,o=qu(Qh,t.__scopeScrollArea),c=K.useRef(null),f=K.useRef(0),[r,x]=K.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),S=kte(r.viewport,r.content),C={...n,sizes:r,onSizesChange:x,hasThumb:S>0&&S<1,onThumbChange:N=>c.current=N,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:N=>f.current=N};function I(N,D){return Bwe(N,f.current,r,D)}return i==="horizontal"?d.jsx(jwe,{...C,ref:e,onThumbPositionChange:()=>{if(o.viewport&&c.current){const N=o.viewport.scrollLeft,D=xq(N,r,o.dir);c.current.style.transform=`translate3d(${D}px, 0, 0)`}},onWheelScroll:N=>{o.viewport&&(o.viewport.scrollLeft=N)},onDragScroll:N=>{o.viewport&&(o.viewport.scrollLeft=I(N,o.dir))}}):i==="vertical"?d.jsx(zwe,{...C,ref:e,onThumbPositionChange:()=>{if(o.viewport&&c.current){const N=o.viewport.scrollTop,D=xq(N,r);c.current.style.transform=`translate3d(0, ${D}px, 0)`}},onWheelScroll:N=>{o.viewport&&(o.viewport.scrollTop=N)},onDragScroll:N=>{o.viewport&&(o.viewport.scrollTop=I(N))}}):null}),jwe=K.forwardRef((t,e)=>{const{sizes:i,onSizesChange:n,...o}=t,c=qu(Qh,t.__scopeScrollArea),[f,r]=K.useState(),x=K.useRef(null),S=wr(e,x,c.onScrollbarXChange);return K.useEffect(()=>{x.current&&r(getComputedStyle(x.current))},[x]),d.jsx(Ete,{"data-orientation":"horizontal",...o,ref:S,sizes:i,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":pM(i)+"px",...t.style},onThumbPointerDown:C=>t.onThumbPointerDown(C.x),onDragScroll:C=>t.onDragScroll(C.x),onWheelScroll:(C,I)=>{if(c.viewport){const N=c.viewport.scrollLeft+C.deltaX;t.onWheelScroll(N),Nte(N,I)&&C.preventDefault()}},onResize:()=>{x.current&&c.viewport&&f&&n({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:x.current.clientWidth,paddingStart:Zk(f.paddingLeft),paddingEnd:Zk(f.paddingRight)}})}})}),zwe=K.forwardRef((t,e)=>{const{sizes:i,onSizesChange:n,...o}=t,c=qu(Qh,t.__scopeScrollArea),[f,r]=K.useState(),x=K.useRef(null),S=wr(e,x,c.onScrollbarYChange);return K.useEffect(()=>{x.current&&r(getComputedStyle(x.current))},[x]),d.jsx(Ete,{"data-orientation":"vertical",...o,ref:S,sizes:i,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":pM(i)+"px",...t.style},onThumbPointerDown:C=>t.onThumbPointerDown(C.y),onDragScroll:C=>t.onDragScroll(C.y),onWheelScroll:(C,I)=>{if(c.viewport){const N=c.viewport.scrollTop+C.deltaY;t.onWheelScroll(N),Nte(N,I)&&C.preventDefault()}},onResize:()=>{x.current&&c.viewport&&f&&n({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:x.current.clientHeight,paddingStart:Zk(f.paddingTop),paddingEnd:Zk(f.paddingBottom)}})}})}),[Lwe,Cte]=xte(Qh),Ete=K.forwardRef((t,e)=>{const{__scopeScrollArea:i,sizes:n,hasThumb:o,onThumbChange:c,onThumbPointerUp:f,onThumbPointerDown:r,onThumbPositionChange:x,onDragScroll:S,onWheelScroll:C,onResize:I,...N}=t,D=qu(Qh,i),[V,B]=K.useState(null),W=wr(e,pe=>B(pe)),$=K.useRef(null),G=K.useRef(""),te=D.viewport,ce=n.content-n.viewport,_e=go(C),Te=go(x),we=fM(I,10);function Ne(pe){if($.current){const Pe=pe.clientX-$.current.left,De=pe.clientY-$.current.top;S({x:Pe,y:De})}}return K.useEffect(()=>{const pe=Pe=>{const De=Pe.target;(V==null?void 0:V.contains(De))&&_e(Pe,ce)};return document.addEventListener("wheel",pe,{passive:!1}),()=>document.removeEventListener("wheel",pe,{passive:!1})},[te,V,ce,_e]),K.useEffect(Te,[n,Te]),kb(V,we),kb(D.content,we),d.jsx(Lwe,{scope:i,scrollbar:V,hasThumb:o,onThumbChange:go(c),onThumbPointerUp:go(f),onThumbPositionChange:Te,onThumbPointerDown:go(r),children:d.jsx(vn.div,{...N,ref:W,style:{position:"absolute",...N.style},onPointerDown:Ni(t.onPointerDown,pe=>{pe.button===0&&(pe.target.setPointerCapture(pe.pointerId),$.current=V.getBoundingClientRect(),G.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",D.viewport&&(D.viewport.style.scrollBehavior="auto"),Ne(pe))}),onPointerMove:Ni(t.onPointerMove,Ne),onPointerUp:Ni(t.onPointerUp,pe=>{const Pe=pe.target;Pe.hasPointerCapture(pe.pointerId)&&Pe.releasePointerCapture(pe.pointerId),document.body.style.webkitUserSelect=G.current,D.viewport&&(D.viewport.style.scrollBehavior=""),$.current=null})})})}),Kk="ScrollAreaThumb",Ate=K.forwardRef((t,e)=>{const{forceMount:i,...n}=t,o=Cte(Kk,t.__scopeScrollArea);return d.jsx(Ea,{present:i||o.hasThumb,children:d.jsx(Owe,{ref:e,...n})})}),Owe=K.forwardRef((t,e)=>{const{__scopeScrollArea:i,style:n,...o}=t,c=qu(Kk,i),f=Cte(Kk,i),{onThumbPositionChange:r}=f,x=wr(e,I=>f.onThumbChange(I)),S=K.useRef(void 0),C=fM(()=>{S.current&&(S.current(),S.current=void 0)},100);return K.useEffect(()=>{const I=c.viewport;if(I){const N=()=>
668{if(C(),!S.current){const D=Uwe(I,r);S.current=D,r()}};return r(),I.addEventListener("scroll",N),()=>I.removeEventListener("scroll",N)}},[c.viewport,C,r]),d.jsx(vn.div,{"data-state":f.hasThumb?"visible":"hidden",...o,ref:x,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ni(t.onPointerDownCapture,I=>{const D=I.target.getBoundingClientRect(),V=I.clientX-D.left,B=I.clientY-D.top;f.onThumbPointerDown({x:V,y:B})}),onPointerUp:Ni(t.onPointerUp,f.onThumbPointerUp)})});Ate.displayName=Kk;var w4="ScrollAreaCorner",Ite=K.forwardRef((t,e)=>{const i=qu(w4,t.__scopeScrollArea),n=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&n?d.jsx(Fwe,{...t,ref:e}):null});Ite.displayName=w4;var Fwe=K.forwardRef((t,e)=>{const{__scopeScrollArea:i,...n}=t,o=qu(w4,i),[c,f]=K.useState(0),[r,x]=K.useState(0),S=!!(c&&r);return kb(o.scrollbarX,()=>{var I;const C=((I=o.scrollbarX)==null?void 0:I.offsetHeight)||0;o.onCornerHeightChange(C),x(C)}),kb(o.scrollbarY,()=>{var I;const C=((I=o.scrollbarY)==null?void 0:I.offsetWidth)||0;o.onCornerWidthChange(C),f(C)}),S?d.jsx(vn.div,{...n,ref:e,style:{width:c,height:r,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Zk(t){return t?parseInt(t,10):0}function kte(t,e){const i=t/e;return isNaN(i)?0:i}function pM(t){const e=kte(t.viewport,t.content),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-i)*e;return Math.max(n,18)}function Bwe(t,e,i,n="ltr"){const o=pM(i),c=o/2,f=e||c,r=o-f,x=i.scrollbar.paddingStart+f,S=i.scrollbar.size-i.scrollbar.paddingEnd-r,C=i.content-i.viewport,I=n==="ltr"?[0,C]:[C*-1,0];return Pte([x,S],I)(t)}function xq(t,e,i="ltr"){const n=pM(e),o=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,c=e.scrollbar.size-o,f=e.content-e.viewport,r=c-n,x=i==="ltr"?[0,f]:[f*-1,0],S=mO(t,x);return Pte([0,f],[0,r])(S)}function Pte(t,e){return i=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(i-t[0])}}function Nte(t,e){return t>0&&t<e}var Uwe=(t,e=()=>{})=>{let i={left:t.scrollLeft,top:t.scrollTop},n=0;return function o(){const c={left:t.scrollLeft,top:t.scrollTop},f=i.left!==c.left,r=i.top!==c.top;(f||r)&&e(),i=c,n=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(n)};function fM(t,e){const i=go(t),n=K.useRef(0);return K.useEffect(()=>()=>window.clearTimeout(n.current),[]),K.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(i,e)},[i,e])}function kb(t,e){const i=go(e);Jo(()=>{let n=0;if(t){const o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(i)});return o.observe(t),()=>{window.cancelAnimationFrame(n),o.unobserve(t)}}},[t,i])}var Mte=bte,Vwe=Ste,$we=Ite;const yT=K.forwardRef(({className:t,children:e,...i},n)=>d.jsxs(Mte,{ref:n,className:nn("relative overflow-hidden",t),...i,children:[d.jsx(Vwe,{className:"h-full w-full rounded-[inherit]",children:e}),d.jsx(Dte,{}),d.jsx($we,{})]}));yT.displayName=Mte.displayName;const Dte=K.forwardRef(({className:t,orientation:e="vertical",...i},n)=>d.jsx(x4,{ref:n,orientation:e,className:nn("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...i,children:d.jsx(Ate,{className:"relative flex-1 rounded-full bg-border"})}));Dte.displayName=x4.displayName;function qwe({open:t,onAccepted:e}){const{t:i}=pr(),{toast:n}=ks(),[o,c]=K.useState(!1),f=$n({mutationFn:async()=>(await xn("POST","/api/user/accept-privacy")).json(),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/auth/user"]}),n({title:i("privacy.acceptedTitle"),description:i("privacy.acceptedDesc")}),e()},onError:()=>{n({title:i("common.error"),description:i("privacy.acceptError"),variant:"destructive"})}}),r=()=>{o&&f.mutate()};return d.jsx(q_,{open:t,children:d.jsxs(gg,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[d.jsxs(yg,{children:[d.jsx(vg,{"data-testid":"text-privacy-dialog-title",children:i("privacy.dialogTitle")}),d.jsx(xg,{children:i("privacy.dialogDesc")})]}),d.jsx(yT,{className:"flex-1 max-h-[400px] pr-4",children:d.jsxs("div",{className:"space-y-4 text-sm",children:[d.jsxs("section",{children:[d.jsx("h3",{className:"font-semibold mb-2",children:i("privacy.dataControllerTitle")}),d.jsx("p",{className:"text-muted-foreground",children:i("privacy.dataControllerText")})]}),d.jsxs("section",{children:[d.jsx("h3",{className:"font-semibold mb-2",children:i("privacy.dataCollectedTitle")}),d.jsx("p",{className:"text-muted-foreground",children:i("privacy.dataCollectedText")})]}),d.jsxs("section",{children:[d.jsx("h3",{className:"font-semibold mb-2",children:i("privacy.purposeTitle")}),d.jsx("p",{className:"text-muted-foreground",children:i("privacy.purposeText")})]}),d.jsxs("section",{children:[d.jsx("h3",{className:"font-semibold mb-2",children:i("privacy.rightsTitle")}),d.jsx("p",{className:"text-muted-foreground",children:i("privacy.rightsText")})]}),d.jsx("p",{className:"text-muted-foreground",children:d.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline","data-testid":"link-full-privacy",children:i("privacy.readFullPolicy")})})]})}),d.jsxs("div",{className:"flex items-start space-x-3 py-4 border-t",children:[d.jsx(vte,{id:"accept-privacy",checked:o,onCheckedChange:x=>c(x===!0),"data-testid":"checkbox-accept-privacy"}),d.jsx("label",{htmlFor:"accept-privacy",className:"text-sm leading-tight cursor-pointer",children:i("privacy.acceptCheckbox")}
vendor: 20,015 bytes, line 668
668)]}),d.jsx(_g,{children:d.jsxs(tt,{onClick:r,disabled:!o||f.isPending,"data-testid":"button-confirm-privacy",children:[f.isPending&&d.jsx(lv,{className:"w-4 h-4 mr-2 animate-spin"}),i("privacy.acceptButton")]})})]})})}const Hwe=Xb("whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 hover-elevate ",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-xs",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-xs",outline:" border [border-color:var(--badge-outline)] shadow-xs"}},defaultVariants:{variant:"default"}});function En({className:t,variant:e,...i}){return d.jsx("div",{className:nn(Hwe({variant:e}),t),...i})}const an=K.forwardRef(({className:t,type:e,...i},n)=>d.jsx("input",{type:e,className:nn("flex h-9 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:n,...i}));an.displayName="Input";var Gwe=[" ","Enter","ArrowUp","ArrowDown"],Wwe=[" ","Enter"],bE="Select",[mM,gM,Kwe]=dE(bE),[a1,N8e]=Wa(bE,[Kwe,Dg]),yM=Dg(),[Zwe,Rg]=a1(bE),[Xwe,Ywe]=a1(bE),Rte=t=>{const{__scopeSelect:e,children:i,open:n,defaultOpen:o,onOpenChange:c,value:f,defaultValue:r,onValueChange:x,dir:S,name:C,autoComplete:I,disabled:N,required:D,form:V}=t,B=yM(e),[W,$]=K.useState(null),[G,te]=K.useState(null),[ce,_e]=K.useState(!1),Te=o1(S),[we=!1,Ne]=lu({prop:n,defaultProp:o,onChange:c}),[pe,Pe]=lu({prop:f,defaultProp:r,onChange:x}),De=K.useRef(null),Je=W?V||!!W.closest("form"):!0,[dt,At]=K.useState(new Set),qt=Array.from(dt).map(kt=>kt.props.value).join(";");return d.jsx(l4,{...B,children:d.jsxs(Zwe,{required:D,scope:e,trigger:W,onTriggerChange:$,valueNode:G,onValueNodeChange:te,valueNodeHasChildren:ce,onValueNodeHasChildrenChange:_e,contentId:nu(),value:pe,onValueChange:Pe,open:we,onOpenChange:Ne,dir:Te,triggerPointerDownPosRef:De,disabled:N,children:[d.jsx(mM.Provider,{scope:e,children:d.jsx(Xwe,{scope:t.__scopeSelect,onNativeOptionAdd:K.useCallback(kt=>{At(Vt=>new Set(Vt).add(kt))},[]),onNativeOptionRemove:K.useCallback(kt=>{At(Vt=>{const Fe=new Set(Vt);return Fe.delete(kt),Fe})},[]),children:i})}),Je?d.jsxs(sie,{"aria-hidden":!0,required:D,tabIndex:-1,name:C,autoComplete:I,value:pe,onChange:kt=>Pe(kt.target.value),disabled:N,form:V,children:[pe===void 0?d.jsx("option",{value:""}):null,Array.from(dt)]},qt):null]})})};Rte.displayName=bE;var jte="SelectTrigger",zte=K.forwardRef((t,e)=>{const{__scopeSelect:i,disabled:n=!1,...o}=t,c=yM(i),f=Rg(jte,i),r=f.disabled||n,x=wr(e,f.onTriggerChange),S=gM(i),C=K.useRef("touch"),[I,N,D]=oie(B=>{const W=S().filter(te=>!te.disabled),$=W.find(te=>te.value===f.value),G=aie(W,B,$);G!==void 0&&f.onValueChange(G.value)}),V=B=>{r||(f.onOpenChange(!0),D()),B&&(f.triggerPointerDownPosRef.current={x:Math.round(B.pageX),y:Math.round(B.pageY)})};return d.jsx(fE,{asChild:!0,...c,children:d.jsx(vn.button,{type:"button",role:"combobox","aria-controls":f.contentId,"aria-expanded":f.open,"aria-required":f.required,"aria-autocomplete":"none",dir:f.dir,"data-state":f.open?"open":"closed",disabled:r,"data-disabled":r?"":void 0,"data-placeholder":rie(f.value)?"":void 0,...o,ref:x,onClick:Ni(o.onClick,B=>{B.currentTarget.focus(),C.current!=="mouse"&&V(B)}),onPointerDown:Ni(o.onPointerDown,B=>{C.current=B.pointerType;const W=B.target;W.hasPointerCapture(B.pointerId)&&W.releasePointerCapture(B.pointerId),B.button===0&&B.ctrlKey===!1&&B.pointerType==="mouse"&&(V(B),B.preventDefault())}),onKeyDown:Ni(o.onKeyDown,B=>{const W=I.current!=="";!(B.ctrlKey||B.altKey||B.metaKey)&&B.key.length===1&&N(B.key),!(W&&B.key===" ")&&Gwe.includes(B.key)&&(V(),B.preventDefault())})})})});zte.displayName=jte;var Lte="SelectValue",Ote=K.forwardRef((t,e)=>{const{__scopeSelect:i,className:n,style:o,children:c,placeholder:f="",...r}=t,x=Rg(Lte,i),{onValueNodeHasChildrenChange:S}=x,C=c!==void 0,I=wr(e,x.onValueNodeChange);return Jo(()=>{S(C)},[S,C]),d.jsx(vn.span,{...r,ref:I,style:{pointerEvents:"none"},children:rie(x.value)?d.jsx(d.Fragment,{children:f}):c})});Ote.displayName=Lte;var Qwe="SelectIcon",Fte=K.forwardRef((t,e)=>{const{__scopeSelect:i,children:n,...o}=t;return d.jsx(vn.span,{"aria-hidden":!0,...o,ref:e,children:n||"â¼"})});Fte.displayName=Qwe;var Jwe="SelectPortal",Bte=t=>d.jsx(Zb,{asChild:!0,...t});Bte.displayName=Jwe;var W_="SelectContent",Ute=K.forwardRef((t,e)=>{const i=Rg(W_,t.__scopeSelect),[n,o]=K.useState();if(Jo(()=>{o(new DocumentFragment)},[]),!i.open){const c=n;return c?ov.createPortal(d.jsx(Vte,{scope:t.__scopeSelect,children:d.jsx(mM.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),c):null}return d.jsx($te,{...t,ref:e})});Ute.displayName=W_;var ud=10,[Vte,jg]=a1(W_),eSe="SelectContentImpl",tSe=hg("SelectContent.RemoveScroll"),$te=K.forwardRef((t,e)=>{const{__scopeSelect:i,position:n="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:c,onPointerDownOutside:f,side:r,sideOffset:x,align:S,alignOffset:C,arrowPadding:I,collisionBoundary:N,collisionPadding:D,sticky:V,hideWhenDetached:B,avoidCollisions:W,...$}=t,G=Rg(W_,i),[te,ce]=K.useState(null),[_e,Te]=K.useState(null),we=wr(e,si=>ce(si)),[Ne,pe]=K.useState(null),[Pe,De]=K.useState(null),Je=gM(i),[dt,At]=K.useState(!1),qt=K.useRef(!1);K.useEffect(()=>{if(te)return dM(te)},[te]),cM();const kt=K.useCallback(si=>{const[Oi,...Ei]=Je().map(Nn=>Nn.ref.current),[Ai]=Ei.slice(-1),Xi=document.activeElement;for(const Nn of si)if(Nn===Xi||(Nn==null||Nn.scrollIntoView({block:"nearest"}),Nn===Oi&&_e&&(_e.scrollTop=0),Nn===Ai&&_e&&(_e.scrollTop=_e.scrollHeight),Nn==null||Nn.focus(),document.activeElement!==Xi))return},[Je,_e]),Vt=K.useCallback(()=>kt([Ne,te]),[kt,Ne,te]);K.useEffect(()=>{dt&&Vt()},[dt,Vt]);const{onOpenChange:Fe,triggerPointerDownPosRef:lt}=G;K.useEffect(()=>{if(te){let si={x:0,y:0};const Oi=Ai=>{var Xi,Nn;si={x:Math.abs(Math.round(Ai.pageX)-(((Xi=lt.current)==null?void 0:Xi.x)??0)),y:Math.abs(Math.round(Ai.pageY)-(((Nn=lt.current)==null?void 0:Nn.y)??0))}},Ei=Ai=>{si.x<=10&&si.y<=10?Ai.preventDefault():te.contains(Ai.target)||Fe(!1),document.removeEventListener("pointermove",Oi),lt.current=null};return lt.current!==null&&(document.addEventListener("pointermove",Oi),document.addEventListener("pointerup",Ei,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Oi),document.removeEventListener("pointerup",Ei,{capture:!0})}}},[te,Fe,lt]),K.useEffect(()=>{const si=()=>Fe(!1);return window.addEventListener("blur",si),window.addEventListener("resize",si),()=>{window.removeEventListener("blur",si),window.removeEventListener("resize",si)}},[Fe]);const[pt,Ge]=oie(si=>{const Oi=Je().filter(Xi=>!Xi.disabled),Ei=Oi.find(Xi=>Xi.ref.current===document.activeElement),Ai=aie(Oi,si,Ei);Ai&&setTimeout(()=>Ai.ref.current.focus())}),Rt=K.useCallback((si,Oi,Ei)=>{const Ai=!qt.current&&!Ei;(G.value!==void 0&&G.value===Oi||Ai)&&(pe(si),Ai&&(qt.current=!0))},[G.value]),Ot=K.useCallback(()=>te==null?void 0:te.focus(),[te]),Ci=K.useCallback((si,Oi,Ei)=>{const Ai=!qt.current&&!Ei;(G.value!==void 0&&G.value===Oi||Ai)&&De(si)},[G.value]),Hi=n==="popper"?gO:qte,ei=Hi===gO?{side:r,sideOffset:x,align:S,alignOffset:C,arrowPadding:I,collisionBoundary:N,collisionPadding:D,sticky:V,hideWhenDetached:B,avoidCollisions:W}:{};return d.jsx(Vte,{scope:i,content:te,viewport:_e,onViewportChange:Te,itemRefCallback:Rt,selectedItem:Ne,onItemLeave:Ot,itemTextRefCallback:Ci,focusSelectedItem:Vt,selectedItemText:Pe,position:n,isPositioned:dt,searchRef:pt,children:d.jsx(gE,{as:tSe,allowPinchZoom:!0,children:d.jsx(mE,{asChild:!0,trapped:G.open,onMountAutoFocus:si=>{si.preventDefault()},onUnmountAutoFocus:Ni(o,si=>{var Oi;(Oi=G.trigger)==null||Oi.focus({preventScroll:!0}),si.preventDefault()}),children:d.jsx(av,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:si=>si.preventDefault(),onDismiss:()=>G.onOpenChange(!1),children:d.jsx(Hi,{role:"listbox",id:G.contentId,"data-state":G.open?"open":"closed",dir:G.dir,onContextMenu:si=>si.preventDefault(),...$,...ei,onPlaced:()=>At(!0),ref:we,style:{display:"flex",flexDirection:"column",outline:"none",...$.style},onKeyDown:Ni($.onKeyDown,si=>{const Oi=si.ctrlKey||si.altKey||si.metaKey;if(si.key==="Tab"&&si.preventDefault(),!Oi&&si.key.length===1&&Ge(si.key),["ArrowUp","ArrowDown","Home","End"].includes(si.key)){let Ai=Je().filter(Xi=>!Xi.disabled).map(Xi=>Xi.ref.current);if(["ArrowUp","End"].includes(si.key)&&(Ai=Ai.slice().reverse()),["ArrowUp","ArrowDown"].includes(si.key)){const Xi=si.target,Nn=Ai.indexOf(Xi);Ai=Ai.slice(Nn+1)}setTimeout(()=>kt(Ai)),si.preventDefault()}})})})})})})});$te.displayName=eSe;var iSe="SelectItemAlignedPosition",qte=K.forwardRef((t,e)=>{const{__scopeSelect:i,onPlaced:n,...o}=t,c=Rg(W_,i),f=jg(W_,i),[r,x]=K.useState(null),[S,C]=K.useState(null),I=wr(e,we=>C(we)),N=gM(i),D=K.useRef(!1),V=K.useRef(!0),{viewport:B,selectedItem:W,selectedItemText:$,focusSelectedItem:G}=f,te=K.useCallback(()=>{if(c.trigger&&c.valueNode&&r&&S&&B&&W&&$){const we=c.trigger.getBoundingClientRect(),Ne=S.getBoundingClientRect(),pe=c.valueNode.getBoundingClientRect(),Pe=$.getBoundingClientRect();if(c.dir!=="rtl"){const Xi=Pe.left-Ne.left,Nn=pe.left-Xi,zi=we.left-Nn,Gi=we.width+zi,Sr=Math.max(Gi,Ne.width),Kr=window.innerWidth-ud,rs=mO(Nn,[ud,Math.max(ud,Kr-Sr)]);r.style.minWidth=Gi+"px",r.style.left=rs+"px"}else{const Xi=Ne.right-Pe.right,Nn=window.innerWidth-pe.right-Xi,zi=window.innerWidth-we.right-Nn,Gi=we.width+zi,Sr=Math.max(Gi,Ne.width),Kr=window.innerWidth-ud,rs=mO(Nn,[ud,Math.max(ud,Kr-Sr)]);r.style.minWidth=Gi+"px",r.style.right=rs+"px"}const De=N(),Je=window.innerHeight-ud*2,dt=B.scrollHeight,At=window.getComputedStyle(S),qt=parseInt(At.borderTopWidth,10),kt=parseInt(At.paddingTop,10),Vt=parseInt(At.borderBottomWidth,10),Fe=parseInt(At.paddingBottom,10),lt=qt+kt+dt+Fe+Vt,pt=Math.min(W.offsetHeight*5,lt),Ge=window.getComputedStyle(B),Rt=parseInt(Ge.paddingTop,10),Ot=parseInt(Ge.paddingBottom,10),Ci=we.top+we.height/2-ud,Hi=Je-Ci,ei=W.offsetHeight/2,si=W.offsetTop+ei,Oi=qt+kt+si,Ei=lt-Oi;if(Oi<=Ci){const Xi=De.length>0&&W===De[De.length-1].ref.current;r.style.bottom="0px";const Nn=S.clientHeight-B.offsetTop-B.offsetHeight,zi=Math.max(Hi,ei+(Xi?Ot:0)+Nn+Vt),Gi=Oi+zi;r.style.height=Gi+"px"}else{const Xi=De.length>0&&W===De[0].ref.current;r.style.top="0px";const zi=Math.max(Ci,qt+B.offsetTop+(Xi?Rt:0)+ei)+Ei;r.style.height=zi+"px",B.scrollTop=Oi-Ci+B.offsetTop}r.style.margin=`${ud}px 0`,r.style.minHeight=pt+"px",r.style.maxHeight=Je+"px",n==null||n(),requestAnimationFrame(()=>D.current=!0)}},[N,c.trigger,c.valueNode,r,S,B,W,$,c.dir,n]);Jo(()=>te(),[te]);const[ce,_e]=K.useState();Jo(()=>{S&&_e(window.getComputedStyle(S).zIndex)},[S]);const Te=K.useCallback(we=>{we&&V.current===!0&&(te(),G==null||G(),V.current=!1)},[te,G]);return d.jsx(rSe,{scope:i,contentWrapper:r,shouldExpandOnScrollRef:D,onScrollButtonChange:Te,children:d.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:ce},children:d.jsx(vn.div,{...o,ref:I,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});qte.displayName=iSe;var nSe="SelectPopperPosition",gO=K.forwardRef((t,e)=>{const{__scopeSelect:i,align:n="start",collisionPadding:o=ud,...c}=t,f=yM(i);return d.jsx(rM,{...f,...c,ref:e,align:n,collisionPadding:o,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});gO.displayName=nSe;var[rSe,S4]=a1(W_,{}),yO="SelectViewport",Hte=K.forwardRef((t,e)=>{const{__scopeSelect:i,nonce:n,...o}=t,c=jg(yO,i),f=S4(yO,i),r=wr(e,c.onViewportChange),x=K.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),d.jsx(mM.Slot,{scope:i,children:d.jsx(vn.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:r,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ni(o.onScroll,S=>{const C=S.currentTarget,{contentWrapper:I,shouldExpandOnScrollRef:N}=f;if(N!=null&&N.current&&I){const D=Math.abs(x.current-C.scrollTop);if(D>0){const V=window.innerHeight-ud*2,B=parseFloat(I.style.minHeight),W=parseFloat(I.style.height),$=Math.max(B,W);if($<V){const G=$+D,te=Math.min(V,G),ce=G-te;I.style.height=te+"px",I.style.bottom==="0px"&&(C.scrollTop=ce>0?ce:0,I.style.justifyContent="flex-end")}}}x.current=C.scrollTop})})})]})});Hte.displayName=yO;var Gte="SelectGroup",[sSe,oSe]=a1(Gte),aSe=K.forwardRef((t,e)=>{const{__scopeSelect:i,...n}=t,o=nu();return d.jsx(sSe,{scope:i,id:o,children:d.jsx(vn.div,{role:"group","aria-labelledby":o,...n,ref:e})})});aSe.displayName=Gte;var Wte="SelectLabel",Kte=K.forwardRef((t,e)=>{const{__scopeSelect:i,...n}=t,o=oSe(Wte,i);return d.jsx(vn.div,{id:o.id,...n,ref:e})});Kte.displayName=Wte;var Xk="SelectItem",[lSe,Zte]=a1(Xk),Xte=K.forwardRef((t,e)=>{const{__scopeSelect:i,value:n,disabled:o=!1,textValue:c,...f}=t,r=Rg(Xk,i),x=jg(Xk,i),S=r.value===n,[C,I]=K.useState(c??""),[N,D]=K.useState(!1),V=wr(e,G=>{var te;return(te=x.itemRefCallback)==null?void 0:te.call(x,G,n,o)}),B=nu(),W=K.useRef("touch"),$=()=>{o||(r.onValueChange(n),r.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(lSe,{scope:i,value:n,disabled:o,textId:B,isSelected:S,onItemTextChange:K.useCallback(G=>{I(te=>te||((G==null?void 0:G.textContent)??"").trim())},[]),children:d.jsx(mM.ItemSlot,{scope:i,value:n,disabled:o,textValue:C,children:d.jsx(vn.div,{role:"option","aria-labelledby":B,"data-highlighted":N?"":void 0,"aria-selected":S&&N,"data-state":S?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...f,ref:V,onFocus:Ni(f.onFocus,()=>D(!0)),onBlur:Ni(f.onBlur,()=>D(!1)),onClick:Ni(f.onClick,()=>{W.current!=="mouse"&&$()}),onPointerUp:Ni(f.onPointerUp,()=>{W.current==="mouse"&&$()}),onPointerDown:Ni(f.onPointerDown,G=>{W.current=G.pointerType}),onPointerMove:Ni(f.onPointerMove,G=>{var te;W.current=G.pointerType,o?(te=x.onItemLeave)==null||te.call(x):W.current==="mouse"&&G.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ni(f.onPointerLeave,G=>{var te;G.currentTarget===document.activeElement&&((te=x.onItemLeave)==null||te.call(x))}),onKeyDown:Ni(f.onKeyDown,G=>{var ce;((ce=x.searchRef)==null?void 0:ce.current)!==""&&G.key===" "||(Wwe.includes(G.key)&&$(),G.key===" "&&G.preventDefault())})})})})});Xte.displayName=Xk;var $S="SelectItemText",Yte=K.forwardRef((t,e)=>{const{__scopeSelect:i,className:n,style:o,...c}=t,f=Rg($S,i),r=jg($S,i),x=Zte($S,i),S=Ywe($S,i),[C,I]=K.useState(null),N=wr(e,$=>I($),x.onItemTextChange,$=>{var G;return(G=r.itemTextRefCallback)==null?void 0:G.call(r,$,x.value,x.disabled)}),D=C==null?void 0:C.textContent,V=K.useMemo(()=>d.jsx("option",{value:x.value,disabled:x.disabled,children:D},x.value),[x.disabled,x.value,D]),{onNativeOptionAdd:B,onNativeOptionRemove:W}=S;return Jo(()=>(B(V),()=>W(V)),[B,W,V]),d.jsxs(d.Fragment,{children:[d.jsx(vn.span,{id:x.textId,...c,ref:N}),x.isSelected&&f.valueNode&&!f.valueNodeHasChildren?ov.createPortal(c.children,f.valueNode):null]})});Yte.displayName=$S;var Qte="SelectItemIndicator",Jte=K.forwardRef((t,e)=>{const{__scopeSelect:i,...n}=t;return Zte(Qte,i).isSelected?d.jsx(vn.span,{"aria-hidden":!0,...n,ref:e}):null});Jte.displayName=Qte;var _O="SelectScrollUpButton",eie=K.forwardRef((t,e)=>{const i=jg(_O,t.__scopeSelect),n=S4(_O,t.__scopeSelect),[o,c]=K.useState(!1),f=wr(e,n.onScrollButtonChange);return Jo(()=>{if(i.viewport&&i.isPositioned){let r=function(){const S=x.scrollTop>0;c(S)};const x=i.viewport;return r(),x.addEventListener("scroll",r),()=>x.removeEventListener("scroll",r)}},[i.viewport,i.isPositioned]),o?d.jsx(iie,{...t,ref:f,onAutoScroll:()=>{const{viewport:r,selectedItem:x}=i;r&&x&&(r.scrollTop=r.scrollTop-x.offsetHeight)}}):null});eie.displayName=_O;var vO="SelectScrollDownButton",tie=K.forwardRef((t,e)=>{const i=jg(vO,t.__scopeSelect),n=S4(vO,t.__scopeSelect),[o,c]=K.useState(!1),f=wr(e,n.onScrollButtonChange);return Jo(()=>{if(i.viewport&&i.isPositioned){let r=function(){const S=x.scrollHeight-x.clientHeight,C=Math.ceil(x.scrollTop)<S;c(C)};const x=i.viewport;return r(),x.addEventListener("scroll",r),()=>x.removeEventListener("scroll",r)}},[i.viewport,i.isPositioned]),o?d.jsx(iie,{...t,ref:f,onAutoScroll:()=>{const{viewport:r,selectedItem:x}=i;r&&x&&(r.scrollTop=r.scrollTop+x.offsetHeight)}}):null});tie.displayName=vO;var iie=K.forwardRef((t,e)=>{const{__scopeSelect:i,onAutoScroll:n,...o}=t,c=jg("SelectScrollButton",i),f=K.useRef(null),r=gM(i),x=K.useCallback(()=>{f.current!==null&&(window.clearInterval(f.current),f.current=null)},[]);return K.useEffect(()=>()=>x(),[x]),Jo(()=>{var C;const S=r().find(I=>I.ref.current===document.activeElement);(C=S==null?void 0:S.ref.current)==null||C.scrollIntoView({block:"nearest"})},[r]),d.jsx(vn.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Ni(o.onPointerDown,()=>{f.current===null&&(f.current=window.setInterval(n,50))}),onPointerMove:Ni(o.onPointerMove,()=>{var S;(S=c.onItemLeave)==null||S.call(c),f.current===null&&(f.current=window.setInterval(n,50))}),onPointerLeave:Ni(o.onPointerLeave,()=>{x()})})}),cSe="SelectSeparator",nie=K.forwardRef((t,e)=>{const{__scopeSelect:i,...n}=t;return d.jsx(vn.div,{"aria-hidden":!0,...n,ref:e})});nie.displayName=cSe;var xO="SelectArrow",uSe=K.forwardRef((t,e)=>{const{__scopeSelect:i,...n}=t,o=yM(i),c=Rg(xO,i),f=jg(xO,i);return c.open&&f.position==="popper"?d.jsx(sM,{...o,...n,ref:e}):null});uSe.displayName=xO;function rie(t){return t===""||t===void 0}var sie=K.forwardRef((t,e)=>{const{value:i,...n}=t,o=K.useRef(null),c=wr(e,o),f=y4(i);return K.useEffect(()=>{const r=o.current,x=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(x,"value").set;if(f!==i&&C){const I=new Event("change",{bubbles:!0});C.call(r,i),r.dispatchEvent(I)}},[f,i]),d.jsx(hE,{asChild:!0,children:d.jsx("select",{...n,ref:c,defaultValue:i})})});sie.displayName="BubbleSelect";function oie(t){const e=go(t),i=K.useRef(""),n=K.useRef(0),o=K.useCallback(f=>{const r=i.current+f;e(r),function x(S){i.current=S,window.clearTimeout(n.current),S!==""&&(n.current=window.setTimeout(()=>x(""),1e3))}(r)},[e]),c=K.useCallback(()=>{i.current="",window.clearTimeout(n.current)},[]);return K.useEffect(()=>()=>window.clearTimeout(n.current),[]),[i,o,c]}function aie(t,e,i){const o=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,c=i?t.indexOf(i):-1;let f=dSe(t,Math.max(c,0));o.length===1&&(f=f.filter(S=>S!==i));const x=f.find(S=>S.textValue.toLowerCase().startsWith(o.toLowerCase()));return x!==i?x:void 0}function dSe(t,e){return t.map((i,n)=>t[(e+n)%t.length])}var hSe=Rte,lie=zte,pSe=Ote,fSe=Fte,mSe=Bte,cie=Ute,gSe=Hte,uie=Kte,die=Xte,ySe=Yte,_Se=Jte,hie=eie,pie=tie,fie=nie;const Jy=hSe,e_=pSe,Vm=K.forwardRef(({className:t,children:e,...i},n)=>d.jsxs(lie,{ref:n,className:nn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
668ing-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...i,children:[e,d.jsx(fSe,{asChild:!0,children:d.jsx(Qb,{className:"h-4 w-4 opacity-50"})})]}));Vm.displayName=lie.displayName;const mie=K.forwardRef(({className:t,...e},i)=>d.jsx(hie,{ref:i,className:nn("flex cursor-default items-center justify-center py-1",t),...e,children:d.jsx(vJ,{className:"h-4 w-4"})}));mie.displayName=hie.displayName;const gie=K.forwardRef(({className:t,...e},i)=>d.jsx(pie,{ref:i,className:nn("flex cursor-default items-center justify-center py-1",t),...e,children:d.jsx(Qb,{className:"h-4 w-4"})}));gie.displayName=pie.displayName;const $m=K.forwardRef(({className:t,children:e,position:i="popper",...n},o)=>d.jsx(mSe,{children:d.jsxs(cie,{ref:o,className:nn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[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 origin-[--radix-select-content-transform-origin]",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,...n,children:[d.jsx(mie,{}),d.jsx(gSe,{className:nn("p-1 max-h-[350px] overflow-y-auto",i==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),d.jsx(gie,{})]})}));$m.displayName=cie.displayName;const vSe=K.forwardRef(({className:t,...e},i)=>d.jsx(uie,{ref:i,className:nn("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));vSe.displayName=uie.displayName;const ja=K.forwardRef(({className:t,children:e,...i},n)=>d.jsxs(die,{ref:n,className:nn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...i,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(_Se,{children:d.jsx(Cd,{className:"h-4 w-4"})})}),d.jsx(ySe,{children:e})]}));ja.displayName=die.displayName;const xSe=K.forwardRef(({className:t,...e},i)=>d.jsx(fie,{ref:i,className:nn("-mx-1 my-1 h-px bg-muted",t),...e}));xSe.displayName=fie.displayName;const Ti=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm",t),...e}));Ti.displayName="Card";const In=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("flex flex-col space-y-1.5 p-6",t),...e}));In.displayName="CardHeader";const kn=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("text-2xl font-semibold leading-none tracking-tight",t),...e}));kn.displayName="CardTitle";const da=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("text-sm text-muted-foreground",t),...e}));da.displayName="CardDescription";const Ji=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("p-6 pt-0",t),...e}));Ji.displayName="CardContent";const yie=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("flex items-center p-6 pt-0",t),...e}));yie.displayName="CardFooter";function T4({priceEuros:t,priceCredits:e,size:i="md",showMinimumNote:n=!1}){const o={sm:"text-base",md:"text-lg",lg:"text-2xl"},c=t&&parseFloat(t)>0,f=e&&parseFloat(e)>0;return!c&&!f?d.jsx("span",{className:"text-muted-foreground",children:"Price not set"}):d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:`font-bold tabular-nums flex items-baseline gap-2 ${o[i]}`,children:[c&&d.jsxs("span",{className:"text-foreground",children:["â¬",parseFloat(t).toFixed(2)]}),c&&f&&d.jsx("span",{className:"text-muted-foreground font-normal text-sm",children:"+"}),f&&d.jsxs("span",{className:"text-primary flex items-center gap-1",children:[d.jsx(e1,{className:"w-4 h-4"}),parseFloat(e).toFixed(2)," CEI"]})]}),n&&c&&f&&d.jsx("p",{className:"text-xs text-muted-foreground",children:"Min. 20% in CEI credits"})]})}function _ie({listing:t}){var x,S;const{t:e}=pr(),[,i]=$o(),n=t.images&&t.images.length>0?t.images[0]:"https://images.unsplash.com/photo-1486312338219-ce68d2c6f44d?w=600",o=t.user&&`${t.user.firstName||""} ${t.user.lastName||""}`.trim()||"Unknown",c=((x=t.user)==null?void 0:x.isProfessional)||((S=t.user)==null?void 0:S.isAdmin),f=t.userId,r=C=>{C.preventDefault(),C.stopPropagation(),i(`/store/${f}`)};return d.jsx(yr,{href:`/listings/${t.id}`,children:d.jsxs(Ti,{className:"overflow-hidden hover-elevate active-elevate-2 transition-all h-full flex flex-col","data-testid":`card-listing-${t.id}`,children:[d.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden",children:[d.jsx("img",{src:n,alt:t.title,className:"w-full h-full object-cover","data-testid":`img-listing-${t.id}`}),c&&d.jsx("div",{className:"absolute top-2 right-2",children:d.jsxs(En,{variant:"default",className:"bg-primary/90 backdrop-blur-sm","data-testid":`badge-professional-${t.id}`,children:[d.jsx(Ru,{className:"w-3 h-3 mr-1 fill-current"}),"Professional"]})})]}),d.jsxs("div",{className:"p-6 flex flex-col flex-1 gap-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-sm text-muted-foreground","data-testid":`text-provider-${t.id}`,children:o}),d.jsx("h3",{className:"font-semibold text-lg line-clamp-2 min-h-[3.5rem]","data-testid":`text-title-${t.id}`,children:t.title})]}),t.category&&d.jsx(En,{variant:"outline",className:"w-fit","data-testid":`badge-category-${t.id}`,children:e(`categories.${t.category.name}`,t.category.name)}),d.jsxs("div",{className:"mt-auto space-y-3",children:[d.jsx(T4,{priceEuros:t.priceEuros,priceCredits:t.priceCredits,size:"md"}),t.city&&d.jsxs("div",{className:"flex items-center justify-between gap-2","data-testid":`text-location-${t.id}`,children:[d.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:t.city})]}),d.jsx(tt,{variant:"ghost",size:"icon",className:"h-7 w-7 flex-shrink-0",onClick:C=>{C.preventDefault(),C.stopPropagation(),i(`/map?userId=${f}`)},title:e("listing.viewOnMap","Vedi su mappa"),"data-testid":`button-view-map-${t.id}`,children:d.jsx(X3,{className:"w-4 h-4"})})]}),c&&d.jsxs(tt,{variant:"outline",size:"sm",className:"w-full mt-2",onClick:r,"data-testid":`button-visit-store-${t.id}`,children:[d.jsx(PJ,{className:"w-4 h-4 mr-2"}),e("listing.visitStore","Visita il mio negozio")]})]})]})]})})}const ll=f4,vie=Kee,bSe=m4,xie=K.forwardRef(({className:t,...e},i)=>d.jsx(yE,{ref:i,className:nn("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}));xie.displayName=yE.displayName;const Va=K.forwardRef(({className:t,children:e,...i},n)=>d.jsxs(bSe,{children:[d.jsx(xie,{}),d.jsxs(_E,{ref:n,className:nn("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-4 sm: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%] rounded-lg",t),...i,children:[e,d.jsxs(hM,{className:"absolute right-4 top-4 roun
668ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","data-testid":"button-close-dialog",children:[d.jsx(Fa,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Va.displayName=_E.displayName;const cl=({className:t,...e})=>d.jsx("div",{className:nn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});cl.displayName="DialogHeader";const rg=({className:t,...e})=>d.jsx("div",{className:nn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});rg.displayName="DialogFooter";const $a=K.forwardRef(({className:t,...e},i)=>d.jsx(vE,{ref:i,className:nn("text-lg font-semibold leading-none tracking-tight",t),...e}));$a.displayName=vE.displayName;const Oc=K.forwardRef(({className:t,...e},i)=>d.jsx(xE,{ref:i,className:nn("text-sm text-muted-foreground",t),...e}));Oc.displayName=xE.displayName;const cf="/assets/logo_CEI_02_64x64_1762793193501-ByA3_N_r.png",wSe="/assets/CEI_blue_watermark_fitted_7cbafad3-Bqs6fD_u.png";var Vj="rovingFocusGroup.onEntryFocus",SSe={bubbles:!1,cancelable:!0},_M="RovingFocusGroup",[bO,bie,TSe]=dE(_M),[CSe,vM]=Wa(_M,[TSe]),[ESe,ASe]=CSe(_M),wie=K.forwardRef((t,e)=>d.jsx(bO.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(bO.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(ISe,{...t,ref:e})})}));wie.displayName=_M;var ISe=K.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:i,orientation:n,loop:o=!1,dir:c,currentTabStopId:f,defaultCurrentTabStopId:r,onCurrentTabStopIdChange:x,onEntryFocus:S,preventScrollOnEntryFocus:C=!1,...I}=t,N=K.useRef(null),D=wr(e,N),V=o1(c),[B=null,W]=lu({prop:f,defaultProp:r,onChange:x}),[$,G]=K.useState(!1),te=go(S),ce=bie(i),_e=K.useRef(!1),[Te,we]=K.useState(0);return K.useEffect(()=>{const Ne=N.current;if(Ne)return Ne.addEventListener(Vj,te),()=>Ne.removeEventListener(Vj,te)},[te]),d.jsx(ESe,{scope:i,orientation:n,dir:V,loop:o,currentTabStopId:B,onItemFocus:K.useCallback(Ne=>W(Ne),[W]),onItemShiftTab:K.useCallback(()=>G(!0),[]),onFocusableItemAdd:K.useCallback(()=>we(Ne=>Ne+1),[]),onFocusableItemRemove:K.useCallback(()=>we(Ne=>Ne-1),[]),children:d.jsx(vn.div,{tabIndex:$||Te===0?-1:0,"data-orientation":n,...I,ref:D,style:{outline:"none",...t.style},onMouseDown:Ni(t.onMouseDown,()=>{_e.current=!0}),onFocus:Ni(t.onFocus,Ne=>{const pe=!_e.current;if(Ne.target===Ne.currentTarget&&pe&&!$){const Pe=new CustomEvent(Vj,SSe);if(Ne.currentTarget.dispatchEvent(Pe),!Pe.defaultPrevented){const De=ce().filter(kt=>kt.focusable),Je=De.find(kt=>kt.active),dt=De.find(kt=>kt.id===B),qt=[Je,dt,...De].filter(Boolean).map(kt=>kt.ref.current);Cie(qt,C)}}_e.current=!1}),onBlur:Ni(t.onBlur,()=>G(!1))})})}),Sie="RovingFocusGroupItem",Tie=K.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:i,focusable:n=!0,active:o=!1,tabStopId:c,...f}=t,r=nu(),x=c||r,S=ASe(Sie,i),C=S.currentTabStopId===x,I=bie(i),{onFocusableItemAdd:N,onFocusableItemRemove:D}=S;return K.useEffect(()=>{if(n)return N(),()=>D()},[n,N,D]),d.jsx(bO.ItemSlot,{scope:i,id:x,focusable:n,active:o,children:d.jsx(vn.span,{tabIndex:C?0:-1,"data-orientation":S.orientation,...f,ref:e,onMouseDown:Ni(t.onMouseDown,V=>{n?S.onItemFocus(x):V.preventDefault()}),onFocus:Ni(t.onFocus,()=>S.onItemFocus(x)),onKeyDown:Ni(t.onKeyDown,V=>{if(V.key==="Tab"&&V.shiftKey){S.onItemShiftTab();return}if(V.target!==V.currentTarget)return;const B=NSe(V,S.orientation,S.dir);if(B!==void 0){if(V.metaKey||V.ctrlKey||V.altKey||V.shiftKey)return;V.preventDefault();let $=I().filter(G=>G.focusable).map(G=>G.ref.current);if(B==="last")$.reverse();else if(B==="prev"||B==="next"){B==="prev"&&$.reverse();const G=$.indexOf(V.currentTarget);$=S.loop?MSe($,G+1):$.slice(G+1)}setTimeout(()=>Cie($))}})})})});Tie.displayName=Sie;var kSe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PSe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function NSe(t,e,i){const n=PSe(t.key,i);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return kSe[n]}function Cie(t,e=!1){const i=document.activeElement;for(const n of t)if(n===i||(n.focus({preventScroll:e}),document.activeElement!==i))return}function MSe(t,e){return t.map((i,n)=>t[(e+n)%t.length])}var Eie=wie,Aie=Tie,wO=["Enter"," "],DSe=["ArrowDown","PageUp","Home"],Iie=["ArrowUp","PageDown","End"],RSe=[...DSe,...Iie],jSe={ltr:[...wO,"ArrowRight"],rtl:[...wO,"ArrowLeft"]},zSe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wE="Menu",[nC,LSe,OSe]=dE(wE),[cv,kie]=Wa(wE,[OSe,Dg,vM]),xM=Dg(),Pie=vM(),[FSe,uv]=cv(wE),[BSe,SE]=cv(wE),Nie=t=>{const{__scopeMenu:e,open:i=!1,children:n,dir:o,onOpenChange:c,modal:f=!0}=t,r=xM(e),[x,S]=K.useState(null),C=K.useRef(!1),I=go(c),N=o1(o);return K.useEffect(()=>{const D=()=>{C.current=!0,document.addEventListener("pointerdown",V,{capture:!0,once:!0}),document.addEventListener("pointermove",V,{capture:!0,once:!0})},V=()=>
vendor: 14,891 bytes, line 668
668C.current=!1;return document.addEventListener("keydown",D,{capture:!0}),()=>{document.removeEventListener("keydown",D,{capture:!0}),document.removeEventListener("pointerdown",V,{capture:!0}),document.removeEventListener("pointermove",V,{capture:!0})}},[]),d.jsx(l4,{...r,children:d.jsx(FSe,{scope:e,open:i,onOpenChange:I,content:x,onContentChange:S,children:d.jsx(BSe,{scope:e,onClose:K.useCallback(()=>I(!1),[I]),isUsingKeyboardRef:C,dir:N,modal:f,children:n})})})};Nie.displayName=wE;var USe="MenuAnchor",C4=K.forwardRef((t,e)=>{const{__scopeMenu:i,...n}=t,o=xM(i);return d.jsx(fE,{...o,...n,ref:e})});C4.displayName=USe;var E4="MenuPortal",[VSe,Mie]=cv(E4,{forceMount:void 0}),Die=t=>{const{__scopeMenu:e,forceMount:i,children:n,container:o}=t,c=uv(E4,e);return d.jsx(VSe,{scope:e,forceMount:i,children:d.jsx(Ea,{present:i||c.open,children:d.jsx(Zb,{asChild:!0,container:o,children:n})})})};Die.displayName=E4;var zu="MenuContent",[$Se,A4]=cv(zu),Rie=K.forwardRef((t,e)=>{const i=Mie(zu,t.__scopeMenu),{forceMount:n=i.forceMount,...o}=t,c=uv(zu,t.__scopeMenu),f=SE(zu,t.__scopeMenu);return d.jsx(nC.Provider,{scope:t.__scopeMenu,children:d.jsx(Ea,{present:n||c.open,children:d.jsx(nC.Slot,{scope:t.__scopeMenu,children:f.modal?d.jsx(qSe,{...o,ref:e}):d.jsx(HSe,{...o,ref:e})})})})}),qSe=K.forwardRef((t,e)=>{const i=uv(zu,t.__scopeMenu),n=K.useRef(null),o=wr(e,n);return K.useEffect(()=>{const c=n.current;if(c)return dM(c)},[]),d.jsx(I4,{...t,ref:o,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:Ni(t.onFocusOutside,c=>c.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})}),HSe=K.forwardRef((t,e)=>{const i=uv(zu,t.__scopeMenu);return d.jsx(I4,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})}),GSe=hg("MenuContent.ScrollLock"),I4=K.forwardRef((t,e)=>{const{__scopeMenu:i,loop:n=!1,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:f,disableOutsidePointerEvents:r,onEntryFocus:x,onEscapeKeyDown:S,onPointerDownOutside:C,onFocusOutside:I,onInteractOutside:N,onDismiss:D,disableOutsideScroll:V,...B}=t,W=uv(zu,i),$=SE(zu,i),G=xM(i),te=Pie(i),ce=LSe(i),[_e,Te]=K.useState(null),we=K.useRef(null),Ne=wr(e,we,W.onContentChange),pe=K.useRef(0),Pe=K.useRef(""),De=K.useRef(0),Je=K.useRef(null),dt=K.useRef("right"),At=K.useRef(0),qt=V?gE:K.Fragment,kt=V?{as:GSe,allowPinchZoom:!0}:void 0,Vt=lt=>{var si,Oi;const pt=Pe.current+lt,Ge=ce().filter(Ei=>!Ei.disabled),Rt=document.activeElement,Ot=(si=Ge.find(Ei=>Ei.ref.current===Rt))==null?void 0:si.textValue,Ci=Ge.map(Ei=>Ei.textValue),Hi=rTe(Ci,pt,Ot),ei=(Oi=Ge.find(Ei=>Ei.textValue===Hi))==null?void 0:Oi.ref.current;(function Ei(Ai){Pe.current=Ai,window.clearTimeout(pe.current),Ai!==""&&(pe.current=window.setTimeout(()=>Ei(""),1e3))})(pt),ei&&setTimeout(()=>ei.focus())};K.useEffect(()=>()=>window.clearTimeout(pe.current),[]),cM();const Fe=K.useCallback(lt=>{var Ge,Rt;return dt.current===((Ge=Je.current)==null?void 0:Ge.side)&&oTe(lt,(Rt=Je.current)==null?void 0:Rt.area)},[]);return d.jsx($Se,{scope:i,searchRef:Pe,onItemEnter:K.useCallback(lt=>{Fe(lt)&<.preventDefault()},[Fe]),onItemLeave:K.useCallback(lt=>{var pt;Fe(lt)||((pt=we.current)==null||pt.focus(),Te(null))},[Fe]),onTriggerLeave:K.useCallback(lt=>{Fe(lt)&<.preventDefault()},[Fe]),pointerGraceTimerRef:De,onPointerGraceIntentChange:K.useCallback(lt=>{Je.current=lt},[]),children:d.jsx(qt,{...kt,children:d.jsx(mE,{asChild:!0,trapped:o,onMountAutoFocus:Ni(c,lt=>{var pt;lt.preventDefault(),(pt=we.current)==null||pt.focus({preventScroll:!0})}),onUnmountAutoFocus:f,children:d.jsx(av,{asChild:!0,disableOutsidePointerEvents:r,onEscapeKeyDown:S,onPointerDownOutside:C,onFocusOutside:I,onInteractOutside:N,onDismiss:D,children:d.jsx(Eie,{asChild:!0,...te,dir:$.dir,orientation:"vertical",loop:n,currentTabStopId:_e,onCurrentTabStopIdChange:Te,onEntryFocus:Ni(x,lt=>{$.isUsingKeyboardRef.current||lt.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(rM,{role:"menu","aria-orientation":"vertical","data-state":Xie(W.open),"data-radix-menu-content":"",dir:$.dir,...G,...B,ref:Ne,style:{outline:"none",...B.style},onKeyDown:Ni(B.onKeyDown,lt=>{const Ge=lt.target.closest("[data-radix-menu-content]")===lt.currentTarget,Rt=lt.ctrlKey||lt.altKey||lt.metaKey,Ot=lt.key.length===1;Ge&&(lt.key==="Tab"&<.preventDefault(),!Rt&&Ot&&Vt(lt.key));const Ci=we.current;if(lt.target!==Ci||!RSe.includes(lt.key))return;lt.preventDefault();const ei=ce().filter(si=>!si.disabled).map(si=>si.ref.current);Iie.includes(lt.key)&&ei.reverse(),iTe(ei)}),onBlur:Ni(t.onBlur,lt=>{lt.currentTarget.contains(lt.target)||(window.clearTimeout(pe.current),Pe.current="")}),onPointerMove:Ni(t.onPointerMove,rC(lt=>{const pt=lt.target,Ge=At.current!==lt.clientX;if(lt.currentTarget.contains(pt)&&Ge){const Rt=lt.clientX>At.current?"right":"left";dt.current=Rt,At.current=lt.clientX}}))})})})})})})});Rie.displayName=zu;var WSe="MenuGroup",k4=K.forwardRef((t,e)=>{const{__scopeMenu:i,...n}=t;return d.jsx(vn.div,{role:"group",...n,ref:e})});k4.displayName=WSe;var KSe="MenuLabel",jie=K.forwardRef((t,e)=>{const{__scopeMenu:i,...n}=t;return d.jsx(vn.div,{...n,ref:e})});jie.displayName=KSe;var Yk="MenuItem",bq="menu.itemSelect",bM=K.forwardRef((t,e)=>{const{disabled:i=!1,onSelect:n,...o}=t,c=K.useRef(null),f=SE(Yk,t.__scopeMenu),r=A4(Yk,t.__scopeMenu),x=wr(e,c),S=K.useRef(!1),C=()=>{const I=c.current;if(!i&&I){const N=new CustomEvent(bq,{bubbles:!0,cancelable:!0});I.addEventListener(bq,D=>n==null?void 0:n(D),{once:!0}),$3(I,N),N.defaultPrevented?S.current=!1:f.onClose()}};return d.jsx(zie,{...o,ref:x,disabled:i,onClick:Ni(t.onClick,C),onPointerDown:I=>{var N;(N=t.onPointerDown)==null||N.call(t,I),S.current=!0},onPointerUp:Ni(t.onPointerUp,I=>{var N;S.current||(N=I.currentTarget)==null||N.click()}),onKeyDown:Ni(t.onKeyDown,I=>{const N=r.searchRef.current!=="";i||N&&I.key===" "||wO.includes(I.key)&&(I.currentTarget.click(),I.preventDefault())})})});bM.displayName=Yk;var zie=K.forwardRef((t,e)=>{const{__scopeMenu:i,disabled:n=!1,textValue:o,...c}=t,f=A4(Yk,i),r=Pie(i),x=K.useRef(null),S=wr(e,x),[C,I]=K.useState(!1),[N,D]=K.useState("");return K.useEffect(()=>{const V=x.current;V&&D((V.textContent??"").trim())},[c.children]),d.jsx(nC.ItemSlot,{scope:i,disabled:n,textValue:o??N,children:d.jsx(Aie,{asChild:!0,...r,focusable:!n,children:d.jsx(vn.div,{role:"menuitem","data-highlighted":C?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...c,ref:S,onPointerMove:Ni(t.onPointerMove,rC(V=>{n?f.onItemLeave(V):(f.onItemEnter(V),V.defaultPrevented||V.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ni(t.onPointerLeave,rC(V=>f.onItemLeave(V))),onFocus:Ni(t.onFocus,()=>I(!0)),onBlur:Ni(t.onBlur,()=>I(!1))})})})}),ZSe="MenuCheckboxItem",Lie=K.forwardRef((t,e)=>{const{checked:i=!1,onCheckedChange:n,...o}=t;return d.jsx(Vie,{scope:t.__scopeMenu,checked:i,children:d.jsx(bM,{role:"menuitemcheckbox","aria-checked":Qk(i)?"mixed":i,...o,ref:e,"data-state":N4(i),onSelect:Ni(o.onSelect,()=>n==null?void 0:n(Qk(i)?!0:!i),{checkForDefaultPrevented:!1})})})});Lie.displayName=ZSe;var Oie="MenuRadioGroup",[XSe,YSe]=cv(Oie,{value:void 0,onValueChange:()=>{}}),Fie=K.forwardRef((t,e)=>{const{value:i,onValueChange:n,...o}=t,c=go(n);return d.jsx(XSe,{scope:t.__scopeMenu,value:i,onValueChange:c,children:d.jsx(k4,{...o,ref:e})})});Fie.displayName=Oie;var Bie="MenuRadioItem",Uie=K.forwardRef((t,e)=>{const{value:i,...n}=t,o=YSe(Bie,t.__scopeMenu),c=i===o.value;return d.jsx(Vie,{scope:t.__scopeMenu,checked:c,children:d.jsx(bM,{role:"menuitemradio","aria-checked":c,...n,ref:e,"data-state":N4(c),onSelect:Ni(n.onSelect,()=>{var f;return(f=o.onValueChange)==null?void 0:f.call(o,i)},{checkForDefaultPrevented:!1})})})});Uie.displayName=Bie;var P4="MenuItemIndicator",[Vie,QSe]=cv(P4,{checked:!1}),$ie=K.forwardRef((t,e)=>{const{__scopeMenu:i,forceMount:n,...o}=t,c=QSe(P4,i);return d.jsx(Ea,{present:n||Qk(c.checked)||c.checked===!0,children:d.jsx(vn.span,{...o,ref:e,"data-state":N4(c.checked)})})});$ie.displayName=P4;var JSe="MenuSeparator",qie=K.forwardRef((t,e)=>{const{__scopeMenu:i,...n}=t;return d.jsx(vn.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});qie.displayName=JSe;var eTe="MenuArrow",Hie=K.forwardRef((t,e)=>{const{__scopeMenu:i,...n}=t,o=xM(i);return d.jsx(sM,{...o,...n,ref:e})});Hie.displayName=eTe;var tTe="MenuSub",[M8e,Gie]=cv(tTe),qS="MenuSubTrigger",Wie=K.forwardRef((t,e)=>{const i=uv(qS,t.__scopeMenu),n=SE(qS,t.__scopeMenu),o=Gie(qS,t.__scopeMenu),c=A4(qS,t.__scopeMenu),f=K.useRef(null),{pointerGraceTimerRef:r,onPointerGraceIntentChange:x}=c,S={__scopeMenu:t.__scopeMenu},C=K.useCallback(()=>{f.current&&window.clearTimeout(f.current),f.current=null},[]);return K.useEffect(()=>C,[C]),K.useEffect(()=>{const I=r.current;return()=>{window.clearTimeout(I),x(null)}},[r,x]),d.jsx(C4,{asChild:!0,...S,children:d.jsx(zie,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":o.contentId,"data-state":Xie(i.open),...t,ref:GN(e,o.onTriggerChange),onClick:I=>{var N;(N=t.onClick)==null||N.call(t,I),!(t.disabled||I.defaultPrevented)&&(I.currentTarget.focus(),i.open||i.onOpenChange(!0))},onPointerMove:Ni(t.onPointerMove,rC(I=>{c.onItemEnter(I),!I.defaultPrevented&&!t.disabled&&!i.open&&!f.current&&(c.onPointerGraceIntentChange(null),f.current=window.setTimeout(()=>{i.onOpenChange(!0),C()},100))})),onPointerLeave:Ni(t.onPointerLeave,rC(I=>{var D,V;C();const N=(D=i.content)==null?void 0:D.getBoundingClientRect();if(N){const B=(V=i.content)==null?void 0:V.dataset.side,W=B==="right",$=W?-5:5,G=N[W?"left":"right"],te=N[W?"right":"left"];c.onPointerGraceIntentChange({area:[{x:I.clientX+$,y:I.clientY},{x:G,y:N.top},{x:te,y:N.top},{x:te,y:N.bottom},{x:G,y:N.bottom}],side:B}),window.clearTimeout(r.current),r.current=window.setTimeout(()=>c.onPointerGraceIntentChange(null),300)}else{if(c.onTriggerLeave(I),I.defaultPrevented)return;c.onPointerGraceIntentChange(null)}})),onKeyDown:Ni(t.onKeyDown,I=>{var D;const N=c.searchRef.current!=="";t.disabled||N&&I.key===" "||jSe[n.dir].includes(I.key)&&(i.onOpenChange(!0),(D=i.content)==null||D.focus(),I.preventDefault())})})})});Wie.displayName=qS;var Kie="MenuSubContent",Zie=K.forwardRef((t,e)=>{const i=Mie(zu,t.__scopeMenu),{forceMount:n=i.forceMount,...o}=t,c=uv(zu,t.__scopeMenu),f=SE(zu,t.__scopeMenu),r=Gie(Kie,t.__scopeMenu),x=K.useRef(null),S=wr(e,x);return d.jsx(nC.Provider,{scope:t.__scopeMenu,children:d.jsx(Ea,{present:n||c.open,children:d.jsx(nC.Slot,{scope:t.__scopeMenu,children:d.jsx(I4,{id:r.contentId,"aria-labelledby":r.triggerId,...o,ref:S,align:"start",side:f.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:C=>{var I;f.isUsingKeyboardRef.current&&((I=x.current)==null||I.focus()),C.preventDefault()},onCloseAutoFocus:C=>C.preventDefault(),onFocusOutside:Ni(t.onFocusOutside,C=>{C.target!==r.trigger&&c.onOpenChange(!1)}),onEscapeKeyDown:Ni(t.onEscapeKeyDown,C=>{f.onClose(),C.preventDefault()}),onKeyDown:Ni(t.onKeyDown,C=>{var D;const I=C.currentTarget.contains(C.target),N=zSe[f.dir].includes(C.key);I&&N&&(c.onOpenChange(!1),(D=r.trigger)==null||D.focus(),C.preventDefault())})})})})})});Zie.displayName=Kie;function Xie(t){return t?"open":"closed"}function Qk(t){return t==="indeterminate"}function N4(t){return Qk(t)?"indeterminate":t?"checked":"unchecked"}function iTe(t){const e=document.activeElement;for(const i of t)if(i===e||(i.focus(),document.activeElement!==e))return}function nTe(t,e){return t.map((i,n)=>t[(e+n)%t.length])}function rTe(t,e,i){const o=e.length>1&&Array.from(e).every(S=>S===e[0])?e[0]:e,c=i?t.indexOf(i):-1;let f=nTe(t,Math.max(c,0));o.length===1&&(f=f.filter(S=>S!==i));const x=f.find(S=>S.toLowerCase().startsWith(o.toLowerCase()));return x!==i?x:void 0}function sTe(t,e){const{x:i,y:n}=t;let o=!1;for(let c=0,f=e.length-1;c<e.length;f=c++){const r=e[c].x,x=e[c].y,S=e[f].x,C=e[f].y;x>n!=C>n&&i<(S-r)*(n-x)/(C-x)+r&&(o=!o)}return o}function oTe(t,e){if(!e)return!1;const i={x:t.clientX,y:t.clientY};return sTe(i,e)}function rC(t){return e=>e.pointerType==="mouse"?t(e):void 0}var aTe=Nie,lTe=C4,cTe=Die,uTe=Rie,dTe=k4,hTe=jie,pTe=bM,fTe=Lie,mTe=Fie,gTe=Uie,yTe=$ie,_Te=qie,vTe=Hie,xTe=Wie,bTe=Zie,M4="DropdownMenu",[wTe,D8e]=Wa(M4,[kie]),pc=kie(),[STe,Yie]=wTe(M4),Qie=t=>{const{__scopeDropdownMenu:e,children:i,dir:n,open:o,defaultOpen:c,onOpenChange:f,modal:r=!0}=t,x=pc(e),S=K.useRef(null),[C=!1,I]=lu({prop:o,defaultProp:c,onChange:f});return d.jsx(STe,{scope:e,triggerId:nu(),triggerRef:S,contentId:nu(),open:C,onOpenChange:I,onOpenToggle:K.useCallback(()=>I(N=>!N),[I]),modal:r,children:d.jsx(aTe,{...x,open:C,onOpenChange:I,dir:n,modal:r,children:i})})};Qie.displayName=M4;var Jie="DropdownMenuTrigger",ene=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,disabled:n=!1,...o}=t,c=Yie(Jie,i),f=pc(i);return d.jsx(lTe,{asChild:!0,...f,children:d.jsx(vn.button,{type:"button",id:c.triggerId,"aria-haspopup":"menu","aria-expanded":c.open,"aria-controls":c.open?c.contentId:void 0,"data-state":c.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...o,ref:GN(e,c.triggerRef),onPointerDown:Ni(t.onPointerDown,r=>{!n&&r.button===0&&r.ctrlKey===!1&&(c.onOpenToggle(),c.open||r.preventDefault())}),onKeyDown:Ni(t.onKeyDown,r=>{n||(["Enter"," "].includes(r.key)&&c.onOpenToggle(),r.key==="ArrowDown"&&c.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(r.key)&&r.preventDefault())})})})});ene.displayName=Jie;var TTe="DropdownMenuPortal",tne=t=>{const{__scopeDropdownMenu:e,...i}=t,n=pc(e);return d.jsx(cTe,{...n,...i})};tne.displayName=TTe;var ine="DropdownMenuContent",nne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=Yie(ine,i),c=pc(i),f=K.useRef(!1);return d.jsx(uTe,{id:o.contentId,"aria-labelledby":o.triggerId,...c,...n,ref:e,onCloseAutoFocus:Ni(t.onCloseAutoFocus,r=>{var x;f.current||(x=o.triggerRef.current)==null||x.focus(),f.current=!1,r.preventDefault()}),onInteractOutside:Ni(t.onInteractOutside,r=>{const x=r.detail.originalEvent,S=x.button===0&&x.ctrlKey===!0,C=x.button===2||S;(!o.modal||C)&&(f.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});nne.displayName=ine;var CTe="DropdownMenuGroup",ETe=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(dTe,{...o,...n,ref:e})});ETe.displayName=CTe;var ATe="DropdownMenuLabel",rne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(hTe,{...o,...n,ref:e})});
vendor: 2,361 bytes, line 668
668rne.displayName=ATe;var ITe="DropdownMenuItem",sne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(pTe,{...o,...n,ref:e})});sne.displayName=ITe;var kTe="DropdownMenuCheckboxItem",one=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(fTe,{...o,...n,ref:e})});one.displayName=kTe;var PTe="DropdownMenuRadioGroup",NTe=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(mTe,{...o,...n,ref:e})});NTe.displayName=PTe;var MTe="DropdownMenuRadioItem",ane=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(gTe,{...o,...n,ref:e})});ane.displayName=MTe;var DTe="DropdownMenuItemIndicator",lne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(yTe,{...o,...n,ref:e})});lne.displayName=DTe;var RTe="DropdownMenuSeparator",cne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(_Te,{...o,...n,ref:e})});cne.displayName=RTe;var jTe="DropdownMenuArrow",zTe=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(vTe,{...o,...n,ref:e})});zTe.displayName=jTe;var LTe="DropdownMenuSubTrigger",une=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(xTe,{...o,...n,ref:e})});une.displayName=LTe;var OTe="DropdownMenuSubContent",dne=K.forwardRef((t,e)=>{const{__scopeDropdownMenu:i,...n}=t,o=pc(i);return d.jsx(bTe,{...o,...n,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});dne.displayName=OTe;var FTe=Qie,BTe=ene,UTe=tne,hne=nne,pne=rne,fne=sne,mne=one,gne=ane,yne=lne,_ne=cne,vne=une,xne=dne;const VTe=FTe,$Te=BTe,qTe=K.forwardRef(({className:t,inset:e,children:i,...n},o)=>d.jsxs(vne,{ref:o,className:nn("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...n,children:[i,d.jsx(_J,{className:"ml-auto"})]}));
668qTe.displayName=vne.displayName;const HTe=K.forwardRef(({className:t,...e},i)=>d.jsx(xne,{ref:i,className:nn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...e}));HTe.displayName=xne.displayName;const bne=K.forwardRef(({className:t,sideOffset:e=4,...i},n)=>d.jsx(UTe,{children:d.jsx(hne,{ref:n,sideOffset:e,className:nn("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...i})}));bne.displayName=hne.displayName;const wne=K.forwardRef(({className:t,inset:e,...i},n)=>d.jsx(fne,{ref:n,className:nn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",t),...i}));wne.displayName=fne.displayName;const GTe=K.forwardRef(({className:t,children:e,checked:i,...n},o)=>d.jsxs(mne,{ref:o,className:nn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:i,...n,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(yne,{children:d.jsx(Cd,{className:"h-4 w-4"})})}),e]}));GTe.displayName=mne.displayName;const WTe=K.forwardRef(({className:t,children:e,...i},n)=>d.jsxs(gne,{ref:n,className:nn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...i,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(yne,{children:d.jsx(Kve,{className:"h-2 w-2 fill-current"})})}),e]}));WTe.displayName=gne.displayName;const KTe=K.forwardRef(({className:t,inset:e,...i},n)=>d.jsx(pne,{ref:n,className:nn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...i}));KTe.displayName=pne.displayName;const ZTe=K.forwardRef(({className:t,...e},i)=>d.jsx(_ne,{ref:i,className:nn("-mx-1 my-1 h-px bg-muted",t),...e}));ZTe.displayName=_ne.displayName;const $j=[{code:"en",name:"English"},{code:"it",name:"Italiano"},{code:"fr",name:"Français"},{code:"es",name:"Español"},{code:"de",name:"Deutsch"}];function TE(){const{i18n:t,t:e}=pr(),i=o=>{t.changeLanguage(o),typeof window<"u"&&window.localStorage&&localStorage.setItem("language",o)},n=$j.find(o=>o.code===t.language)||$j[0];return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-sm text-muted-foreground hidden sm:block",children:e("common.chooseLanguage")}),d.jsxs(VTe,{children:[d.jsx($Te,{asChild:!0,children:d.jsx(tt,{variant:"outline",size:"icon","data-testid":"button-language-selector",children:d.jsx(YN,{className:"w-4 h-4"})})}),d.jsx(bne,{align:"end",children:$j.map(o=>d.jsx(wne,{onClick:()=>i(o.code),className:o.code===n.code?"bg-accent":"","data-testid":`language-option-${o.code}`,children:o.name},o.code))})]})]})}function Sne(){const{isAuthenticated:t,user:e}=Ka(),{data:i=[]}=Xn({queryKey:["/api/messages"],enabled:t,refetchInterval:1e4});return{unreadCount:i.filter(o=>!(o.toUserId!==(e==null?void 0:e.id)||o.isRead)).length}}function XTe(){var i;const{isAuthenticated:t}=Ka(),e=Xn({queryKey:["/api/events/unread-count"],enabled:t,refetchInterval:t?3e4:!1,refetchOnWindowFocus:!0});return{unreadCount:((i=e.data)==null?void 0:i.count)??0,...e}}const YTe={loading:"Loading...",signIn:"Sign In",signUp:"Sign Up",enter:"Enter",signOut:"Sign Out",getStarted:"Get Started",cancel:"Cancel",save:"Save",edit:"Edit",send:"Send",clear:"Clear",clearAll:"Clear all",filters:"Filters",search:"Search",credits:"Credits",chooseLanguage:"Cho
668ose your language",dashboard:"Dashboard",backToDashboard:"Back to Dashboard"},QTe={"Professional Services":"Professional Services","Home & Garden":"Home & Garden","Health & Wellness":"Health & Wellness",Education:"Education",Technology:"Technology","Creative Services":"Creative Services","Food & Catering":"Food & Catering",Transportation:"Transportation","Volunteer Services":"Volunteer Service Requests",Entertainment:"Entertainment","B&B, Hospitality & Catering":"B&B, Hospitality & Catering","Present Your Project":"Present Your Project","Free Services":"Free Services"},JTe={walletManager:"Wallet Manager",adminDashboard:"Admin Dashboard",myWallet:"My Wallet"},eCe={title:"Manage Your Credits",subtitle:"Securely & Efficiently",description:"A professional wallet management platform for tracking and transferring custom points and credits. Simple, secure, and built for teams.",purchaseTitle:"Purchase with credits from CEI registered producers",feature1Title:"One Wallet Per User",feature1Desc:"Each user gets a secure wallet automatically created upon registration. View your balance and transaction history at a glance.",feature2Title:"Easy Transfers",feature2Desc:"Transfer credits to other users instantly. All transactions are tracked with complete history and descriptions.",feature3Title:"Admin Controls",feature3Desc:"Admins can add credits to any wallet, view all users, and manage the entire platform with powerful tools.",footer:"Secure credit management platform."},tCe={communityName:"Independent Economic Community",heroTitle:"Discover Local Services & Support Your Community",heroSubtitle:"Browse products and services with hybrid pricing: euros + CEI community credits",searchPlaceholder:"Search services, products...",cityPlaceholder:"City",selectCategory:"All Categories",searchButton:"Search",viewMap:"View Map",supportProject:"Support the Project",noListingsTitle:"No listings found",noListingsDesc:"Try adjusting your filters",foundUsers:"Profiles found",userFound:"profile found",usersFound:"profiles found",featuredListings:"Featured Listings 100% CEI Credits",loading:"Loading listings...",browseMarketplace:"Browse Marketplace",viewDetails:"View Details",upgradeSuccessful:"Upgrade Successful!",upgradeSuccessfulDesc:"You are now a professional seller. Welcome!",donationTitle:"Support COMUNITA' ECONOMICA INDIPENDENTE",donationDesc:"Help us keep the platform running and support our community initiatives",donationChooseAmount:"Choose an amount",donationCustomAmount:"Or enter custom amount (â¬)",donationEnterAmount:"Enter amount",donationProcessing:"Processing...",donateButton:"Donate â¬{{amount}}",securePayment:"Secure payment processing powered by Stripe",upgradeTitle:"Upgrade to Professional",upgradeDesc:"Unlock premium features and grow your business on CEI Marketplace",upgradePerYear:"per year",upgradeIncluded:"What's included:",upgradeFeature1:"Up to 50 marketplace storefronts",upgradeFeature2:"10 photos + 1 video per listing",upgradeFeature3:"Priority customer support",upgradeFeature4:"Professional badge on your listings",upgradeFeature5:"Advanced analytics dashboard",upgradeFeature6:"Featured placement in search results",upgradeButton:"Upgrade Now",upgradeProcessing:"Processing...",authRequired:"Sign In Required",authRequiredDesc:"SIGN IN FOR FREE TO ACTIVATE SERVICES",searchByCity:"By City",searchByRadius:"By Radius",allSellers:"All",professionalOnly:"Professionals Only",privateOnly:"Private Only",useMyLocation:"Use my location",locationSet:"Location set",locating:"Locating...",locationFound:"Location found"},iCe={title:"My Orders",purchases:"Purchases",sales:"Sales",noPurchases:"No purchases yet",noPurchasesDesc:"Your orders as a buyer will appear here",noSales:"No sales yet",noSalesDesc:"Your orders as a seller will appear here",pending:"Pending",reserved:"Reserved",completed:"Completed",cancelled:"Cancelled",expired:"Expired",seller:"Seller",buyer:"Buyer",listing:"Listing",unknown:"Unknown",price:"Price",status:"Status",orderDate:"Order Date",expiresOn:"Expires on",buyerNotes:"Buyer notes",confirmOrder:"Confirm Order",confirmReceipt:"Confirm Receipt",cancelOrder:"Cancel Order",contactCounterpart:"Contact",waitingBuyerConfirmation:"Waiting for buyer to confirm receipt. Credits will be transferred after confirmation.",confirmTitle:"Confirm receipt?",confirmDesc:"Do you confirm receiving the service or product? Credits will be transferred to the seller.",cancelTitle:"Cancel this order?",cancelDesc:"Reserved credits will be released back to the buyer.",updating:"Updating...",orderUpdated:"Order Updated",orderConfirmed:"Order confirmed successfully.",orderCancelled:"Order cancelled successfully.",updateFailed:"Update Failed",updateError:"Failed to update order status",manageYourOrders:"Manage your orders and sales"},nCe={title:"My Listings",createNew:"Create New Listing",noListings:"No listings yet",noListingsDesc:"Your listings will appear here once you create them",active:"Active",inactive:"Inactive",toggleActive:"Toggle Active",edit:"Edit",delete:"Delete",deleteTitle:"Delete this listing?",deleteDesc:"This action cannot be undone. The listing will be permanently removed.",deleting:"Deleting...",listingDeleted:"Listing Deleted",listingDeletedDesc:"Your listing has been removed successfully.",deleteFailed:"Delete Failed",deleteError:"Failed to delete listing",statusUpdated:"Status Upd
668ated",statusUpdatedDesc:"Listing status has been changed.",statusFailed:"Update Failed",statusError:"Failed to update listing status"},rCe={createTitle:"Create New Listing",editTitle:"Edit Listing",basicInfo:"Basic Information",basicInfoDesc:"Enter the main details of your listing",title:"Title",titlePlaceholder:"e.g., Professional Web Design Consulting",description:"Description",descriptionPlaceholder:"Describe your product or service in detail...",category:"Category",selectCategory:"Select a category",pricing:"Pricing",pricingDesc:"Set your prices (at least one required)",pricingOptionalDesc:"For this category, pricing is optional. You can leave the fields empty.",clearPrices:"Clear prices",priceEuros:"⬠Share (min. 0% max 80%)",priceCredits:"CEI Credits Share (min. 20% max. 100%)",hybridPricingNote:"When using both, credits must be at least 20% of total value",location:"Location",locationDesc:"Add your location to appear on the map",address:"Address",city:"City",country:"Country",latitude:"Latitude",longitude:"Longitude",imageUrl:"Image URL",imageUrlPlaceholder:"https://example.com/image.jpg",requiresContact:"Requires contact first",requiresContactDesc:"Enable if buyer must contact you before ordering (e.g. to agree on size, quantity, dates)",activeStatus:"Active Status",activeStatusDesc:"Make this listing visible to buyers",saving:"Saving...",createButton:"Create Listing",updateButton:"Update Listing",cancel:"Cancel",success:"Success!",listingCreated:"Your listing has been created successfully.",listingUpdated:"Your listing has been updated successfully.",error:"Error",createError:"Failed to create listing. Please try again.",updateError:"Failed to update listing. Please try again.",validationError:"Please check the form for validation errors"},sCe={professional:"Professional",postedOn:"Posted on",location:"Location",price:"Price",yourBalance:"Your Balance",aboutSeller:"About the Seller",viewProfile:"View Profile",viewStore:"View Storefront",description:"Description",placeOrder:"Place Order",contactSeller:"Contact Seller",interestedMessage:"Hi! I'm interested in your listing: {{title}}",backToListings:"Back to Listings",orderPlaced:"Order Placed!",orderPlacedDesc:"Your order has been created. Credits have been reserved.",insufficientCredits:"Insufficient Credits",insufficientCreditsDesc:"You don't have enough CEI credits for this order.",orderFailed:"Order Failed",orderError:"Failed to create order. Please try again.",notesLabel:"Notes for Seller",notesPlaceholder:"Additional notes for the seller (optional)...",noteLabel:"Note",euroNote:"The Euro amount should be paid directly to the seller as agreed.",creditsNote:"CEI credits will be reserved when ordering and transferred upon completion.",requiresContactInfo:"For this listing, you need to contact the seller first to agree on order details.",ownListing:"This is your own listing",editListing:"Edit Listing",submit:"Submit Order",submitting:"Submitting..."},oCe={title:"My Wallet",subtitle:"Manage your credits and view transaction history",balance:"Balance",customizeName:"Customize wallet name",walletName:"Wallet Name",walletNamePlaceholder:"e.g., My Main Wallet",walletNameDescription:"Give your wallet a custom name to personalize your experience.",walletBalance:"Wallet Balance",transferCredits:"Transfer Credits",recipient:"Recipient",selectUser:"Select a user",noOtherUsers:"No other users available",recipientEmail:"Recipient Email",amount:"Amount",amountPlaceholder:"0.00",description:"Description",descriptionOptional:"Description (optional)",descriptionPlaceholder:"What is this transfer for?",transactionHistory:"Transaction History",transferSubmit:"Transfer Credits",transferring:"Transferring...",saving:"Saving...",noTransactionsTitle:"No transactions yet",noTransactionsDesc:"Your transaction history will appear here once you start transferring credits.",myListings:"My Listings",myOrders:"My Orders",messages:"Messages",createListing:"Create Listing",goToMarketplace:"Go to Marketplace"},aCe={title:"User Management",subtitle:"View all users and manage wallet credits",allUsers:"All Users",noUsers:"No users found",addCredits:"Add Credits to Wallet",user:"User",selectUser:"Select a user",noUsersAvailable:"No users available",userEmail:"User Email",amount:"Amount",amountPlaceholder:"0.00",reason:"Reason",reasonOptional:"Reason (optional)",reasonPlaceholder:"Why are you adding these credits?",addCreditsSubmit:"Add Credits",addingCredits:"Adding...",allTransactions:"All Transactions",editWallet
668Name:"Edit Wallet Name",admin:"Admin",unknownUser:"Unknown User",signupBonus:"Signup Bonus",signupBonusTitle:"Configure Signup Bonus",signupBonusDesc:"Set the amount of credits new users receive when they create an account",signupBonusAmount:"Bonus Amount",signupBonusPlaceholder:"100.00",signupBonusSave:"Save Signup Bonus",signupBonusSaving:"Saving...",signupBonusSuccess:"Signup bonus updated",signupBonusSuccessDesc:"New users will now receive {{amount}} credits upon registration",signupBonusError:"Failed to update signup bonus",currentBonus:"Current: {{amount}} credits",professionalPriceTitle:"Professional Upgrade Price",professionalPriceDesc:"Set the annual cost for upgrading to a professional account",professionalPriceAmount:"Price (EUR)",professionalPricePlaceholder:"50.00",professionalPriceSave:"Save Price",professionalPriceSaving:"Saving...",professionalPriceSuccess:"Upgrade price updated",professionalPriceSuccessDesc:"The new professional upgrade price is â¬{{amount}}/year",professionalPriceError:"Failed to update price",currentPrice:"Current: â¬{{amount}}/year",totalCreditsIssued:"Total Credits Issued",creditsIssuedDesc:"Historical total to date",exchangeVolume:"Exchange Volume",exchangeVolumeDesc:"Transactions between users",professionalStatusTitle:"Professional Status Management",professionalStatusDesc:"Manually activate or deactivate professional status for users",activateProfessional:"Activate",deactivateProfessional:"Deactivate",manualProfessionalActivation:"Manual professional status activation",manualProfessionalDeactivation:"Manual professional status deactivation",deleteUser:"Delete User",deleteUserWarning:"Are you sure you want to delete the user",deleteUserPermanent:"This action is irreversible. All user data (wallet, listings, orders, messages) will be permanently deleted.",userDeleted:"User deleted successfully",deleteUserFailed:"Failed to delete user",confirmDelete:"Delete Permanently",processing:"Processing...",bulkCreditTitle:"Bulk Credit All Users",bulkCreditDesc:"Add credits to all users at once. This will credit every user in the system with the specified amount.",bulkCreditSuccess:"Bulk Credit Success",bulkCreditSuccessDesc:"Credited {{successCount}} of {{totalUsers}} users ({{failCount}} failed)",bulkCreditError:"Bulk Credit Error",bulkCreditErrorDesc:"Failed to credit users",bulkCreditPlaceholder:"Reason for bulk credit (required)",bulkCreditButton:"Credit All Users",broadcastTitle:"Broadcast Message",broadcastDesc:"Send a message to all users at once. Every user will receive this message in their inbox.",broadcastSuccess:"Broadcast Message Sent",broadcastSuccessDesc:"Sent to {{successCount}} of {{totalRecipients}} users ({{failCount}} failed)",broadcastError:"Broadcast Error",broadcastErrorDesc:"Failed to send broadcast message",broadcastLabel:"Message Content",broadcastPlaceholder:"Type your broadcast message here...",broadcastButton:"Send to All Users",sending:"Sending...",exportMembers:"Export Member Registry (CSV)",exportMembersDesc:"Download the complete member registry in CSV format"},lCe={title:"Transaction History",filters:"Filters",clearAll:"Clear all",filterType:"Type",filterSearch:"Search",filterFrom:"From",filterTo:"To",filterMin:"Min",filterMax:"Max",allTypes:"All Types",type:"Type",typeAll:"All Types",typeTransfer:"Transfer",typeAdminCredit:"Admin Credit",date:"Date",startDate:"Start Date",endDate:"End Date",amount:"Amount",minAmount:"Min Amount",maxAmount:"Max Amount",description:"Description",from:"From",to:"To",createdBy:"Created By",noTransactions:"No transactions yet",noTransactionsDesc:"Your transaction history will appear here once you start transferring credits.",noDescription:"No description",transferTo:"Transfer to",transferFrom:"Received from",creditsAddedByAdmin:"Credits added by administrator",unknown:"Unknown user",badgeAdmin:"Admin",badgeTransfer:"Transfer",history:"Transaction History",you:"You",system:"System",searchPlaceholder:"Search transactions..."},cCe={credits:"CEI Credits"},uCe={unauthorized:"Unauthorized",unauthorizedDesc:"You are logged out. Logging in again...",unauthorizedLogin:"Please log in again to continue.",accessDenied:"Access Denied",accessDeniedDesc:"You don't have admin privileges.",transferSuccess:"Transfer successful",transferSuccessDesc:"Credits have been transferred successfully.",transferError:"Transfer failed",transferErrorDesc:"Failed to transfer credits. Please try again.",creditSuccess:"Credits added",creditSuccessDesc:"Credits have been added to the user's wallet successfully.",creditError:"Failed to add credits",creditErrorDesc:"Failed to add credits. Please try again.",walletUpdateSuccess:"Wallet updated",walletUpdateSuccessDesc:"Your wallet name has been updated successfully.",walletUpdateError:"Error",walletUpdateErrorDesc:"Failed to update wallet name",fetchError:"Failed to fetch",donationFailed:"Donation Failed",donationFailedDesc:"Failed to process donation",invali
668dAmount:"Invalid Amount",invalidAmountDesc:"Please enter a valid donation amount",upgradeFailed:"Upgrade Failed",upgradeFailedDesc:"Failed to start upgrade process",error:"Error",success:"Success",sendError:"Failed to send message",loadingMessages:"Loading messages...",loadingOrders:"Loading orders...",typeMessage:"Type your message...",userFallback:"User",broadcastNoReply:"This is a broadcast message - replies are not allowed",broadcastHistory:"Broadcast History",messageSent:"message sent",messagesSent:"messages sent",sentTo:"sent to",recipients:"recipients",upgradeCancelled:"Upgrade Cancelled",upgradeCancelledDesc:"Your professional upgrade was cancelled.",thankYou:"Thank You!",donationSuccess:"Your donation helps support our community platform.",donationCancelled:"Donation Cancelled",donationCancelledDesc:"Your donation was cancelled.",categoryPlaceholder:"Category",promotedToAdmin:"Promoted to admin",demotedFromAdmin:"Demoted from admin",failedToUpdateRole:"Failed to update role"},dCe={defaultName:"User"},hCe={title:"Complete Your Profile",subtitle:"Fill in the required information to start using your wallet",editTitle:"Edit Profile",editSubtitle:"Update your personal information",welcomeTitle:"Welcome!",welcomeMessage:"Complete your profile to use the service",completeNow:"Complete Now",firstName:"First Name",firstNamePlaceholder:"John",lastName:"Last Name",lastNamePlaceholder:"Doe",phone:"Phone",phonePlaceholder:"+1 234 567 8900",address:"Address",addressPlaceholder:"123 Main St",city:"City",cityPlaceholder:"New York",dateOfBirth:"Date of Birth",profession:"Profession",professionPlaceholder:"e.g. Engineer, Doctor, Teacher",bio:"About me",bioPlaceholder:"Tell us about yourself, your skills, interests and what you offer to the community...",website:"Website (optional)",websitePlaceholder:"https://yourwebsite.com",saveProfile:"Save Profile",updateProfile:"Update Profile",updating:"Updating...",successTitle:"Profile updated",successDesc:"Your information has been saved successfully.",errorTitle:"Error",errorDesc:"Failed to update profile. Please try again.",userProfile:"User Profile",noAdditionalInfo:"No additional information available",userNotFound:"User not found",email:"Email",adminStatus:"Admin Status",isAdmin:"Administrator",notAdmin:"Standard User"},pCe={titleMin:"Title must be at least 5 characters",descMin:"Description must be at least 20 characters",validUrl:"Must be a valid URL",priceRequired:"At least one price (euros or credits) must be set",hybridPricing:"When using hybrid pricing, credits must be at least 20% of total value",creditsRequired:"CEI credits are required for all listings (100% credits or hybrid pricing)",creditsMinimum:"When using hybrid pricing, credits must be at least 20% of total value"},fCe={marker:"marker",markers:"markers",listing:"listing",listings:"listings",user:"user",users:"users",onMap:"on map",totalMembers:"total members",legend:"Legend",professionalListing:"Professional Listing",privateListing:"Private Listing",professionalUser:"Professional User",privateUser:"Private User",contactSeller:"Contact Seller",sendMessage:"Send Message",noUsers:"No users on map",noUsersDescription:"There are currently no users with location data to display.",viewListings:"View Listings",viewProfile:"View Profile",viewStore:"View Store",viewAll:"View All",centerOnMe:"Center on me",searchUser:"Search user...",noSearchResults:"No user found",completeProfileFirst:"Complete profile to enable",noLocationTitle:"Location Missing",noLocationDesc:"Complete your profile with address and city to use this feature",invalidCoordsTitle:"Invalid Coordinates",invalidCoordsDesc:"Your coordinates are corrupted. Update your profile to fix"},mCe={title:"Referral System",heroTitle:"Invite Friends and Earn CEI Credits",heroDescription:"Share your referral link and receive 20 CEI credits for each friend who signs up. Your friend will receive 10 extra bonus credits!",friendsInvited:"Friends Invited",creditsEarned:"Credits Earned",yourCode:"Your Code",shareLink:"Share Your Referral Link",shareLinkDesc:"Copy and share this link with your friends to invite them to the platform",copy:"Copy",copied:"Copied!",copiedDesc:"Referral link copied to clipboard",copyError:"Failed to copy link",yourReferrals:"Your Referrals",yourReferralsDesc:"People who signed up through your link",
668noReferrals:"You haven't invited anyone yet",joinedOn:"Joined on {{date}}",active:"Active",emailSubject:"Join the Independent Economic Community",emailBody:"Hi! I invite you to join the CEI platform. Sign up with my link and receive 10 bonus credits: {{link}}",whatsappMessage:"Hi! I invite you to join the CEI platform. Receive 10 bonus credits by signing up with my link: {{link}}",telegramMessage:"Join the CEI platform and receive 10 bonus credits"},gCe={browse:"browse files",dropPasteFiles:"Drop files here, paste or %{browse}",dropHint:"Drop your files here",uploading:"Uploading...",complete:"Upload complete",failed:"Upload failed",uploadImages:"Upload Images",uploadVideo:"Upload Video",imagesUploaded:"{{count}} image(s) uploaded",videoUploaded:"1 video uploaded",uploadSuccess:"Success",uploadSuccessDesc:"{{count}} image(s) uploaded successfully",videoUploadSuccess:"Video uploaded successfully",professionalLimit:"Professional users can upload up to 10 images and 1 video per listing",freeLimit:"Free users can upload up to 3 images per listing"},yCe={opportunities:{title:"Volunteer Opportunities",subtitle:"Contribute to the community and earn CEI credits",available:"opportunities",noResults:"No opportunities found",tryDifferentFilters:"Try changing the search filters"},myApplications:"My Applications",myRequests:"My Requests",search:"Search opportunities...",allCities:"All cities",viewListing:"View Listing",accept:"Accept",confirmService:"Confirm Service",confirmServiceTitle:"Confirm Completion",confirmServiceDescription:"Do you confirm that the service has been completed? The volunteer will automatically receive the compensation in CEI credits.",confirmAndPay:"Confirm and Pay",applicationSent:"Application sent",applicationSentDesc:"The requester will review your application",applicationError:"Unable to send application",applicationAccepted:"Application accepted",volunteerNotified:"The volunteer has been notified",acceptError:"Unable to accept application",serviceConfirmed:"Service confirmed",paymentProcessed:"Payment has been processed",confirmError:"Unable to confirm service",browseOpportunities:"Browse Opportunities",createRequest:"New Request",pending:"Pending",active:"Active",completed:"Completed",noPendingRequests:"No pending applications",noActiveRequests:"No active requests",noCompletedRequests:"No completed requests",requests:{subtitle:"Manage received applications"},requestDetails:"Volunteer Request Details",compensation:"CEI Credits Compensation",compensationDesc:"How many CEI credits the volunteer will receive upon service completion. The platform will pay this amount.",recurringService:"Recurring Service",recurringServiceDesc:"Is this a one-time or recurring volunteer opportunity?",maxVolunteers:"Maximum Volunteers",maxVolunteersDesc:"How many volunteers can help with this request? Leave empty for unlimited.",compensationRequired:"CEI credits compensation is mandatory for volunteer requests (minimum 1 CEI)"},_Ce={backToHome:"Back to Home",heroTitle:"Welcome to the Independent Economic Community",heroSubtitle:"A Solidarity Economy to Strengthen Our Communities",philosophyTitle:"Understanding Money: A Cultural Revolution",philosophyText1:"Money is simply a representation of wealth, not wealth itself. If wealth is created by our hands, our work, our skills, why should its representation be owned by private central banks?",philosophyText2:"CEI Credits are our answer: a Unit of Account that cannot be bought or sold. Credits are earned only through DOING for the common good: offering products, services, skills to the community, or contributing with certified volunteer work.",featuresTitle:"How the CEI Platform Works",freeUsersTitle:"For all users:",freeFeature1:"Personal wallet with CEI credits management",freeFeature2:"Community marketplace to exchange goods and services",freeFeature3:"Hybrid pricing: 100% CEI credits or euros + credits (minimum 20% in credits)",freeFeature4:"Interactive map to discover offers in your area and beyond",freeFeature5:"Messaging to contact sellers and buyers",freeFeature6:"Public profile to present your activity",proUsersTitle:"For professional users (â¬50/year):",proFeature1:"Up to 50 storefronts with 10 photos + 1 video each",proFeature2:'"Professional" badge for greater visibility',proFeature3:"Priority support from the community",benefitsTitle:"The Benefits of Participating",benefitsIntro:"Regaining mutual trust in a protected and supportive environment, where:",benefit1:"Economic relations are based on cooperation, not competition",benefit2:"Local communities are strengthened through territorial exchanges",benefit3:"Every contribution to the common good is recognized and rewarded in credits",benefit4:"Wealth circulates within the network, without financial intermediaries",benefit5:"Isolated communities connect in a national solidarity network",gettingStartedTitle:"Get Started Now",step1:"Complete your profile with city and skills",step2:"Receive your welcome bonus in CEI credits",step3:"Create your first storefront or explore the marketplace",step4:"Trade with confidence in your territorial community and beyond",closingStatement:"CEI is more than a platform: it's a way to reclaim our wealth and build together an economy serving people, not profit.",getStartedButton:"Get Started Now",bannerText:"Solidarity economy ⢠Territorial communities ⢠Credits that are earned, not bought",learnMore:"Learn More"},vCe={backToMarketplace:"Back to Marketplace",heroTitle:"Frequently Asked Questions",heroSubtitle:"Everything you need to know to use the CEI platform",bannerText:"Have questions? Check our FAQ",gettingStartedTitle:"Getting Started",q1:"How do I register on the platform?",a1:"Click on 'Sign In' and follow the authentication process with Replit. After first login, complete your profile by entering first name, last name, city and a brief description of yourself or your business.",q2:"Do I receive credits when I register?",a2:"Yes! Every new user receives a welcome bonus in CEI credits upon profile completion. This allows you to immediately start exploring the marketplace and make your first purchases.",q3:"How do I complete my profile?",a3:"Go to your Dashboard and click 'Edit Profile'. Fill in all required fields: first name, last name, city and description. The city is mandatory because it's used to position you on the interactive marketplace map.",listingsTitle:"Creating and Managing Listings",q4:"How do I create a listing?",a4:"From the Dashboard, click 'Create Listing'. Enter title, description, category, price in euros and CEI credits (at least 20% must be in credits), your city, and upload photos. Free users can upload up to 3 photos, professionals up to 10 photos + 1 video.",q5:"Can I sell only in euros without CEI credits?",a5:"No. The CEI platform requires that ALL listings include CEI credits in the price. You can sell at 100% CEI credits, or create a hybrid price (euros + credits) with at least 20% in CEI credits.",q6:"How many listings can I create?",a6:"Free users have no limits on the number of listings, but can only upload 3 photos per listing. Professional users (â¬50/year) can create up to 50 listings with 10 photos + 1 video each.",q7:"How do I edit or delete a listing?",a7:"Go to Dashboard, click 'My Listings', find the listing you want to edit and click the edit icon. To delete a listing, click the trash icon. Warning: deletion is permanent.",creditsTitle:"CEI Credits",q8:"What are CEI credits?",a8:"CEI credits are a Unit of Account that represents the value of work, skills and contributions to the community. They cannot be bought or sold - they are earned only by offering goods, services or certified volunteer contributions.",q9:"How can I earn CEI credits?",a9:"You can earn CEI credits in three ways: 1) Selling products or services through the marketplace, 2) Receiving transfers from other users, 3) Participating in volunteer activities certified by the community. Administrators can also assign credits for special contributions.",q10:"Can I convert CEI credits to euros?",a10:"No. CEI credits are not convertible to euros. They are designed to circulate within the CEI network as a community exchange tool. You can use them to purchase goods and services from other community members.",professionalTitle:"Professional Account",q11:"What are the benefits of a professional account?",a11:"The professional account (â¬50/year) allows you to: create up to 50 storefronts, upload 10 photos + 1 video per listing, get a 'Professional' badge visible on your listings, a personal Store Page with customizable cover image, receive priority support from the community and access advanced features.",q12:"How do I become a professional user?",a12:"Contact the platform administrator to request the Professional upgrade (â¬50/year). The upgrade is
668immediate and lasts a full year.",storeTitle:"Store Page",q24:"What is the Store Page?",a24:"The Store Page is a personal showcase available for professional users. It's a dedicated page where customers can see all your listings in one place, with your profile picture, profession, city and a customizable cover image.",q25:"How do I access my Store Page?",a25:"Your Store Page has a dedicated URL like: comunitaeconomicaindipendente.it/store/[your-id]. Customers can also access it by clicking the 'Visit my store' button on all your listings. You can share this link on social media or in your promotional materials.",q26:"How do I customize my store cover?",a26:"Go to 'Edit Profile' from the Dashboard. In the section for professional users, you'll find 'Store Cover'. Upload an image (recommended 1200x400px, max 5MB) that represents your business. This will appear at the top of your Store Page.",q27:"Can customers contact me from the Store Page?",a27:"From the Store Page, customers can see all your listings and click on each one for details. From there they can contact you through the platform's messaging system. The Store Page also shows your website (if added to your profile) as a clickable link.",safetyTitle:"Communication and Safety",q13:"How do I contact a seller?",a13:"Click the 'Contact' button on the listing or on the interactive map. This will open the internal chat where you can send real-time messages. All conversations are private and secure.",q14:"How does payment work?",a14:"EURO payments happen EXTERNALLY to the platform - you and the seller agree on the method (bank transfer, cash, etc). CEI credit payments happen directly on the platform: when you confirm the purchase, credits are automatically transferred from your wallet to the seller's.",referralTitle:"Referral Program",q15:"What is the referral program?",a15:"The referral program allows you to invite friends to the CEI platform. When someone signs up using your personal link, you both receive bonus credits: you get 20 CEI credits as a thank you, and your friend receives 10 bonus credits to get started.",q16:"How do I find my referral link?",a16:"Go to the 'Referral System' page from your Dashboard. You'll find your personal code and a unique link to share. You can copy the link and share it via WhatsApp, Telegram, email or any other channel you prefer.",q17:"How many people can I invite?",a17:"There's no limit! You can invite as many people as you want. For every friend who signs up and completes their profile using your link, you'll receive 20 CEI credits. The more people you invite, the more credits you earn.",q18:"How are my referrals tracked?",a18:"The system uses a cookie that lasts 30 days. When someone clicks your link, your code is stored. If they sign up within 30 days, you'll be recognized as the referrer. You can see all your referrals and earned credits on the dedicated page.",volunteerTitle:"Volunteer Services",q19:"What are Volunteer Services?",a19:"Volunteer Services are a special category of listings where community members can request help for activities of common interest. Those who respond and complete the service are paid by the platform itself in CEI credits, not by the requester.",q20:"How does payment work for volunteers?",a20:"When a volunteer completes a service, the CEI platform automatically pays CEI credits directly to their wallet. The amount is set by the person who creates the volunteer listing (minimum 1 CEI credit). This payment comes from the platform's reserve, not from the service requester. It's a way to reward those who contribute to the community.",q21:"How can I apply for a volunteer service?",a21:"Search for listings in the 'Volunteer Services' category in the marketplace. When you find an interesting opportunity, click 'Apply' to send your availability. The requester will receive a notification and can accept your application.",q22:"What are the states of a volunteer assignment?",a22:"The flow is: 1) 'Applied' - you've sent your availability, 2) 'Accepted' - the requester confirmed, 3) 'Service Completed' - you've finished the activity, 4) 'Confirmed' - the requester confirms and you receive credits. If the service doesn't work out, it can be 'Rejected' or 'Cancelled'.",q23:"Can I create volunteer requests?",a23:"Yes! Go to 'Create Listing' and select the 'Volunteer Services' category. Describe the activity you need help with (e.g., moving assistance, tutoring, accompaniment) and specify how many CEI credits the volunteer will receive as compensation (minimum 1 credit). Interested volunteers will apply and you can choose who to accept. Remember: the platform will pay the volunteer, not you.",voucherTitle:"Voucher Campaigns",q28:"What are voucher campaigns?",a28:"Voucher campaigns are a system for distributing bonus CEI credits during community events. The administrator creates a voucher co
668de with a specific amount, and event participants can redeem it to receive extra credits in their wallet.",q29:"How do I redeem a voucher code?",a29:"In your Dashboard you'll find the 'Redeem Voucher' section. Enter the code you received during the event and click 'Redeem'. The bonus credits will be added to your wallet immediately. Each voucher can only be redeemed once per user.",q30:"How do I get a voucher code?",a30:"Voucher codes are distributed during CEI community events. Attend meetings, assemblies and activities organized by the community to receive codes. Vouchers may have an expiration date and a maximum number of uses, so redeem them as soon as possible.",mapTitle:"Interactive Map",q31:"How does the interactive map work?",a31:"The map shows all CEI community members with a marker on their location. You can click on each marker to see the user's profile, their listings and contact them directly. Professional users have a different marker to distinguish them.",q32:"How do I appear on the map?",a32:"To appear on the map you need to complete your profile by entering your city and address. The system automatically calculates the coordinates from your location. If you notice your position isn't accurate, try saving your profile again with a more detailed address.",stillNeedHelp:"Can't find what you're looking for?",contactSupport:"Contact Support"},xCe={bannerText:"New here? Learn how to register",bannerCta:"Step-by-step guide",backToMarketplace:"Back to Marketplace",heroTitle:"Registration Guide",heroSubtitle:"Follow these 8 simple steps to create your CEI account",timeEstimate:"Estimated time: 3-5 minutes",beforeYouStart:"Before you start, make sure you have:",requirement1:"A valid email address you can access",requirement2:"A few minutes to complete the registration",requirement3:"Your personal details (first name, last name, city)",tipLabel:"Tip:",step1Title:'Click "Sign In"',step1Desc:`From the main CEI marketplace page, find the "Sign In" button in the top right corner. 669 670Click the button to start the registration process.`,step1Tips:"If you're on a smartphone, the button might be in the hamburger menu (the three horizontal lines).",step2Title:'Choose "Continue with email"',step2Desc:`A Replit window will open (the system that manages accounts). 671 672Click "Continue with email", then enter your email address and choose a password.`,step2Tips:"Use an email you check regularly. Choose a secure password you'll remember.",step3Title:"Verify Email Code",step3Desc:`Replit will send a 6-digit verification code to your email. 673 674Open your inbox, find the email from Replit (check spam/junk too), copy the code and paste it in the Replit window.`,step3Tips:`The code expires after a few minutes. If it doesn't arrive, click "Resend code" to receive it again.`,step4Title:"Create your Replit Account",step4Desc:`If this is your first time using Replit, you'll be asked to: 675 676⢠Create a username 677⢠Fill in some optional fields (profession, what you want to do, etc.) 678 679These forms are from Replit, not CEI. You can fill them quickly or skip them if possible.`,step4Tips:"Choose a simple username. The additional fields (profession, projects) are for Replit and don't affect your CEI account.",step5Title:"Authorize CEI Access",step5Desc:`Replit will ask you to authorize access to the CEI platform. 680 681Click "Authorize" to allow CEI to read your basic information (email and username).`,step5Tips:"This authorization is secure. CEI will never have access to your Replit password.",step6Title:"Complete your CEI Profile",step6Desc:`Now you're on the CEI platform! You'll see a form to complete your profile. 682 683Enter: 684⢠First and Last Name 685⢠Phone number 686⢠Your profession or activity`,step6Tips:"Fill in all fields carefully. This information will help other users get to know you.",step7Title:"Add your Location",step7Desc:`Enter your full address and city. This data is essential to: 687 688⢠Appear on the marketplace map 689⢠Be found by those looking for services in your area 690⢠Find offers near you 691 692Our community is built on trust and transparency.`,step7Tips:"An accurate address helps other community members find you easily.",step8Title:"Save and Start!",step8Desc:`Click "Save Profile" to complete the registration. 693 694Congratulations! You've created your CEI account and received your first welcome credits!`,step8Tips:"Now you can explore the marketplace, create listings and start using your CEI credits.",completedTitle:"Registration Complete!",completedDesc:"Once you've completed all steps, you'll have full access to the CEI platform:",benefit1:"Welcome credits in your wallet",benefit2:"Ability to create listings in the marketplace",benefit3:"Chat to contact sellers and buyers",benefit4:"Access to the referral program to invite friends",readyToStart:"Ready to start?",startButton:"Go to Marketplace and Register",needHelp:"Still have questions?",checkFaq:"Check the FAQ"},bCe={redeemTitle:"Redeem Voucher",redeemDescription:"Enter a voucher co
694de to receive bonus CEI credits",enterCode:"Enter voucher code...",redeem:"Redeem",congratulations:"Congratulations!",redeemSuccess:"You have received {{amount}} bonus CEI credits!",title:"Voucher Campaigns",subtitle:"Create and manage voucher campaigns for community events",create:"Create Voucher",edit:"Edit Voucher",createDesc:"Set up a new voucher code for community distribution",editDesc:"Update voucher settings",noVouchers:"No voucher campaigns yet",createFirst:"Create your first voucher campaign",active:"Active",inactive:"Inactive",scheduled:"Scheduled",expired:"Expired",newUsersOnly:"New Users Only",existingUsersOnly:"Existing Users Only",allUsers:"All Users",code:"Code",name:"Voucher Name",namePlaceholder:"e.g., Summer Event 2025",description:"Description",descriptionPlaceholder:"Describe this voucher campaign...",bonusType:"Bonus Type",fixed:"Fixed Amount",multiplier:"Multiplier",bonusValue:"Bonus Value",targetAudience:"Target Audience",startsAt:"Start Date",endsAt:"End Date",maxRedemptions:"Max Redemptions",unlimited:"Unlimited",isActive:"Active",redemptions:"Redemptions",totalDistributed:"Total Distributed",sendBroadcast:"Send Broadcast",broadcastDesc:"Send voucher code {{code}} to all users",broadcastTemplate:"Special bonus! Use code {{code}} to receive {{bonus}} credits!",message:"Message",send:"Send",errors:{notFound:"Voucher code not found",inactive:"This voucher is no longer active",notStarted:"This voucher is not yet valid",expired:"This voucher has expired",newUsersOnly:"This voucher is only valid for new users",existingUsersOnly:"This voucher is only valid for existing users",maxRedemptionsReached:"This voucher has reached its maximum number of redemptions",alreadyRedeemed:"You have already redeemed this voucher",generic:"Unable to redeem voucher. Please try again"},admin:{title:"Voucher Campaigns",description:"Create and manage voucher campaigns for community events",createNew:"Create Voucher",noVouchers:"No voucher campaigns yet",noVouchersDesc:"Create your first campaign to distribute bonus credits at events",code:"Code",name:"Campaign Name",namePlaceholder:"e.g., Summer Event 2025",bonusType:"Bonus Type",bonusTypeFixed:"Fixed Amount",bonusTypeMultiplier:"Multiplier",bonusAmount:"Bonus Amount",bonusMultiplier:"Multiplier (e.g., 1.5 = 50% extra)",targetAudience:"Target Audience",targetAll:"All Users",targetNewUsers:"New Users Only",targetExistingUsers:"Existing Users Only",maxRedemptions:"Max Redemptions (0 = unlimited)",startDate:"Start Date",endDate:"End Date",active:"Active",inactive:"Inactive",redemptions:"Redemptions",created:"Created",actions:"Actions",edit:"Edit",toggleStatus:"Toggle Status",delete:"Delete",deleteConfirm:"Delete this voucher campaign?",deleteDesc:"This action cannot be undone. All redemption data will be lost.",createSuccess:"Voucher campaign created successfully",updateSuccess:"Voucher campaign updated successfully",deleteSuccess:"Voucher campaign deleted",statusUpdated:"Voucher status updated",error:"An error occurred",broadcast:"Broadcast",broadcastTitle:"Broadcast Voucher Code",broadcastDesc:"Send the voucher code to all users via system message",broadcastMessage:"Message Content",broadcastMessagePlaceholder:"Write a message to accompany the voucher code...",broadcastSend:"Send to All Users",broadcastSuccess:"Voucher code broadcast sent successfully",statistics:"Statistics",totalRedemptions:"Total Redemptions",creditsDistributed:"Credits Distributed"}},wCe={academy:{title:"Video Gallery",subtitle:"Discover tutorials, news, and educational content from our community",allVideos:"All",news:"News",divulgazione:"Educational",tutorial:"Tutorial",medicoAmico:"Friendly Doctor","interviste-giraldi":"Prof. Giraldi Interviews","considerazioni-scientifiche":"Scientific Considerations",intervisteGiraldi:"Prof. Giraldi Interviews",considerazioniScientifiche:"Scientific Considerations",noVideos:"No videos available",noVideosDesc:"Videos will be available soon",watchVideo:"Watch Video",duration:"Duration"},admin:{title:"Video Management",description:"Upload and manage Video Gallery videos",createVideo:"Upload New Video",createVideoDesc:"Add a new video to the Video Gallery",editVideo:"Edit Video",editVideoDesc:"Update video information",deleteVideo:"Delete Video",deleteVideoConfirm:'Are you sure you want to delete the video "{{title}}"? This action cannot be undone.',noVideos:"No videos uploaded",videoFile:"Video File",thumbnail:"Thumbn
694ail Image",titleField:"Title",titlePlaceholder:"Video title...",descriptionField:"Description",descriptionPlaceholder:"Video description...",category:"Category",duration:"Duration (seconds)",durationPlaceholder:"e.g., 120",durationHint:"Duration in seconds",featuredOrder:"Featured Order",orderHint:"Lower numbers appear first",published:"Published",featured:"Featured",draft:"Draft",noDescription:"No description",selectFile:"Select File",selectImage:"Select Image",fileTooLarge:"File is too large. Maximum {{max}}MB",uploadFailed:"Upload failed. Please try again",createSuccess:"Video uploaded successfully",updateSuccess:"Video updated successfully",deleteSuccess:"Video deleted successfully",publish:"Publish",unpublish:"Unpublish",feature:"Feature",unfeature:"Unfeature"}},SCe={dialogTitle:"Privacy Policy Acceptance",dialogDesc:"Before using the platform, please read and accept our privacy policy.",dataControllerTitle:"Data Controller",dataControllerText:"Associazione Comunità Economica Indipendente is the data controller for your personal data.",dataCollectedTitle:"Data Collected",dataCollectedText:"We collect personal data such as name, email, phone, address and transaction data to provide our services.",purposeTitle:"Purpose",purposeText:"Your data is used to manage your account, allow you to publish listings, make transactions and communicate with other users.",rightsTitle:"Your Rights",rightsText:"You have the right to access, rectify, delete your data and object to processing. Contact us at [email protected]",readFullPolicy:"Read the full privacy policy",acceptCheckbox:"I have read and accept the privacy policy and authorize the processing of my personal data under GDPR.",acceptButton:"Accept and Continue",acceptedTitle:"Privacy Accepted",acceptedDesc:"Thank you for accepting our privacy policy.",acceptError:"Error accepting privacy policy. Please try again."},TCe={title:"Documents",subtitle:"Privacy, Code of Ethics and Community Regulations",backToHome:"Back to Home",noDocuments:"No documents available at the moment.",typePrivacy:"Privacy Policy",typeEthics:"Code of Ethics",typeRegulations:"Regulations",typeOther:"Other Documents",view:"View",download:"Download"},CCe={sectionTitle:"CEI Membership Card",title:"MEMBERSHIP CARD",download:"Download Card",number:"Card no.",birthDate:"Date of birth",city:"City",memberSince:"Member since"},ECe={common:YTe,categories:QTe,header:JTe,landing:eCe,marketplace:tCe,orders:iCe,myListings:nCe,createListing:rCe,listingDetail:sCe,dashboard:oCe,admin:aCe,transaction:lCe,wallet:cCe,messages:uCe,user:dCe,profile:hCe,validation:pCe,map:fCe,referral:mCe,upload:gCe,volunteer:yCe,about:_Ce,faq:vCe,registrationGuide:xCe,voucher:bCe,video:wCe,privacy:SCe,documents:TCe,memberCard:CCe},ACe={loading:"Caricamento...",signIn:"Accedi",signUp:"Registrati",enter:"Entra",signOut:"Esci",getStarted:"Inizia",cancel:"Annulla",save:"Salva",remove:"Rimuovi",edit:"Modifica",send:"Invia",clear:"Cancella",clearAll:"Cancella tutto",filters:"Filtri",search:"Cerca",credits:"Crediti",chooseLanguage:"Scegli la tua lingua",dashboard:"Dashboard",backToDashboard:"Torna alla Dashboard",delete:"Elimina"},ICe={"Professional Services":"Servizi Professionali","Home & Garden":"Casa e Giardino","Health & Wellness":"Salute e Benessere",Education:"Formazione",Technology:"Tecnologia","Creative Services":"Servizi Creativi","Food & Catering":"Cibo e Catering",Transportation:"Trasporti","Volunteer Services":"Richieste Servizi di Volontariato",Entertainment:"Intrattenimento","B&B, Hospitality & Catering":"B&B, Ospitalità e Ristorazione","Present Your Project":"Presenta il tuo progetto","Free Services":"Servizi Gratuiti"},kCe={walletManager:"Gestione Portafoglio",adminDashboard:"Dashboard Amministratore",myWallet:"Il Mio Portafoglio"},PCe={title:"Gestisci i Tuoi Crediti",subtitle:"In Modo Sicuro ed Efficiente",description:"Una piattaforma professionale per la gestione del portafoglio, per tracciare e trasferire punti e crediti personalizzati. Semplice, sicura e costruita per il nostro team CEI",purchaseTitle:"Acquista in crediti dai produttori iscritti alla CEI",feature1Title:"Un Portafoglio Per Utente",feature1Desc:"Ogni utente ottiene un portafoglio sicuro creato automaticamente al momento della registrazione. Visualizza il saldo e la cronologia delle transazioni a colpo d'occhio.",feature2Title:"Trasferimenti Facili",feature2Desc:"Trasferisci crediti ad altri utenti istantaneamente. Tutte le transazioni sono tracciate con cronologia completa e descrizioni.",feature3Title:"Controlli Amministratore",feature3Desc:"Gli amministratori possono aggiungere crediti a qualsiasi portafoglio, visualizzare tutti gli utenti e gestire l'intera piattaforma con strumenti potenti.",footer:"Piattaforma di gestione crediti sicura."},NCe={communityName:"Comunità Economica Indipendente",heroTitle:"Scopri Servizi Locali e Sostieni la Tua Comunità ",heroSubtitle:"Naviga prodotti e servizi con prezzi ibridi: euro + crediti comunitari CEI",searchPlaceholder:"Cerca servizi, prodotti...",cityPlaceholder:"Città ",selectCategory:"Tutte le Categorie",searchButton:"Cerca",viewMap:"Visualizza Mappa",supportProject:"Sostieni il Progetto",noListingsTitle:"Nessun annuncio trovato",
694noListingsDesc:"Prova a modificare i filtri",foundUsers:"Profili trovati",userFound:"profilo trovato",usersFound:"profili trovati",featuredListings:"Annunci in evidenza 100% in crediti CEI",loading:"Caricamento annunci...",browseMarketplace:"Sfoglia il Marketplace",viewDetails:"Visualizza Dettagli",upgradeSuccessful:"Aggiornamento Completato!",upgradeSuccessfulDesc:"Ora sei un venditore professionale. Benvenuto!",donationTitle:"Sostieni COMUNITA' ECONOMICA INDIPENDENTE",donationDesc:"Aiutaci a mantenere la piattaforma attiva e sostenere le nostre iniziative comunitarie",donationChooseAmount:"Scegli un importo",donationCustomAmount:"O inserisci un importo personalizzato (â¬)",donationEnterAmount:"Inserisci importo",donationProcessing:"Elaborazione...",donateButton:"Dona â¬{{amount}}",securePayment:"Pagamento sicuro elaborato da Stripe",upgradeTitle:"Passa a Professionale",upgradeDesc:"Sblocca funzionalità premium e fai crescere il tuo business su CEI Marketplace",upgradePerYear:"all'anno",upgradeIncluded:"Cosa è incluso:",upgradeFeature1:"Fino a 50 vetrine sul marketplace",upgradeFeature2:"10 foto + 1 video per annuncio",upgradeFeature3:"Supporto clienti prioritario",upgradeFeature4:"Badge professionale sui tuoi annunci",upgradeFeature5:"Dashboard di analisi avanzata",upgradeFeature6:"Posizionamento in evidenza nei risultati di ricerca",upgradeButton:"Passa a Premium",upgradeProcessing:"Elaborazione...",authRequired:"Accesso richiesto",authRequiredDesc:"ACCEDI GRATUITAMENTE PER ATTIVARE I SERVIZI",searchByCity:"Per Città ",searchByRadius:"Per Raggio",allSellers:"Tutti",professionalOnly:"Solo Professionisti",privateOnly:"Solo Privati",useMyLocation:"Usa la mia posizione",locationSet:"Posizione impostata",locating:"Rilevamento...",locationFound:"Posizione trovata",locationFoundDesc:"La tua posizione è stata rilevata con successo",locationErrorTitle:"Errore Posizione",locationError:"Impossibile rilevare la tua posizione",locationPermissionDenied:"Permesso negato. Abilita la geolocalizzazione nelle impostazioni del browser",locationUnavailable:"Posizione non disponibile. Riprova più tardi",locationNotSupported:"Geolocalizzazione non supportata",locationNotSupportedDesc:"Il tuo browser non supporta la geolocalizzazione",allListings:"Tutti gli annunci",locationRequiredForRadius:"Per la ricerca per raggio devi prima impostare la tua posizione cliccando 'Usa la mia posizione'",radiusLabel:"Raggio di ricerca"},MCe={title:"I Miei Ordini",purchases:"Acquisti",sales:"Vendite",noPurchases:"Nessun acquisto ancora",noPurchasesDesc:"I tuoi ordini come acquirente appariranno qui",noSales:"Nessuna vendita ancora",noSalesDesc:"I tuoi ordini come venditore appariranno qui",pending:"In attesa",reserved:"Prenotato",completed:"Completato",cancelled:"Annullato",expired:"Scaduto",seller:"Venditore",buyer:"Acquirente",listing:"Annuncio",unknown:"Sconosciuto",price:"Prezzo",status:"Stato",orderDate:"Data ordine",expiresOn:"Scade il",buyerNotes:"Note acquirente",confirmOrder:"Conferma Ordine",confirmReceipt:"Conferma Ricezione",cancelOrder:"Annulla Ordine",contactCounterpart:"Contatta",waitingBuyerConfirmation:"In attesa che l'acquirente confermi la ricezione. I crediti ti verranno trasferiti dopo la conferma.",confirmTitle:"Confermare la ricezione?",confirmDesc:"Confermi di aver ricevuto il servizio o prodotto? I crediti saranno trasferiti al venditore.",cancelTitle:"Annullare questo ordine?",cancelDesc:"I crediti prenotati saranno rilasciati all'acquirente.",updating:"Aggiornamento...",orderUpdated:"Ordine Aggiornato",orderConfirmed:"Ordine confermato con successo.",orderCancelled:"Ordine annullato con successo.",updateFailed:"Aggiornamento Fallito",updateError:"Impossibile aggiornare lo stato dell'ordine",manageYourOrders:"Gestisci i tuoi ordini e le tue vendite"},DCe={title:"I Miei Annunci",createNew:"Crea Nuovo Annuncio",noListings:"Nessun annuncio ancora",noListingsDesc:"I tuoi annunci appariranno qui una volta creati",active:"Attivo",inactive:"Inattivo",toggleActive:"Attiva/Disattiva",edit:"Modifica",delete:"Elimina",deleteTitle:"Eliminare questo annuncio?",deleteDesc:"Questa azione non può essere annullata. L'annuncio verrà rimosso permanentemente.",deleting:"Eliminazione...",listingDeleted:"Annuncio Eliminato",listingDeletedDesc:"Il tuo annuncio è stato rimosso con successo.",deleteFailed:"Eliminazione Fallita",deleteError:"Impossibile eliminare l'annuncio",statusUpdated:"Stato Aggiornato",statusUpdatedDesc:"Lo stato dell'annuncio è stato modificato.",statusFailed:"Aggiornamento Fallito",statusError:"Impossibile aggiornare lo stato dell'annuncio"},RCe={createTitle:"Crea Nuovo Annuncio",editTitle:"Modifica Annuncio",basicInfo:"Informazioni di Base",basicInfoDesc:"Inserisci i dettagli principali del tuo annuncio",title:"Titolo",titlePlaceholder:"es., Consulenza Web Design Professionale",description:"Descrizione",descriptionPlaceholder:"Descrivi il tuo prodotto o servizio in dettaglio...",category:"Categoria",selectCategory:"Seleziona una categoria",pricing:"Prezzi",pricingDesc:"Imposta i tuoi prezzi (almeno uno richiesto)",pricingOptionalDesc:"Per questa categoria il prezzo è opzionale. Puoi lasciare i campi vuoti.",clearPrice
694s:"Cancella prezzi",priceEuros:"Quota ⬠(min. 0% max 80%)",priceCredits:"Quota Crediti CEI (min. 20% max. 100%)",hybridPricingNote:"Se usi entrambi, i crediti devono essere almeno il 20% del valore totale",location:"Posizione",locationDesc:"Aggiungi la tua posizione per apparire sulla mappa",address:"Indirizzo",city:"Città ",country:"Paese",latitude:"Latitudine",longitude:"Longitudine",imageUrl:"URL Immagine",imageUrlPlaceholder:"https://esempio.com/immagine.jpg",images:"Immagini e Video",requiresContact:"Richiede contatto preventivo",requiresContactDesc:"Attiva se l'acquirente deve contattarti prima di ordinare (es. per concordare taglia, quantità , date)",activeStatus:"Stato Attivo",activeStatusDesc:"Rendi visibile questo annuncio agli acquirenti",saving:"Salvataggio...",createButton:"Crea Annuncio",updateButton:"Aggiorna Annuncio",cancel:"Annulla",success:"Successo!",listingCreated:"Il tuo annuncio è stato creato con successo.",listingUpdated:"Il tuo annuncio è stato aggiornato con successo.",error:"Errore",createError:"Impossibile creare l'annuncio. Riprova.",updateError:"Impossibile aggiornare l'annuncio. Riprova.",validationError:"Controlla il modulo per errori di validazione"},jCe={professional:"Professionale",postedOn:"Pubblicato il",location:"Posizione",price:"Prezzo",yourBalance:"Il Tuo Saldo",aboutSeller:"Informazioni sul Venditore",viewProfile:"Vedi Profilo",viewStore:"Vedi Vetrina",description:"Descrizione",placeOrder:"Effettua Ordine",contactSeller:"Contatta Venditore",interestedMessage:"Ciao! Sono interessato/a al tuo annuncio: {{title}}",backToListings:"Torna agli Annunci",orderPlaced:"Ordine Effettuato!",orderPlacedDesc:"Il tuo ordine è stato creato. I crediti sono stati prenotati.",insufficientCredits:"Crediti Insufficienti",insufficientCreditsDesc:"Non hai abbastanza crediti CEI per questo ordine.",orderFailed:"Ordine Fallito",orderError:"Impossibile creare l'ordine. Riprova.",notesLabel:"Note per il Venditore",notesPlaceholder:"Note aggiuntive per il venditore (opzionale)...",noteLabel:"Nota",euroNote:"La quota in Euro va pagata direttamente al venditore secondo gli accordi.",creditsNote:"I crediti CEI verranno prenotati al momento dell'ordine e trasferiti al completamento.",requiresContactInfo:"Per questo annuncio è necessario contattare prima il venditore per concordare i dettagli dell'ordine.",ownListing:"Questo è un tuo annuncio",editListing:"Modifica Annuncio",submit:"Invia Ordine",submitting:"Invio..."},zCe={title:"Il Mio Portafoglio",subtitle:"Gestisci i tuoi crediti e visualizza la cronologia delle transazioni",balance:"Saldo",customizeName:"Personalizza nome portafoglio",walletName:"Nome Portafoglio",walletNamePlaceholder:"es., Il Mio Portafoglio Principale",walletNameDescription:"Dai al tuo portafoglio un nome personalizzato per personalizzare la tua esperienza.",walletBalance:"Saldo Portafoglio",transferCredits:"Trasferisci Crediti",recipient:"Destinatario",selectUser:"Seleziona un utente",noOtherUsers:"Nessun altro utente disponibile",recipientEmail:"Email Destinatario",amount:"Importo",amountPlaceholder:"0,00",description:"Descrizione",descriptionOptional:"Descrizione (opzionale)",descriptionPlaceholder:"Per cosa è questo trasferimento?",transactionHistory:"Cronologia Transazioni",transferSubmit:"Trasferisci Crediti",transferring:"Trasferimento...",saving:"Salvataggio...",noTransactionsTitle:"Nessuna transazione ancora",noTransactionsDesc:"La cronologia delle transazioni apparirà qui una volta iniziato a trasferire crediti.",myListings:"I Miei Annunci",myOrders:"I Miei Ordini",messages:"Messaggi",createListing:"Crea Annuncio",goToMarketplace:"Vai al Marketplace"},LCe={title:"Gestione Utenti",subtitle:"Visualizza tutti gli utenti e gestisci i crediti del portafoglio",allUsers:"Tutti gli Utenti",noUsers:"Nessun utente trovato",addCredits:"Aggiungi Crediti al Portafoglio",user:"Utente",selectUser:"Seleziona un utente",noUsersAvailable:"Nessun utente disponibile",userEmail:"Email Utente",amount:"Importo",amountPlaceholder:"0,00",reason:"Motivo",reasonOptional:"Motivo (opzionale)",reasonPlaceholder:"Perché stai aggiungendo questi crediti?",addCreditsSubmit:"Aggiungi Crediti",addingCredits:"Aggiunta...",allTransactions:"Tutte le Transazioni",editWallet
694Name:"Modifica Nome Portafoglio",admin:"Amministratore",unknownUser:"Utente Sconosciuto",signupBonus:"Bonus Iscrizione",signupBonusTitle:"Configura Bonus Iscrizione",signupBonusDesc:"Imposta l'importo dei crediti che i nuovi utenti ricevono quando creano un account",signupBonusAmount:"Importo Bonus",signupBonusPlaceholder:"100,00",signupBonusSave:"Salva Bonus Iscrizione",signupBonusSaving:"Salvataggio...",signupBonusSuccess:"Bonus iscrizione aggiornato",signupBonusSuccessDesc:"I nuovi utenti riceveranno ora {{amount}} crediti alla registrazione",signupBonusError:"Impossibile aggiornare il bonus iscrizione",currentBonus:"Corrente: {{amount}} crediti",professionalPriceTitle:"Prezzo Upgrade Professionale",professionalPriceDesc:"Imposta il costo annuale per l'upgrade all'account professionale",professionalPriceAmount:"Prezzo (EUR)",professionalPricePlaceholder:"50,00",professionalPriceSave:"Salva Prezzo",professionalPriceSaving:"Salvataggio...",professionalPriceSuccess:"Prezzo upgrade aggiornato",professionalPriceSuccessDesc:"Il nuovo prezzo per l'upgrade professionale è â¬{{amount}}/anno",professionalPriceError:"Impossibile aggiornare il prezzo",currentPrice:"Corrente: â¬{{amount}}/anno",totalCreditsIssued:"Totale Crediti Emessi",creditsIssuedDesc:"Storico totale ad oggi",exchangeVolume:"Volume Scambi",exchangeVolumeDesc:"Transazioni fra utenti",professionalStatusTitle:"Gestione Status Professionale",professionalStatusDesc:"Attiva o disattiva manualmente lo status professionale per gli utenti",activateProfessional:"Attiva",deactivateProfessional:"Disattiva",manualProfessionalActivation:"Attivazione manuale status professionale",manualProfessionalDeactivation:"Disattivazione manuale status professionale",deleteUser:"Elimina Utente",deleteUserWarning:"Sei sicuro di voler eliminare l'utente",deleteUserPermanent:"Questa azione è irreversibile. Tutti i dati dell'utente (wallet, annunci, ordini, messaggi) verranno eliminati definitivamente.",userDeleted:"Utente eliminato con successo",deleteUserFailed:"Impossibile eliminare l'utente",confirmDelete:"Elimina Definitivamente",processing:"Elaborazione...",bulkCreditTitle:"Crediti in Blocco a Tutti gli Utenti",bulkCreditDesc:"Aggiungi crediti a tutti gli utenti contemporaneamente. Questo accrediterà ogni utente nel sistema con l'importo specificato.",bulkCreditSuccess:"Crediti in Blocco Completati",bulkCreditSuccessDesc:"Accreditati {{successCount}} di {{totalUsers}} utenti ({{failCount}} falliti)",bulkCreditError:"Errore Crediti in Blocco",bulkCreditErrorDesc:"Impossibile accreditare gli utenti",bulkCreditPlaceholder:"Motivo del credito in blocco (richiesto)",bulkCreditButton:"Accredita Tutti gli Utenti",broadcastTitle:"Messaggio Broadcast",broadcastDesc:"Invia un messaggio a tutti gli utenti contemporaneamente. Ogni utente riceverà questo messaggio nella propria casella di posta.",broadcastSuccess:"Messaggio Broadcast Inviato",broadcastSuccessDesc:"Inviato a {{successCount}} di {{totalRecipients}} utenti ({{failCount}} falliti)",broadcastError:"Errore Broadcast",broadcastErrorDesc:"Impossibile inviare il messaggio broadcast",broadcastLabel:"Contenuto Messaggio",broadcastPlaceholder:"Scrivi qui il tuo messaggio broadcast...",broadcastButton:"Invia a Tutti gli Utenti",sending:"Invio in corso...",exportMembers:"Esporta Libro Soci (CSV)",exportMembersDesc:"Scarica il registro completo dei soci in formato CSV"},OCe={title:"Cronologia Transazioni",filters:"Filtri",clearAll:"Cancella tutto",filterType:"Tipo",filterSearch:"Cerca",filterFrom:"Da",filterTo:"A",filterMin:"Min",filterMax:"Max",allTypes:"Tutti i Tipi",type:"Tipo",typeAll:"Tutti i Tipi",typeTransfer:"Trasferimento",typeAdminCredit:"Credito Amministratore",date:"Data",startDate:"Data Inizio",endDate:"Data Fine",amount:"Importo",minAmount:"Importo Minimo",maxAmount:"Importo Massimo",description:"Descrizione",from:"Da",to:"A",createdBy:"Creato Da",noTransactions:"Nessuna transazione ancora",noTransactionsDesc:"La cronologia delle transazioni apparirà qui una volta iniziato a trasferire crediti.",noDescription:"Nessuna descrizione",transferTo:"Trasferimento a",transferFrom:"Ricevuto da",creditsAddedByAdmin:"Crediti aggiunti dall'amministratore",unknown:"Utente sconosciuto",badgeAdmin:"Admin",badgeTransfer:"Trasferimento",history:"Cronologia Transazioni",you:"Tu",system:"Sistema",searchPlaceholder:"Cerca transazioni..."},FCe={credits:"Crediti CEI"},BCe={unauthorized:"Non Autorizzato",unauthorizedDesc:"Sei disconnesso. Accesso in corso...",unauthorizedLogin:"Accedi nuovamente per continuare.",accessDenied:"Accesso Negato",accessDeniedDesc:"Non hai privilegi di amministratore.",transferSuccess:"Trasferimento riuscito",transferSuccessDesc:"I crediti sono stati trasferiti con successo.",transferError:"Trasferimento fallito",transferErrorDesc:"Impossibile trasferire crediti. Riprova.",creditSuccess:"Crediti aggiunti",creditSuccessDesc:"I crediti sono stati aggiunti al portafoglio dell'utente con successo.",creditError:"Impossibile aggiungere crediti",creditErrorDesc:"Impossibile aggiungere crediti. Riprova.",walletUpdateSuccess:"Portafoglio aggiornato",walletUpdateSuccessDesc:"Il nome del tuo portafoglio è stato aggiornato con successo.",walletUpdateError:"Errore",walletUpdateErrorDesc:"Impossibile aggiornare il nome del portafoglio",donationFailed:"Donazione Fallita",donationFailedDesc:"Impossibile processare la donazione",invalidAmount:"Importo Non Valido",invali
694dAmountDesc:"Inserisci un importo di donazione valido",upgradeFailed:"Aggiornamento Fallito",upgradeFailedDesc:"Impossibile avviare il processo di aggiornamento",error:"Errore",success:"Successo",fetchError:"Impossibile caricare",sendError:"Impossibile inviare il messaggio",loadingMessages:"Caricamento messaggi...",loadingOrders:"Caricamento ordini...",typeMessage:"Scrivi il tuo messaggio...",userFallback:"Utente",broadcastNoReply:"Questo è un messaggio broadcast - le risposte non sono permesse",broadcastHistory:"Storico Broadcast",messageSent:"messaggio inviato",messagesSent:"messaggi inviati",sentTo:"inviato a",recipients:"destinatari",upgradeCancelled:"Aggiornamento Annullato",upgradeCancelledDesc:"Il tuo aggiornamento professionale è stato annullato.",thankYou:"Grazie!",donationSuccess:"La tua donazione aiuta a sostenere la nostra piattaforma comunitaria.",donationCancelled:"Donazione Annullata",donationCancelledDesc:"La tua donazione è stata annullata.",categoryPlaceholder:"Categoria",promotedToAdmin:"Promosso ad amministratore",demotedFromAdmin:"Declassato da amministratore",failedToUpdateRole:"Impossibile aggiornare il ruolo"},UCe={defaultName:"Utente",fetchError:"Impossibile recuperare le transazioni"},VCe={title:"Completa il Tuo Profilo",subtitle:"Compila le informazioni richieste per iniziare a usare il tuo wallet",editTitle:"Modifica Profilo",editSubtitle:"Aggiorna le tue informazioni personali",welcomeTitle:"Benvenuto!",welcomeMessage:"Completa il tuo profilo per usufruire del servizio",completeNow:"Completa Ora",firstName:"Nome",firstNamePlaceholder:"Mario",lastName:"Cognome",lastNamePlaceholder:"Rossi",phone:"Telefono",phonePlaceholder:"+39 123 456 7890",address:"Indirizzo",addressPlaceholder:"Via Roma 123",city:"Città ",cityPlaceholder:"Milano",dateOfBirth:"Data di Nascita",profession:"Professione",professionPlaceholder:"es. Ingegnere, Medico, Insegnante",bio:"Chi sono",bioPlaceholder:"Raccontaci qualcosa di te, le tue competenze, interessi e cosa offri alla comunità ...",website:"Sito Web (facoltativo)",websitePlaceholder:"https://tuosito.it",saveProfile:"Salva Profilo",updateProfile:"Aggiorna Profilo",updating:"Aggiornamento...",successTitle:"Profilo aggiornato",successDesc:"Le tue informazioni sono state salvate con successo.",errorTitle:"Errore",errorDesc:"Impossibile aggiornare il profilo. Riprova.",userProfile:"Profilo Utente",noAdditionalInfo:"Nessuna informazione aggiuntiva disponibile",userNotFound:"Utente non trovato",email:"Email",adminStatus:"Stato Amministratore",isAdmin:"Amministratore",notAdmin:"Utente Standard"},$Ce={titleMin:"Il titolo deve contenere almeno 5 caratteri",descMin:"La descrizione deve contenere almeno 20 caratteri",validUrl:"Deve essere un URL valido",priceRequired:"Almeno un prezzo (euro o crediti) deve essere impostato",hybridPricing:"Con prezzi ibridi, i crediti devono essere almeno il 20% del valore totale",creditsRequired:"I crediti CEI sono obbligatori per tutti gli annunci (100% crediti o prezzo ibrido)",creditsMinimum:"Quando usi prezzi ibridi, i crediti devono essere almeno il 20% del valore totale"},qCe={marker:"marcatore",markers:"marcatori",listing:"annuncio",listings:"annunci",user:"utente",users:"utenti",onMap:"in mappa",totalMembers:"iscritti totali",legend:"Legenda",professionalListing:"Annuncio Professionale",privateListing:"Annuncio Privato",professionalUser:"Utente Professionale",privateUser:"Utente Privato",contactSeller:"Contatta Venditore",sendMessage:"Invia Messaggio",noUsers:"Nessun utente sulla mappa",noUsersDescription:"Non ci sono utenti con dati sulla posizione da mostrare.",viewListings:"Visualizza Annunci",viewProfile:"Vedi Profilo",viewStore:"Vedi Negozio",viewAll:"Mostra Tutti",centerOnMe:"Centra su di me",searchUser:"Cerca utente...",noSearchResults:"Nessun utente trovato",completeProfileFirst:"Completa il profilo per abilitare",noLocationTitle:"Posizione Mancante",noLocationDesc:"Completa il tuo profilo con indirizzo e città per usare questa funzione",invalidCoordsTitle:"Coordinate Non Valide",invalidCoordsDesc:"Le tue coordinate sono corrotte. Aggiorna il tuo profilo per risolvere"},HCe={title:"Sistema Referral",heroTitle:"Invita Amici e Guadagna Crediti CEI",heroDescription:"Condividi il tuo link referral e ricevi 20 crediti CEI per ogni amico che si iscrive. Il tuo amico riceverà 10 crediti bonus extra!",friendsInvited:"Amici Invitati",creditsEarned:"Crediti Guadagnati",yourCode:"Il Tuo Codice",shareLink:"Condividi il Tuo Link Referral",shareLinkDesc:"Copia e condividi questo link con i tuoi amici per invitarli alla piattaforma",copy:"Copia",copied:"Copiato!",copiedDesc:"Link referral copiato negli appunti",copyError:"Impossibile copiare il link",yourReferrals:"I Tuoi Referral",yourReferralsDesc:"Persone che si sono iscritte tramite il tuo link",noReferrals:"Non hai ancora invitato nessuno",joinedOn:"Iscritto il {{date}}",active:"Attivo",emailSubject:"Unisciti alla Comunità Economica Indipendente",emailBody:"Ciao! Ti invito a unirti alla piattaforma CEI. Registrati con il mio link e riceverai 10 crediti bonus: {{link}}",whatsappMessage:"Ciao! Ti invito a unirti alla piattaforma CEI. Ricevi 10 crediti bonus iscrivendoti con il mio link: {{link}}",telegramMessage:"Unisciti alla piattaforma CEI e ricevi 10 crediti bonus"},GCe={browse:"sfoglia i file",dropPasteFiles:"Trascina i file qui, incolla o %{browse}",dropHint:"Trascina i file qui",uploading:"Caricamento in corso...",complete:"Caricamento completato",failed:"Caricamento fallito",uploadImages:"Carica Immagini",uploadVideo:"Carica Video",imagesUploaded:"{{count}} immagine/i caricate",videoUploaded:"1 video caricato",uploadSuccess:"Successo",uploadSuccessDesc:"{{count}} immagine/i caricata/e con successo",videoUploadSuccess:"Video caricato con successo",professionalLimit:"Gli utenti professionali possono caricare fino a 10 immagini e 1 video per annuncio",freeLimit:"Gli utenti gratuiti possono caricare fino a 3 immagini per annuncio",selectPreviewHint:"Clicca su un'immagine per impostarla come anteprima",image:"Immagine"},WCe={opportunities:{title:"Opportunità di Volontariato",subtitle:"Contribuisci alla comunità e guadagna crediti CEI",available:"opportunità ",noResults:"Nessuna opportunità trovata",tryDifferentFilters:"Prova a modificare i filtri di ricerca"},myApplications:"Le Mie Candidature",myRequests:"Le Mie Richieste",search:"
694Cerca opportunità ...",allCities:"Tutte le città ",viewListing:"Vedi Inserzione",accept:"Accetta",confirmService:"Conferma Servizio",confirmServiceTitle:"Conferma Completamento",confirmServiceDescription:"Confermi che il servizio è stato completato? Il volontario riceverà automaticamente il compenso in crediti CEI.",confirmAndPay:"Conferma e Paga",applicationSent:"Candidatura inviata",applicationSentDesc:"Il richiedente esaminerà la tua candidatura",applicationError:"Impossibile inviare la candidatura",applicationAccepted:"Candidatura accettata",volunteerNotified:"Il volontario è stato notificato",acceptError:"Impossibile accettare la candidatura",serviceConfirmed:"Servizio confermato",paymentProcessed:"Il pagamento è stato elaborato",confirmError:"Impossibile confermare il servizio",browseOpportunities:"Cerca Opportunità ",createRequest:"Nuova Richiesta",pending:"In Attesa",active:"Attive",completed:"Completate",noPendingRequests:"Nessuna candidatura in attesa",noActiveRequests:"Nessuna richiesta attiva",noCompletedRequests:"Nessuna richiesta completata",requests:{subtitle:"Gestisci le candidature ricevute"},requestDetails:"Dettagli Richiesta Volontariato",compensation:"Compenso in Crediti CEI",compensationDesc:"Quanti crediti CEI riceverà il volontario al completamento del servizio. La piattaforma pagherà questo importo.",recurringService:"Servizio Ricorrente",recurringServiceDesc:"à un'opportunità di volontariato singola o ricorrente?",maxVolunteers:"Massimo Volontari",maxVolunteersDesc:"Quanti volontari possono aiutare con questa richiesta? Lascia vuoto per illimitato.",compensationRequired:"Il compenso in crediti CEI è obbligatorio per le richieste di volontariato (minimo 1 CEI)"},KCe={backToHome:"Torna alla Home",heroTitle:"Benvenuti nella Comunità Economica Indipendente",heroSubtitle:"Un'Economia Solidale per Rafforzare le Nostre Comunità ",philosophyTitle:"Comprendere il Denaro: Una Rivoluzione Culturale",philosophyText1:"Il denaro è semplicemente una rappresentazione della ricchezza, non la ricchezza stessa. Se la ricchezza è creata dalle nostre mani, dal nostro lavoro, dalle nostre competenze, perché la sua rappresentazione dovrebbe essere proprietà di banche centrali private?",philosophyText2:"I Crediti CEI sono la nostra risposta: una Unità di Conto che non si compra e non si vende. I crediti si guadagnano solo attraverso il FARE a favore del bene comune: offrendo prodotti, servizi, competenze alla comunità , o contribuendo con azioni di volontariato certificate.",featuresTitle:"Come Funziona la Piattaforma CEI",freeUsersTitle:"Per tutti gli utenti:",freeFeature1:"Wallet personale con gestione crediti CEI",freeFeature2:"Marketplace comunitario per scambiare beni e servizi",freeFeature3:"Prezzi ibridi: 100% crediti CEI oppure euro + crediti (minimo 20% in crediti)",freeFeature4:"Mappa interattiva per scoprire offerte nella tua zona e oltre",freeFeature5:"Messaggistica per contattare venditori e acquirenti",freeFeature6:"Profilo pubblico per presentare la tua attività ",proUsersTitle:"Per utenti professionali (â¬50/anno):",proFeature1:"Fino a 50 vetrine con 10 foto + 1 video ciascuna",proFeature2:'Badge "Professionale" per maggiore visibilità ',proFeature3:"Supporto prioritario dalla comunità ",benefitsTitle:"I Vantaggi di Partecipare",benefitsIntro:"Riconquistare fiducia reciproca in un ambiente protetto e solidale, dove:",benefit1:"Le relazioni economiche si basano sulla cooperazione, non sulla competizione",benefit2:"Le comunità locali si rafforzano attraverso scambi territoriali",benefit3:"Ogni contributo al bene comune viene riconosciuto e retribuito in crediti",benefit4:"La ricchezza circola all'interno della rete, senza intermediari finanziari",benefit5:"Le comunità isolate si connettono in una rete solidale nazionale",gettingStartedTitle:"Inizia Subito",step1:"Completa il tuo profilo con città e competenze",step2:"Ricevi il bonus di benvenuto in crediti CEI",step3:"Crea la tua prima vetrina o esplora il marketplace",step4:"Scambia con fiducia nella tua comunità territoriale ed oltre",closingStatement:"CEI è più di una piattaforma: è un modo per riappropriarci della nostra ricchezza e costruire insieme un'economia al servizio delle persone, non del profitto.",getStartedButton:"Inizia Ora",bannerText:"Economia solidale ⢠Comunità territoriali ⢠Crediti che si guadagnano, non si comprano",learnMore:"Scopri di più"},ZCe={backToMarketplace:"Torna al Marketplace",heroTitle:"Domande Frequenti",heroSubtitle:"Tutto quello che devi sapere per utilizzare la piattaforma CEI",bannerText:"Hai domande? Consulta le FAQ",gettingStartedTitle:"Primi Passi",q1:"Come mi registro
694sulla piattaforma?",a1:"Clicca su 'Accedi' e segui il processo di autenticazione con Replit. Dopo il primo accesso, completa il tuo profilo inserendo nome, cognome, città e una breve descrizione di te o della tua attività .",q2:"Ricevo crediti quando mi iscrivo?",a2:"Sì! Ogni nuovo utente riceve un bonus di benvenuto in crediti CEI al completamento del profilo. Questo ti permette di iniziare subito a esplorare il marketplace e fare i tuoi primi acquisti.",q3:"Come completo il mio profilo?",a3:"Vai alla tua Dashboard e clicca su 'Modifica Profilo'. Compila tutti i campi richiesti: nome, cognome, città e descrizione. La città è obbligatoria perché serve per posizionarti sulla mappa interattiva del marketplace.",listingsTitle:"Creare e Gestire Annunci",q4:"Come creo un annuncio?",a4:"Dalla Dashboard, clicca su 'Crea Annuncio'. Inserisci titolo, descrizione, categoria, prezzo in euro e crediti CEI (almeno il 20% deve essere in crediti), la tua città , e carica le foto. Gli utenti gratuiti possono caricare fino a 3 foto, i professionali fino a 10 foto + 1 video.",q5:"Posso vendere solo in euro senza crediti CEI?",a5:"No. La piattaforma CEI richiede che TUTTI gli annunci includano crediti CEI nel prezzo. Puoi vendere al 100% in crediti CEI, oppure creare un prezzo ibrido (euro + crediti) con almeno il 20% in crediti CEI.",q6:"Quanti annunci posso creare?",a6:"Gli utenti gratuiti non hanno limiti sul numero di annunci, ma possono caricare solo 3 foto per annuncio. Gli utenti professionali (â¬50/anno) possono creare fino a 50 annunci con 10 foto + 1 video ciascuno.",q7:"Come modifico o elimino un annuncio?",a7:"Vai alla Dashboard, clicca su 'I Miei Annunci', trova l'annuncio che vuoi modificare e clicca sull'icona di modifica. Per eliminare un annuncio, clicca sull'icona del cestino. Attenzione: l'eliminazione è permanente.",creditsTitle:"Crediti CEI",q8:"Cosa sono i crediti CEI?",a8:"I crediti CEI sono un'Unità di Conto che rappresenta il valore del lavoro, delle competenze e dei contributi alla comunità . Non si comprano e non si vendono - si guadagnano solo offrendo beni, servizi o contributi di volontariato certificati.",q9:"Come posso guadagnare crediti CEI?",a9:"Puoi guadagnare crediti CEI in tre modi: 1) Vendendo prodotti o servizi attraverso il marketplace, 2) Ricevendo trasferimenti da altri utenti, 3) Partecipando ad attività di volontariato certificate dalla comunità . Gli amministratori possono anche assegnare crediti per contributi speciali.",q10:"Posso convertire i crediti CEI in euro?",a10:"No. I crediti CEI non sono convertibili in euro. Sono pensati per circolare all'interno della rete CEI come strumento di scambio comunitario. Puoi usarli per acquistare beni e servizi da altri membri della comunità .",professionalTitle:"Account Professionale",q11:"Quali sono i vantaggi dell'account professionale?",a11:"L'account professionale (â¬50/anno) ti permette di: creare fino a 50 vetrine, caricare 10 foto + 1 video per annuncio, ottenere un badge 'Professionale' visibile sui tuoi annunci, una Pagina Negozio personale con copertina personalizzabile, ricevere supporto prioritario dalla comunità e accedere a funzionalità avanzate.",q12:"Come divento utente professionale?",a12:"Contatta l'amministratore della piattaforma per richiedere l'upgrade a Professionale (â¬50/anno). L'upgrade è immediato e dura un anno intero.",storeTitle:"Pagina Negozio",q24:"Cos'è la Pagina Negozio?",a24:"La Pagina Negozio è una vetrina personale disponibile per gli utenti professionali. à una pagina dedicata dove i clienti possono vedere tutti i tuoi annunci in un unico posto, con la tua foto profilo, professione, città e un'immagine di copertina personalizzabile.",q25:"Come accedo alla mia Pagina Negozio?",a25:"La tua Pagina Negozio ha un URL dedicato del tipo: comunitaeconomicaindipendente.it/store/[tuo-id]. I clienti possono accedervi anche cliccando il pulsante 'Visita il mio negozio' presente in tutti i tuoi annunci. Puoi condividere questo link sui social o nei tuoi materiali promozionali.",q26:"Come personalizzo la copertina del mio negozio?",a26:"Vai su 'Modifica Profilo' dalla Dashboard. Nella sezione dedicata agli utenti professionali, trovi 'Copertina Negozio'. Carica un'immagine (consigliato 1200x400
694px, massimo 5MB) che rappresenti la tua attività . Questa apparirà in alto nella tua Pagina Negozio.",q27:"I clienti possono contattarmi dalla Pagina Negozio?",a27:"Dalla Pagina Negozio, i clienti possono vedere tutti i tuoi annunci e cliccare su ognuno per i dettagli. Da lì possono contattarti tramite il sistema di messaggistica della piattaforma. La Pagina Negozio mostra anche il tuo sito web (se inserito nel profilo) come link cliccabile.",safetyTitle:"Comunicazione e Sicurezza",q13:"Come contatto un venditore?",a13:"Clicca sul pulsante 'Contatta' nell'annuncio o sulla mappa interattiva. Si aprirà la chat interna dove puoi inviare messaggi in tempo reale. Tutte le conversazioni sono private e sicure.",q14:"Come funziona il pagamento?",a14:"I pagamenti in EURO avvengono ESTERNAMENTE alla piattaforma - tu e il venditore concordate il metodo (bonifico, contanti, ecc). I pagamenti in crediti CEI avvengono direttamente sulla piattaforma: quando confermi l'acquisto, i crediti vengono trasferiti automaticamente dal tuo wallet a quello del venditore.",referralTitle:"Programma Referral",q15:"Cos'è il programma referral?",a15:"Il programma referral ti permette di invitare amici e conoscenti sulla piattaforma CEI. Quando qualcuno si iscrive usando il tuo link personale, entrambi ricevete crediti bonus: tu ottieni 20 crediti CEI come ringraziamento, e il tuo amico riceve 10 crediti bonus per iniziare.",q16:"Come trovo il mio link referral?",a16:"Vai alla pagina 'Sistema Referral' dalla tua Dashboard. Troverai il tuo codice personale e un link univoco da condividere. Puoi copiare il link e condividerlo tramite WhatsApp, Telegram, email o qualsiasi altro canale preferisci.",q17:"Quante persone posso invitare?",a17:"Non c'è limite! Puoi invitare quante persone desideri. Per ogni amico che si iscrive e completa il profilo usando il tuo link, riceverai 20 crediti CEI. Più persone inviti, più crediti guadagni.",q18:"Come vengono tracciati i miei referral?",a18:"Il sistema utilizza un cookie che dura 30 giorni. Quando qualcuno clicca sul tuo link, il tuo codice viene memorizzato. Se si iscrive entro 30 giorni, verrai riconosciuto come referrer. Puoi vedere tutti i tuoi referral e i crediti guadagnati nella pagina dedicata.",volunteerTitle:"Servizi di Volontariato",q19:"Cosa sono i Servizi di Volontariato?",a19:"I Servizi di Volontariato sono una categoria speciale di annunci dove membri della comunità possono richiedere aiuto per attività di interesse comune. Chi risponde e completa il servizio viene pagato dalla piattaforma stessa in crediti CEI, non dal richiedente.",q20:"Come funziona il pagamento per i volontari?",a20:"Quando un volontario completa un servizio, la piattaforma CEI paga automaticamente i crediti CEI direttamente nel suo wallet. L'importo viene stabilito da chi crea l'annuncio di volontariato (minimo 1 credito CEI). Questo pagamento viene dalla riserva della piattaforma, non dal richiedente del servizio. à un modo per premiare chi contribuisce alla comunità .",q21:"Come posso candidarmi per un servizio di volontariato?",a21:"Cerca annunci nella categoria 'Servizi di Volontariato' nel marketplace. Quando trovi un'opportunità interessante, clicca su 'Candidati' per inviare la tua disponibilità . Il richiedente riceverà una notifica e potrà accettare la tua candidatura.",q22:"Quali sono gli stati di un incarico di volontariato?",a22:"Il flusso è: 1) 'Candidato' - hai inviato la tua disponibilità , 2) 'Accettato' - il richiedente ha confermato, 3) 'Servizio Completato' - hai terminato l'attività , 4) 'Confermato' - il richiedente conferma e ricevi i crediti. Se il servizio non va a buon fine, può essere 'Rifiutato' o 'Annullato'.",q23:"Posso creare richieste di volontariato?",a23:"Sì! Vai su 'Crea Annuncio' e seleziona la categoria 'Servizi di Volontariato'. Descrivi l'attività di cui hai bisogno (es. aiuto trasloco, lezioni, accompagnamento) e indica quanti crediti CEI il volontario riceverà come compenso (minimo 1 credito). I volontari interessati si candideranno e potrai scegliere chi accettare. Ricorda: sarà la piattaforma a pagare il volontario, non tu.",voucherTitle:"Campagne Voucher",q28:"Cosa sono le campagne voucher?",a28:"Le campagne voucher sono un sistema che permette di distribuire crediti CEI bonus durante eventi della comunità . L'amministratore crea un codice voucher con un importo specifico, e i partecipanti agli eventi possono riscattarlo per ricevere crediti extra nel proprio wallet.",q29:"Come riscatto un codice voucher?",a29:"Nella tua Dashboard trovi la sezione 'Riscatta Voucher'. Inserisci il codice che hai ricevuto durante l'evento e clicca su 'Riscatta'. I crediti bonus verranno accreditati immediatamente nel tuo wallet. Ogni voucher può essere riscattato una sola volta per utente.",q30:"Come ottengo un codice voucher?",a30:"I codici voucher vengono distribuiti durante gli eventi della comunità CEI. Partecipa agli incontri, assemblee e attività organizzate dalla comunità per ricevere i codici. I voucher possono avere una scadenza e un numero massimo di utilizzi, quindi riscattali appena possibile.",mapTitle:"Mappa Interattiva",q31:"Come funziona la mappa interattiva?",a31:"La mappa mostra tutti i membri della comunità CEI con un indicatore sulla loro posizione. Puoi cliccare su ogni indicatore per vedere il profilo dell'utente, i suoi annunci e contattarlo direttamente. Gli utenti professionali hanno un indicatore diverso per distinguerli.",q32:"Come faccio ad apparire sulla mappa?",a32:"Per apparire sulla mappa devi completare il tuo profilo inserendo la tua città e il tuo indirizzo. Il sistema calcola automaticamente le coordinate dalla tua posizione. Se noti che la tua posizione non è precisa, prova a salvare nuovamente il profilo con un indirizzo più dettagliato.",stillNeedHelp:"Non hai trovato quello che cercavi?",contactSupport:"Contatta il Supporto"},XCe={bannerText:"Nuovo? Scopri come registrarti",bannerCta:"Guida passo-passo",backToMarketplace:"Torna al Marketplace",heroTitle:"Guida alla Registrazione",heroSubtitle:"Segui questi 8 semplici passaggi per creare il tuo account CEI",timeEstimate:"Tempo stimato: 3-5 minuti",beforeYouStart:"Prima di iniziare, assicurati di avere:",requirement1:"Un indirizzo email valido a cui puoi accedere",requirement2:"Qualche minuto di tempo per completare la registrazione",requirement3:"I tuoi dati personali (nome, cognome, città )",tipLabel:"Suggerimento:",step1Title:'Clicca su "Accedi"',step1Desc:`Dalla pagina principale del marketplace CEI, trova il pulsante "Accedi" nell'angolo in alto a destra. 695 696Clicca sul pulsante per iniziare il processo di registrazione.`,step1Tips:"Se sei su smartphone, il pulsante potrebbe essere nel menu hamburger (le tre linee orizzontali).",step2Title:'Scegli "Continue with email"',step2Desc:`Si aprirà una finestra di Replit (il sistema che gestisce gli account). 697 698Clicca su "Continue with email" (Continua con email), poi inserisci il tuo indirizzo email e una password a tua scelta.`,
698step2Tips:"Usa un'email che controlli regolarmente. Scegli una password sicura che ricorderai.",step3Title:"Verifica il Codice Email",step3Desc:`Replit invierà un codice di verifica a 6 cifre alla tua email. 699 700Apri la tua casella di posta, trova l'email da Replit (controlla anche spam/posta indesiderata), copia il codice e incollalo nella finestra di Replit.`,step3Tips:'Il codice scade dopo pochi minuti. Se non arriva, clicca "Resend code" per riceverlo nuovamente.',step4Title:"Crea il tuo Account Replit",step4Desc:`Se è la prima volta che usi Replit, ti verrà chiesto di: 701 702⢠Creare un username (nome utente) 703⢠Compilare alcuni campi opzionali (professione, cosa vuoi fare, ecc.) 704 705Questi form sono di Replit, non di CEI. Puoi compilarli rapidamente o saltarli se possibile.`,step4Tips:"Scegli un username semplice. I campi aggiuntivi (professione, progetti) sono per Replit e non influenzano il tuo account CEI.",step5Title:"Autorizza l'Accesso a CEI",step5Desc:`Replit ti chiederà di autorizzare l'accesso alla piattaforma CEI. 706 707Clicca su "Authorize" (Autorizza) per permettere a CEI di leggere le tue informazioni base (email e username).`,step5Tips:"Questa autorizzazione è sicura. CEI non avrà mai accesso alla tua password Replit.",step6Title:"Completa il Profilo CEI",step6Desc:`Ora sei sulla piattaforma CEI! Ti apparirà il modulo per completare il tuo profilo. 708 709Inserisci: 710⢠Nome e Cognome 711⢠Numero di telefono 712⢠La tua professione o attività `,step6Tips:"Compila tutti i campi con attenzione. Queste informazioni aiuteranno gli altri utenti a conoscerti.",step7Title:"Aggiungi la tua Posizione",step7Desc:`Inserisci il tuo indirizzo completo e la città . Questi dati sono fondamentali per: 713 714⢠Apparire sulla mappa del marketplace 715⢠Essere trovato da chi cerca servizi nella tua zona 716⢠Trovare offerte vicino a te 717 718La nostra comunità si basa su fiducia e trasparenza.`,step7Tips:"Un indirizzo preciso aiuta gli altri membri della comunità a trovarti facilmente.",step8Title:"Salva e Inizia!",step8Desc:`Clicca su "Salva Profilo" per completare la registrazione. 719 720Congratulazioni! Hai creato il tuo account CEI e hai ricevuto i tuoi primi crediti di benvenuto!`,step8Tips:"Ora puoi esplorare il marketplace, creare annunci e iniziare a usare i tuoi crediti CEI.",completedTitle:"Registrazione Completata!",completedDesc:"Una volta completati tutti i passaggi, avrai accesso completo alla piattaforma CEI:",benefit1:"Crediti di benvenuto nel tuo wallet",benefit2:"Possibilità di creare annunci nel marketplace",benefit3:"Chat per contattare venditori e acquirenti",benefit4:"Accesso al programma referral per invitare amici",readyToStart:"Pronto per iniziare?",startButton:"Vai al Marketplace e Registrati",needHelp:"Hai ancora dubbi?",checkFaq:"Consulta le FAQ"},YCe={redeemTitle:"Riscatta Voucher",redeemDescription:"Inserisci un codice voucher per ricevere crediti CEI bonus",enterCode:"Inserisci codice voucher...",redeem:"Riscatta",congratulations:"Congratulazioni!",redeemSuccess:"Hai ricevuto {{amount}} crediti CEI bonus!",title:"Campagne Voucher",subtitle:"Crea e gestisci campagne voucher per eventi della comunità ",create:"Crea Voucher",edit:"Modifica Voucher",createDesc:"Configura un nuovo codice voucher per la distribuzione alla comunità ",editDesc:"Aggiorna le impostazioni del voucher",noVouchers:"Nessuna campagna voucher",createFirst:"Crea la tua prima campagna voucher",active:"Attivo",inactive:"Inattivo",scheduled:"Programmato",expired:"Scaduto",newUsersOnly:"Solo Nuovi Utenti",existingUsersOnly:"Solo Utenti Esistenti",allUsers:"Tutti gli Utenti",code:"Codice",name:"Nome Voucher",namePlaceholder:"es., Evento Estate 2025",description:"Descrizione",descriptionPlaceholder:"Descrivi questa campagna voucher...",bonusType:"Tipo Bonus",fixed:"Importo Fisso",multiplier:"Moltiplicatore",bonusValue:"Valore Bonus",targetAudience:"Destinatari",startsAt:"Data Inizio",endsAt:"Data Fine",maxRedemptions:"Utilizzi Massimi",unlimited:"Illimitato",isActive:"Attivo",redemptions:"Utilizzi",totalDistributed:"Totale Distribuito",sendBroadcast:"Invia Broadcast",broadcastDesc:"Invia il codice voucher {{code}} a tutti gli utenti",broadcastTemplate:"Bonus speciale! Usa il codice {{code}} per ricevere {{bonus}} crediti!",message:"Messaggio",send:"Invia",errors:{notFound:"Codice voucher non trovato",inactive:"Questo voucher non è più attivo",notStarted:"Questo voucher non è ancora valido",expired:"Questo voucher è scaduto",newUsersOnly:"Questo voucher è valido solo per nuovi utenti",existingUsersOnly:"Questo voucher è valido solo per utenti esistenti",maxRedemptionsReached:"Questo voucher ha raggiunto il numero massimo di utilizzi",alreadyRedeemed:"Hai già riscattato questo voucher",generic:"Impossibile riscattare il voucher. Riprova"},admin:{title:"Campagne Voucher",description:"Crea e gestisci campagne voucher per eventi della comunità ",createNew:"Crea Voucher",noVouchers:"Nessuna campagna voucher",noVouchersDesc:"Crea la tua prima campagna per distribuire crediti bonus agli eventi",code:"Codice",name:"Nome Campagna",namePlaceholder:"es., Evento Estate 2025",bonusType:"Tipo Bonus",bonusTypeFixed:"Importo Fisso",bonusTypeMultiplier:"Moltiplicatore",bonusAmount:"Importo Bonus",bonusMultiplier:"Moltiplicatore (es., 1.5 = 50% extra)",targetAudience:"Destinatari",targetAll:"Tutti gli Utenti",targetNewUsers:"Solo Nuovi Utenti",targetExistingUsers:"Solo Utenti Esistenti",maxRedemptions:"Utilizzi Massimi (0 = illimitati)",startDate:"Data Inizio",endDate:"Data Fine",active:"Attivo",inactive:"Inattivo",redemptions:"Utilizzi",created:"Creato",actions:"Azioni",edit:"Modifica",toggleStatus:"Cambia Stato",delete:"Elimina",deleteConfirm:"Eliminare questa campagna voucher?",deleteDesc:"Questa azione non può essere annullata. Tutti i dati degli utilizzi verranno persi.",createSuccess:"Campagna voucher creata con successo",updateSuccess:"Campagna voucher aggiornata con successo",deleteSuccess:"Campagna voucher eliminata",statusUpdated:"Stato voucher aggiornato",error:"Si è verificato un errore",broadcast:"Broadcast",broadcastTitle:"Invia Codice Voucher",broadcastDesc:"Invia il codice voucher a tutti gli utenti tramite messaggio di sistema",broadcastMessage:"Contenuto Messaggio",broadcastMessagePlaceholder:"Scrivi un messaggio da accompagnare al codice voucher...",broadcastSend:"Invia a Tutti gli Utenti",broadcastSuccess:"Codice voucher inviato con successo",statistics:"Statistiche",totalRedemptions:"Utilizzi Totali",creditsDistributed:"Crediti Distribuiti"}},QCe={academy:{title:"Galleria Video",subtitle:"Scopri tutorial, notizie e contenuti educativi della nostra comunità ",allVideos:"Tutti",news:"News",divulgazione:"Divulgazione",tutorial:"Tutorial",medicoAmico:"Medico Amico","interviste-giraldi":"Interviste Prof. Giraldi","considerazioni-scientifiche":"Considerazioni Scientifiche",intervisteGiraldi:"Interviste Prof. Giraldi",considerazioniScientifiche:"Considerazioni Scientifiche",noVideos:"Nessun video disponibile",noVideosDesc:"I video saranno disponibili presto",wat
720chVideo:"Guarda Video",duration:"Durata"},admin:{title:"Gestione Video",description:"Carica e gestisci i video della Galleria Video",createVideo:"Carica Nuovo Video",createVideoDesc:"Aggiungi un nuovo video alla Galleria Video",editVideo:"Modifica Video",editVideoDesc:"Aggiorna le informazioni del video",deleteVideo:"Elimina Video",deleteVideoConfirm:'Sei sicuro di voler eliminare il video "{{title}}"? Questa azione non può essere annullata.',noVideos:"Nessun video caricato",videoFile:"File Video",thumbnail:"Immagine di Anteprima",titleField:"Titolo",titlePlaceholder:"Titolo del video...",descriptionField:"Descrizione",descriptionPlaceholder:"Descrizione del video...",category:"Categoria",duration:"Durata (secondi)",durationPlaceholder:"es., 120",durationHint:"Durata in secondi",featuredOrder:"Ordine in Evidenza",orderHint:"Numeri più bassi appaiono prima",published:"Pubblicato",featured:"In Evidenza",draft:"Bozza",noDescription:"Nessuna descrizione",selectFile:"Seleziona File",selectImage:"Seleziona Immagine",fileTooLarge:"Il file è troppo grande. Massimo {{max}}MB",uploadFailed:"Caricamento fallito. Riprova",createSuccess:"Video caricato con successo",updateSuccess:"Video aggiornato con successo",deleteSuccess:"Video eliminato con successo",publish:"Pubblica",unpublish:"Rimuovi pubblicazione",feature:"Metti in Evidenza",unfeature:"Rimuovi da Evidenza"}},JCe={dialogTitle:"Accettazione Privacy Policy",dialogDesc:"Prima di utilizzare la piattaforma, ti chiediamo di leggere e accettare la nostra informativa sulla privacy.",dataControllerTitle:"Titolare del Trattamento",dataControllerText:"L'Associazione Comunità Economica Indipendente è titolare del trattamento dei tuoi dati personali.",dataCollectedTitle:"Dati Raccolti",dataCollectedText:"Raccogliamo dati personali come nome, email, telefono, indirizzo e dati relativi alle transazioni per fornirti i nostri servizi.",purposeTitle:"Finalità ",purposeText:"I tuoi dati vengono utilizzati per gestire il tuo account, permetterti di pubblicare annunci, effettuare transazioni e comunicare con altri utenti.",rightsTitle:"I Tuoi Diritti",rightsText:"Hai diritto di accedere, rettificare, cancellare i tuoi dati e di opporti al trattamento. Puoi contattarci a [email protected]",readFullPolicy:"Leggi l'informativa completa",acceptCheckbox:"Ho letto e accetto l'informativa sulla privacy e autorizzo il trattamento dei miei dati personali ai sensi del GDPR.",acceptButton:"Accetto e Continuo",acceptedTitle:"Privacy Accettata",acceptedDesc:"Grazie per aver accettato la nostra informativa sulla privacy.",acceptError:"Errore durante l'accettazione. Riprova."},eEe={title:"Documenti",subtitle:"Privacy, Codice Etico e Regolamenti della Comunità ",backToHome:"Torna alla Home",noDocuments:"Nessun documento disponibile al momento.",typePrivacy:"Privacy Policy",typeEthics:"Codice Etico",typeRegulations:"Regolamenti",typeOther:"Altri Documenti",view:"Visualizza",download:"Scarica"},tEe={sectionTitle:"Tessera Associato CEI",title:"TESSERA ASSOCIATO",download:"Scarica Tessera",number:"Tessera n.",birthDate:"Data di nascita",city:"Città ",memberSince:"Socio dal"},iEe={common:ACe,categories:ICe,header:kCe,landing:PCe,marketplace:NCe,orders:MCe,myListings:DCe,createListing:RCe,listingDetail:jCe,dashboard:zCe,admin:LCe,transaction:OCe,wallet:FCe,messages:BCe,user:UCe,profile:VCe,validation:$Ce,map:qCe,referral:HCe,upload:GCe,volunteer:WCe,about:KCe,faq:ZCe,registrationGuide:XCe,voucher:YCe,video:QCe,privacy:JCe,documents:eEe,memberCard:tEe},nEe={loading:"Chargement...",signIn:"Se Connecter",signUp:"S'inscrire",enter:"Entrer",signOut:"Se Déconnecter",getStarted:"Commencer",cancel:"Annuler",save:"Sauvegarder",edit:"Modifier",send:"Envoyer",clear:"Effacer",clearAll:"Tout effacer",filters:"Filtres",search:"Rechercher",credits:"Crédits",chooseLanguage:"Choisissez votre langue",dashboard:"Tableau de Bord",backToDashboard:"Retour au Tableau de Bord"},rEe={"Professional Services":"Services Professionnels","Home & Garden":"Maison et Jardin","Health & Wellness":"Santé et Bien-être",Education:"Ãducation",Technology:"Technologie","Creative Services":"Services Créatifs","Food & Catering":"Alimentation et Traiteur",Transportation:"Transport","Volunteer Services":"Demandes de Services de Bénévolat",Entertainment:"Divertissement","B&B, Hospital
720ity & Catering":"B&B, Hôtellerie et Restauration","Present Your Project":"Présentez votre projet","Free Services":"Services Gratuits"},sEe={walletManager:"Gestionnaire de Portefeuille",adminDashboard:"Tableau de Bord Admin",myWallet:"Mon Portefeuille"},oEe={title:"Gérez Vos Crédits",subtitle:"De Manière Sécurisée et Efficace",description:"Une plateforme professionnelle de gestion de portefeuille pour suivre et transférer des points et crédits personnalisés. Simple, sécurisée et conçue pour les équipes.",purchaseTitle:"Achetez avec des crédits auprès des producteurs inscrits à la CEI",feature1Title:"Un Portefeuille Par Utilisateur",feature1Desc:"Chaque utilisateur obtient un portefeuille sécurisé créé automatiquement lors de l'inscription. Consultez votre solde et l'historique des transactions en un coup d'Åil.",feature2Title:"Transferts Faciles",feature2Desc:"Transférez des crédits à d'autres utilisateurs instantanément. Toutes les transactions sont suivies avec un historique complet et des descriptions.",feature3Title:"Contrôles Administrateur",feature3Desc:"Les administrateurs peuvent ajouter des crédits à n'importe quel portefeuille, voir tous les utilisateurs et gérer l'ensemble de la plateforme avec des outils puissants.",footer:"Plateforme de gestion de crédits sécurisée."},aEe={communityName:"Communauté Ãconomique Indépendante",heroTitle:"Découvrez les Services Locaux et Soutenez Votre Communauté",heroSubtitle:"Parcourez produits et services avec tarification hybride: euros + crédits communautaires CEI",searchPlaceholder:"Rechercher services, produits...",cityPlaceholder:"Ville",selectCategory:"Toutes les Catégories",searchButton:"Rechercher",viewMap:"Voir la Carte",supportProject:"Soutenir le Projet",noListingsTitle:"Aucune annonce trouvée",noListingsDesc:"Essayez d'ajuster vos filtres",foundUsers:"Profils trouvés",userFound:"profil trouvé",usersFound:"profils trouvés",featuredListings:"Annonces en vedette 100% crédits CEI",loading:"Chargement des annonces...",browseMarketplace:"Parcourir le Marketplace",viewDetails:"Voir les Détails",upgradeSuccessful:"Mise à Niveau Réussie!",upgradeSuccessfulDesc:"Vous êtes maintenant un vendeur professionnel. Bienvenue!",donationTitle:"Soutenir COMUNITA' ECONOMICA INDIPENDENTE",donationDesc:"Aidez-nous à maintenir la plateforme en marche et à soutenir nos initiatives communautaires",donationChooseAmount:"Choisissez un montant",donationCustomAmount:"Ou entrez un montant personnalisé (â¬)",donationEnterAmount:"Entrer le montant",donationProcessing:"Traitement...",donateButton:"Faire un don de â¬{{amount}}",securePayment:"Traitement de paiement sécurisé par Stripe",upgradeTitle:"Passer à Professionnel",upgradeDesc:"Débloquez des fonctionnalités premium et développez votre entreprise sur CEI Marketplace",upgradePerYear:"par an",upgradeIncluded:"Ce qui est inclus :",upgradeFeature1:"Jusqu'à 50 vitrines sur le marketplace",upgradeFeature2:"10 photos + 1 vidéo par annonce",upgradeFeature3:"Support client prioritaire",upgradeFeature4:"Badge professionnel sur vos annonces",upgradeFeature5:"Tableau de bord d'analyse avancé",upgradeFeature6:"Placement en vedette dans les résultats de recherche",upgradeButton:"Passer à Premium",upgradeProcessing:"Traitement...",authRequired:"Connexion Requise",authRequiredDesc:"CONNECTEZ-VOUS GRATUITEMENT POUR ACTIVER LES SERVICES",searchByCity:"Par Ville",searchByRadius:"Par Rayon",allSellers:"Tous",professionalOnly:"Professionnels Uniquement",privateOnly:"Particuliers Uniquement",useMyLocation:"Utiliser ma position",locationSet:"Position définie",locating:"Localisation...",locationFound:"Position trouvée"},lEe={title:"Mes Commandes",purchases:"Achats",sales:"Ventes",noPurchases:"Aucun achat pour le moment",noPurchasesDesc:"Vos commandes en tant qu'acheteur apparaîtront ici",noSales:"Aucune vente pour le moment",noSalesDesc:"Vos commandes en tant que vendeur apparaîtront ici",pending:"En attente",reserved:"Réservé",completed:"Terminé",cancelled:"Annulé",expired:"Expiré",seller:"Vendeur",buyer:"Acheteur",listing:"Annonce",unknown:"Inconnu",price:"Prix",status:"Statut",orderDate:"Date de commande",expiresOn:"Expire le",buyerNotes:"Notes de l'acheteur",confirmOrder:"Confirmer la Commande",confirmReceipt:"Confirmer la Réception",cancelOrder:"Annuler la Commande",contactCounterpart:"Contacter",waitingBuyerConfirmation:"En attente de confirmation de réception par l'acheteur. Les crédits seront transférés après la confirmation.",confirmTitle:"Confirmer la réception ?",confirmDesc:"Confirmez-vous avoir reçu le service ou produit ? Les crédits seront transférés au vendeur.",cancelTitle:"Annuler cette c
720ommande ?",cancelDesc:"Les crédits réservés seront retournés à l'acheteur.",updating:"Mise à jour...",orderUpdated:"Commande Mise à Jour",orderConfirmed:"Commande confirmée avec succès.",orderCancelled:"Commande annulée avec succès.",updateFailed:"Ãchec de la Mise à Jour",updateError:"Impossible de mettre à jour le statut de la commande",manageYourOrders:"Gérez vos commandes et vos ventes"},cEe={title:"Mes Annonces",createNew:"Créer une Nouvelle Annonce",noListings:"Aucune annonce pour le moment",noListingsDesc:"Vos annonces apparaîtront ici une fois que vous les aurez créées",active:"Actif",inactive:"Inactif",toggleActive:"Activer/Désactiver",edit:"Modifier",delete:"Supprimer",deleteTitle:"Supprimer cette annonce ?",deleteDesc:"Cette action est irréversible. L'annonce sera supprimée définitivement.",deleting:"Suppression...",listingDeleted:"Annonce Supprimée",listingDeletedDesc:"Votre annonce a été supprimée avec succès.",deleteFailed:"Ãchec de la Suppression",deleteError:"Impossible de supprimer l'annonce",statusUpdated:"Statut Mis à Jour",statusUpdatedDesc:"Le statut de l'annonce a été modifié.",statusFailed:"Ãchec de la Mise à Jour",statusError:"Impossible de mettre à jour le statut de l'annonce"},uEe={createTitle:"Créer une Nouvelle Annonce",editTitle:"Modifier l'Annonce",basicInfo:"Informations de Base",basicInfoDesc:"Entrez les détails principaux de votre annonce",title:"Titre",titlePlaceholder:"ex., Consultation Professionnelle en Web Design",description:"Description",descriptionPlaceholder:"Décrivez votre produit ou service en détail...",category:"Catégorie",selectCategory:"Sélectionnez une catégorie",pricing:"Tarification",pricingDesc:"Définissez vos prix (au moins un requis)",pricingOptionalDesc:"Pour cette catégorie, le prix est optionnel. Vous pouvez laisser les champs vides.",clearPrices:"Effacer les prix",priceEuros:"Part ⬠(min. 0% max 80%)",priceCredits:"Part Crédits CEI (min. 20% max. 100%)",hybridPricingNote:"Si vous utilisez les deux, les crédits doivent représenter au moins 20% de la valeur totale",location:"Localisation",locationDesc:"Ajoutez votre localisation pour apparaître sur la carte",address:"Adresse",city:"Ville",country:"Pays",latitude:"Latitude",longitude:"Longitude",imageUrl:"URL de l'Image",imageUrlPlaceholder:"https://exemple.com/image.jpg",requiresContact:"Contact préalable requis",requiresContactDesc:"Activez si l'acheteur doit vous contacter avant de commander (ex. pour convenir de la taille, quantité, dates)",activeStatus:"Statut Actif",activeStatusDesc:"Rendre cette annonce visible aux acheteurs",saving:"Enregistrement...",createButton:"Créer l'Annonce",updateButton:"Mettre à Jour l'Annonce",cancel:"Annuler",success:"Succès !",listingCreated:"Votre annonce a été créée avec succès.",listingUpdated:"Votre annonce a été mise à jour avec succès.",error:"Erreur",createError:"Ãchec de création de l'annonce. Veuillez réessayer.",updateError:"Ãchec de mise à jour de l'annonce. Veuillez réessayer.",validationError:"Veuillez vérifier le formulaire pour les erreurs de validation"},dEe={professional:"Professionnel",postedOn:"Publié le",location:"Localisation",price:"Prix",yourBalance:"Votre Solde",aboutSeller:"à Propos du Vendeur",viewProfile:"Voir le Profil",viewStore:"Voir la Vitrine",description:"Description",placeOrder:"Passer Commande",contactSeller:"Contacter le Vendeur",interestedMessage:"Bonjour ! Je suis intéressé(e) par votre annonce : {{title}}",backToListings:"Retour aux Annonces",orderPlaced:"Commande Passée !",orderPlacedDesc:"Votre commande a été créée. Les crédits ont été réservés.",insufficientCredits:"Crédits Insuffisants",insufficientCreditsDesc:"Vous n'avez pas assez de crédits CEI pour cette commande.",orderFailed:"Ãchec de la Commande",orderError:"Impossible de créer la commande. Veuillez réessayer.",notesLabel:"Notes pour le Vendeur",notesPlaceholder:"Notes supplémentaires pour le vendeur (optionnel)...",noteLabel:"Note",euroNote:"Le montant en euros doit être payé directement au vendeur selon les accords.",creditsNote:"Les crédits CEI seront réservés à la commande et transférés à la fin.",requiresContactInfo:"Pour cette annonce, vous devez d'abord contacter le vendeur pour convenir des détails de la commande.",ownListing:"C'est votre propre annonce",editListing:"Modifier l'Annonce",submit:"Soumettre la Commande",submitting:"Soumission..."}
720,hEe={title:"Mon Portefeuille",subtitle:"Gérez vos crédits et consultez l'historique des transactions",balance:"Solde",customizeName:"Personnaliser le nom du portefeuille",walletName:"Nom du Portefeuille",walletNamePlaceholder:"par ex., Mon Portefeuille Principal",walletNameDescription:"Donnez un nom personnalisé à votre portefeuille pour personnaliser votre expérience.",walletBalance:"Solde du Portefeuille",transferCredits:"Transférer des Crédits",recipient:"Destinataire",selectUser:"Sélectionnez un utilisateur",noOtherUsers:"Aucun autre utilisateur disponible",recipientEmail:"Email du Destinataire",amount:"Montant",amountPlaceholder:"0,00",description:"Description",descriptionOptional:"Description (optionnel)",descriptionPlaceholder:"à quoi sert ce transfert?",transactionHistory:"Historique des Transactions",transferSubmit:"Transférer des Crédits",transferring:"Transfert...",saving:"Enregistrement...",noTransactionsTitle:"Aucune transaction pour le moment",noTransactionsDesc:"Votre historique de transactions apparaîtra ici une fois que vous commencerez à transférer des crédits.",myListings:"Mes Annonces",myOrders:"Mes Commandes",messages:"Messages",createListing:"Créer une Annonce",goToMarketplace:"Aller au Marketplace"},pEe={title:"Gestion des Utilisateurs",subtitle:"Voir tous les utilisateurs et gérer les crédits du portefeuille",allUsers:"Tous les Utilisateurs",noUsers:"Aucun utilisateur trouvé",addCredits:"Ajouter des Crédits au Portefeuille",user:"Utilisateur",selectUser:"Sélectionnez un utilisateur",noUsersAvailable:"Aucun utilisateur disponible",userEmail:"Email de l'
720Utilisateur",amount:"Montant",amountPlaceholder:"0,00",reason:"Raison",reasonOptional:"Raison (optionnel)",reasonPlaceholder:"Pourquoi ajoutez-vous ces crédits?",addCreditsSubmit:"Ajouter des Crédits",addingCredits:"Ajout...",allTransactions:"Toutes les Transactions",editWalletName:"Modifier le Nom du Portefeuille",admin:"Administrateur",unknownUser:"Utilisateur Inconnu",signupBonus:"Bonus d'Inscription",signupBonusTitle:"Configurer le Bonus d'Inscription",signupBonusDesc:"Définir le montant de crédits que les nouveaux utilisateurs reçoivent lors de la création d'un compte",signupBonusAmount:"Montant du Bonus",signupBonusPlaceholder:"100,00",signupBonusSave:"Enregistrer le Bonus d'Inscription",signupBonusSaving:"Enregistrement...",signupBonusSuccess:"Bonus d'inscription mis à jour",signupBonusSuccessDesc:"Les nouveaux utilisateurs recevront désormais {{amount}} crédits lors de l'inscription",signupBonusError:"Ãchec de la mise à jour du bonus d'inscription",currentBonus:"Actuel: {{amount}} crédits",professionalPriceTitle:"Prix de l'Upgrade Professionnel",professionalPriceDesc:"Définir le coût annuel pour passer à un compte professionnel",professionalPriceAmount:"Prix (EUR)",professionalPricePlaceholder:"50,00",professionalPriceSave:"Enregistrer le Prix",professionalPriceSaving:"Enregistrement...",professionalPriceSuccess:"Prix de l'upgrade mis à jour",professionalPriceSuccessDesc:"Le nouveau prix de l'upgrade professionnel est de â¬{{amount}}/an",professionalPriceError:"Ãchec de la mise à jour du prix",currentPrice:"Actuel: â¬{{amount}}/an",totalCreditsIssued:"Crédits Ãmis Totaux",creditsIssuedDesc:"Total historique à ce jour",exchangeVolume:"Volume d'Ãchanges",exchangeVolumeDesc:"Transactions entre utilisateurs",professionalStatusTitle:"Gestion du Statut Professionnel",professionalStatusDesc:"Activer ou désactiver manuellement le statut professionnel pour les utilisateurs",activateProfessional:"Activer",deactivateProfessional:"Désactiver",manualProfessionalActivation:"Activation manuelle du statut professionnel",manualProfessionalDeactivation:"Désactivation manuelle du statut professionnel",deleteUser:"Supprimer l'Utilisateur",deleteUserWarning:"Ãtes-vous sûr de vouloir supprimer l'utilisateur",deleteUserPermanent:"Cette action est irréversible. Toutes les données de l'utilisateur (portefeuille, annonces, commandes, messages) seront définitivement supprimées.",userDeleted:"Utilisateur supprimé avec succès",deleteUserFailed:"Ãchec de la suppression de l'utilisateur",confirmDelete:"Supprimer Définitivement",processing:"Traitement...",bulkCreditTitle:"Créditer Tous les Utilisateurs en Masse",bulkCreditDesc:"Ajoutez des crédits à tous les utilisateurs en une seule fois. Cela créditera chaque utilisateur du système avec le montant spécifié.",bulkCreditSuccess:"Crédit en Masse Réussi",bulkCreditSuccessDesc:"{{successCount}} utilisateurs crédités sur {{totalUsers}} ({{failCount}} échecs)",bulkCreditError:"Erreur de Crédit en Masse",bulkCreditErrorDesc:"Ãchec du crédit des utilisateurs",bulkCreditPlaceholder:"Raison du crédit en masse (obligatoire)",bulkCreditButton:"Créditer Tous les Utilisateurs",broadcastTitle:"Message Broadcast",broadcastDesc:"Envoyez un message à tous les utilisateurs en une seule fois. Chaque utilisateur recevra ce message dans sa boîte de réception.",broadcastSuccess:"Message Broadcast Envoyé",broadcastSuccessDesc:"Envoyé à {{successCount}} utilisateurs sur {{totalRecipients}} ({{failCount}} échecs)",broadcastError:"Erreur de Broadcast",broadcastErrorDesc:"Ãchec de l'envoi du message broadcast",broadcastLabel:"Contenu du Message",broadcastPlaceholder:"Tapez votre message broadcast ici...",broadcastButton:"Envoyer à Tous les Utilisateurs",sending:"Envoi en cours...",exportMembers:"Exporter le Registre des Membres (CSV)",exportMembersDesc:"Téléchargez le registre complet des membres au format CSV"},fEe={type:"Type",typeAll:"Tous les Types",typeTransfer:"Transfert",typeAdminCredit:"Crédit Administrateur",date:"Date",startDate:"Date de Début",endDate:"Date de Fin",amount:"Montant",minAmount:"Montant Minimum",maxAmount:"Montant Maximum",description:"Description",from:"De",to:"Ã",createdBy:"Créé Par",n
720oTransactions:"Aucune transaction pour le moment",noTransactionsDesc:"Votre historique de transactions apparaîtra ici une fois que vous commencerez à transférer des crédits.",history:"Historique des Transactions",you:"Vous",system:"Système",searchPlaceholder:"Rechercher des transactions..."},mEe={unauthorized:"Non Autorisé",unauthorizedDesc:"Vous êtes déconnecté. Connexion en cours...",unauthorizedLogin:"Veuillez vous reconnecter pour continuer.",accessDenied:"Accès Refusé",accessDeniedDesc:"Vous n'avez pas de privilèges d'administrateur.",transferSuccess:"Transfert réussi",transferSuccessDesc:"Les crédits ont été transférés avec succès.",transferError:"Ãchec du transfert",transferErrorDesc:"Ãchec du transfert de crédits. Veuillez réessayer.",creditSuccess:"Crédits ajoutés",creditSuccessDesc:"Les crédits ont été ajoutés au portefeuille de l'utilisateur avec succès.",creditError:"Ãchec de l'ajout de crédits",creditErrorDesc:"Ãchec de l'ajout de crédits. Veuillez réessayer.",walletUpdateSuccess:"Portefeuille mis à jour",walletUpdateSuccessDesc:"Le nom de votre portefeuille a été mis à jour avec succès.",walletUpdateError:"Erreur",walletUpdateErrorDesc:"Ãchec de la mise à jour du nom du portefeuille",donationFailed:"Ãchec du Don",donationFailedDesc:"Impossible de traiter le don",invalidAmount:"Montant Invalide",invalidAmountDesc:"Veuillez entrer un montant de don valide",upgradeFailed:"Ãchec de la Mise à Niveau",upgradeFailedDesc:"Impossible de démarrer le processus de mise à niveau",error:"Erreur",success:"Succès",fetchError:"Impossible de charger",sendError:"Impossible d'envoyer le message",loadingMessages:"Chargement des messages...",loadingOrders:"Chargement des commandes...",typeMessage:"Tapez votre message...",userFallback:"Utilisateur",broadcastNoReply:"Ceci est un message de diffusion - les réponses ne sont pas autorisées",broadcastHistory:"Historique Diffusions",messageSent:"message envoyé",messagesSent:"messages envoyés",sentTo:"envoyé à ",recipients:"destinataires",upgradeCancelled:"Mise à Niveau Annulée",upgradeCancelledDesc:"Votre mise à niveau professionnelle a été annulée.",thankYou:"Merci!",donationSuccess:"Votre don aide à soutenir notre plateforme communautaire.",donationCancelled:"Don Annulé",donationCancelledDesc:"Votre don a été annulé.",categoryPlaceholder:"Catégorie",promotedToAdmin:"Promu administrateur",demotedFromAdmin:"Rétrogradé d'administrateur",failedToUpdateRole:"Ãchec de la mise à jour du rôle"},gEe={defaultName:"Utilisateur",fetchError:"Ãchec de la récupération des transactions"},yEe={title:"Complétez Votre Profil",subtitle:"Remplissez les informations requises pour commencer à utiliser votre portefeuille",editTitle:"Modifier le Profil",editSubtitle:"Mettez à jour vos informations personnelles",welcomeTitle:"Bienvenue!",welcomeMessage:"Complétez votre profil pour utiliser le service",completeNow:"Compléter Maintenant",firstName:"Prénom",firstNamePlaceholder:"Jean",lastName:"Nom",lastNamePlaceholder:"Dupont",phone:"Téléphone",phonePlaceholder:"+33 1 23 45 67 89",address:"Adresse",addressPlaceholder:"123 Rue de la Paix",city:"Ville",cityPlaceholder:"Paris",dateOfBirth:"Date de Naissance",profession:"Profession",professionPlaceholder:"ex. Ingénieur, Médecin, Enseignant",bio:"à propos de moi",bioPlaceholder:"Parlez-nous de vous, de vos compétences, intérêts et de ce que vous offrez à la communauté...",website:"Site Web (optionnel)",websitePlaceholder:"https://votresite.fr",saveProfile:"Enregistrer le Profil",updateProfile:"Mettre à Jour le Profil",updating:"Mise à jour...",successTitle:"Profil mis à jour",successDesc:"Vos informations ont été enregistrées avec succès.",errorTitle:"Erreur",errorDesc:"Ãchec de la mise à jour du profil. Veuillez réessayer.",userProfile:"Profil Utilisateur",noAdditionalInfo:"Aucune information supplémentaire disponible",userNotFound:"Utilisateur non trouvé",email:"E-mail",adminStatus:"Statut Administrateur",isAdmin:"Administrateur",notAdmin:"Utilisateur Standard"},_Ee={titleMin:"Le titre doit contenir au moins 5 caractères",descMin:"La description doit contenir au moins 20 caractères",validUrl:"Doit être une URL valide",priceRequired:"Au moins un prix (euros ou crédits) doit être défini",hybridPricing:"Avec une tarification hybride, les crédits doivent représenter au moins 20% de la valeur totale",creditsRequired:"Les crédits CEI sont obligatoires pour toutes les annonces (100% crédits ou tarification hybride)",creditsMinimum:"Avec une tarification hybride, les crédits doivent représenter au moins 20% de la valeur totale"},vEe={marker:"marqueur",markers:"marqueurs",listing:"annonce",listings:"annonces",user:"utilisateur",users:"utilisateurs",onMap:"sur la carte",totalMembers:"membres au total",legend:"Légende",professionalListing:"Annonce Professionnelle",privateListing:"Annonce Privée",professionalUser:"Utilisateur Professionnel",privateUser:"Utilisateur Privé",contactSeller:"Contacter le Vendeur",sendMessage:"Envoyer un Message",noUsers:"Aucun utilisateur sur la carte",noUsersDescription:"Il n'y a actuellement aucun utilisateur avec des données de localisation à afficher.",viewListings:"Voir les Annonces",viewProfile:"Voir le Profil",viewStore:"Voir la Boutique",viewAll:"Voir Tout",centerOnMe:"Centrer sur moi",searchUser:"Rechercher un utilisateur...",noSearchResults:"Aucun utilisateur trouvé",completeProfileFirst:"Complétez le profil pour activer",noLocationTitle:"Emplacement Manquant",noLocationDesc:"Complétez votre profil avec adresse et ville pour utiliser cette fonction",invali
720dCoordsTitle:"Coordonnées Invalides",invalidCoordsDesc:"Vos coordonnées sont corrompues. Mettez à jour votre profil pour corriger"},xEe={title:"Système de Parrainage",heroTitle:"Invitez des Amis et Gagnez des Crédits CEI",heroDescription:"Partagez votre lien de parrainage et recevez 20 crédits CEI pour chaque ami qui s'inscrit. Votre ami recevra 10 crédits bonus supplémentaires!",friendsInvited:"Amis Invités",creditsEarned:"Crédits Gagnés",yourCode:"Votre Code",shareLink:"Partagez Votre Lien de Parrainage",shareLinkDesc:"Copiez et partagez ce lien avec vos amis pour les inviter sur la plateforme",copy:"Copier",copied:"Copié!",copiedDesc:"Lien de parrainage copié dans le presse-papiers",copyError:"Impossible de copier le lien",yourReferrals:"Vos Parrainages",yourReferralsDesc:"Personnes qui se sont inscrites via votre lien",noReferrals:"Vous n'avez encore invité personne",joinedOn:"Inscrit le {{date}}",active:"Actif",emailSubject:"Rejoignez la Communauté Ãconomique Indépendante",emailBody:"Salut! Je t'invite à rejoindre la plateforme CEI. Inscris-toi avec mon lien et reçois 10 crédits bonus: {{link}}",whatsappMessage:"Salut! Je t'invite à rejoindre la plateforme CEI. Reçois 10 crédits bonus en t'inscrivant avec mon lien: {{link}}",telegramMessage:"Rejoins la plateforme CEI et reçois 10 crédits bonus"},bEe={browse:"parcourir les fichiers",dropPasteFiles:"Déposez les fichiers ici, collez ou %{browse}",dropHint:"Déposez vos fichiers ici",uploading:"Téléchargement en cours...",complete:"Téléchargement terminé",failed:"Ãchec du téléchargement",uploadImages:"Télécharger des Images",uploadVideo:"Télécharger une Vidéo",imagesUploaded:"{{count}} image(s) téléchargée(s)",videoUploaded:"1 vidéo téléchargée",uploadSuccess:"Succès",uploadSuccessDesc:"{{count}} image(s) téléchargée(s) avec succès",videoUploadSuccess:"Vidéo téléchargée avec succès",professionalLimit:"Les utilisateurs professionnels peuvent télécharger jusqu'à 10 images et 1 vidéo par annonce",freeLimit:"Les utilisateurs gratuits peuvent télécharger jusqu'à 3 images par annonce"},wEe={opportunities:{title:"Opportunités de Bénévolat",subtitle:"Contribuez à la communauté et gagnez des crédits CEI",available:"opportunités",noResults:"Aucune opportunité trouvée",tryDifferentFilters:"Essayez de modifier les filtres de recherche"},myApplications:"Mes Candidatures",myRequests:"Mes Demandes",search:"Rechercher des opportunités...",allCities:"Toutes les villes",viewListing:"Voir l'Annonce",accept:"Accepter",confirmService:"Confirmer le Service",confirmServiceTitle:"Confirmer l'Achèvement",confirmServiceDescription:"Confirmez-vous que le service a été complété? Le bénévole recevra automatiquement la rémunération en crédits CEI.",confirmAndPay:"Confirmer et Payer",applicationSent:"Candidature envoyée",applicationSentDesc:"Le demandeur examinera votre candidature",applicationError:"Impossible d'envoyer la candidature",applicationAccepted:"Candidature acceptée",volunteerNotified:"Le bénévole a été notifié",acceptError:"Impossible d'accepter la candidature",serviceConfirmed:"Service confirmé",paymentProcessed:"Le paiement a été traité",confirmError:"Impossible de confirmer le service",browseOpportunities:"Parcourir les Opportunités",createRequest:"Nouvelle Demande",pending:"En Attente",active:"Actifs",completed:"Terminés",noPendingRequests:"Aucune candidature en attente",noActiveRequests:"Aucune demande active",noCompletedRequests:"Aucune demande terminée",requests:{subtitle:"Gérer les candidatures reçues"},requestDetails:"Détails de la Demande de Bénévolat",compensation:"Compensation en Crédits CEI",compensationDesc:"Combien de crédits CEI le bénévole recevra à l'achèvement du service. La plateforme paiera ce montant.",recurringService:"Service Récurrent",recurringServiceDesc:"Est-ce une opportunité de bénévolat ponctuelle ou récurrente?",maxVolunteers:"Maximum de Bénévoles",maxVolunteersDesc:"Combien de bénévoles peuvent aider avec cette demande? Laissez vide pour illimité.",compensationRequired:"La compensation en crédits CEI est obligatoire pour les demandes de bénévolat (minimum 1 CEI)"},SEe={backToHome:"Retour à l'Accueil",heroTitle:"Bienvenue dans la Communauté Ãconomique Indépendante",heroSubtitle:"Une Ãconomie Solidaire pour Renforcer Nos Communautés",philosophyTitle:"Comprendre l'Argent: Une Révolution Culturelle",philosophyText1:"L'argent est simplement une représentation de la richesse, pas la richesse elle-même. Si la richesse est créée par nos mains, notre travail, nos compétences, pourquoi sa représentation devrait-elle appartenir aux banques centrales privées?",philosophyText2:"Les Crédits CEI sont notre réponse: une Unité de Compte qui ne s'achète pas et ne se vend pas. Les crédits s'obtiennent uniquement en AGISSANT pour le bien commun: en offrant des produits, des services, des compétences à la communauté, ou en contribuant par des actions de bénévolat certifiées.",featuresTitle:"Comment Fonctionne la Plateforme CEI",freeUsersTitle:"Pour tous les utilisateurs:",freeFeature1:"Portefeuille personnel avec gestion des crédits CEI",freeFeature2:"Marketplace communautaire pour échanger des biens et services",freeFeature3:"Tarification hybride: 100% crédits CEI ou euros + crédits (minimum 20% en crédits)",freeFeature4:"Carte interactive pour découvrir les offres dans votre région et au-delà ",freeFeature5:"Messagerie pour contacter vendeurs et acheteurs",freeFeature6:"Profil public pour présenter votre activité",proUsersTitle:"Pour les utilisateurs professionnels (50â¬/an):",proFeature1:"Jusqu'à 50 vitrines avec 10 photos + 1 vidéo chacune",proFeature2:'Badge "Professionnel" pour une meilleure visibilité',pro
720Feature3:"Support prioritaire de la communauté",benefitsTitle:"Les Avantages de Participer",benefitsIntro:"Retrouver la confiance mutuelle dans un environnement protégé et solidaire, où:",benefit1:"Les relations économiques sont basées sur la coopération, pas la compétition",benefit2:"Les communautés locales se renforcent à travers les échanges territoriaux",benefit3:"Chaque contribution au bien commun est reconnue et rétribuée en crédits",benefit4:"La richesse circule au sein du réseau, sans intermédiaires financiers",benefit5:"Les communautés isolées se connectent dans un réseau solidaire national",gettingStartedTitle:"Commencez Maintenant",step1:"Complétez votre profil avec ville et compétences",step2:"Recevez votre bonus de bienvenue en crédits CEI",step3:"Créez votre première vitrine ou explorez le marketplace",step4:"Ãchangez en toute confiance dans votre communauté territoriale et au-delà ",closingStatement:"CEI est plus qu'une plateforme: c'est un moyen de nous réapproprier notre richesse et de construire ensemble une économie au service des personnes, pas du profit.",getStartedButton:"Commencer Maintenant",bannerText:"Ãconomie solidaire ⢠Communautés territoriales ⢠Crédits qui se gagnent, ne s'achètent pas",learnMore:"En Savoir Plus"},TEe={backToMarketplace:"Retour au Marketplace",heroTitle:"Questions Fréquemment Posées",heroSubtitle:"Tout ce que vous devez savoir pour utiliser la plateforme CEI",bannerText:"Vous avez des questions? Consultez la FAQ",gettingStartedTitle:"Premiers Pas",q1:"Comment m'inscrire sur la plateforme?",a1:"Cliquez sur 'Se Connecter' et suivez le processus d'authentification avec Replit. Après la première connexion, complétez votre profil en saisissant prénom, nom, ville et une brève description de vous ou de votre activité.",q2:"Est-ce que je reçois des crédits quand je m'inscris?",a2:"Oui! Chaque nouvel utilisateur reçoit un bonus de bienvenue en crédits CEI lors de la complétion du profil. Cela vous permet de commencer immédiatement à explorer le marketplace et faire vos premiers achats.",q3:"Comment compléter mon profil?",a3:"Allez à votre Tableau de Bord et cliquez sur 'Modifier le Profil'. Remplissez tous les champs requis: prénom, nom, ville et description. La ville est obligatoire car elle sert à vous positionner sur la carte interactive du marketplace.",listingsTitle:"Créer et Gérer les Annonces",q4:"Comment créer une annonce?",a4:"Depuis le Tableau de Bord, cliquez sur 'Créer une Annonce'. Saisissez titre, description, catégorie, prix en euros et crédits CEI (au moins 20% doit être en crédits), votre ville, et téléchargez les photos. Les utilisateurs gratuits peuvent télécharger jusqu'à 3 photos, les professionnels jusqu'à 10 photos + 1 vidéo.",q5:"Puis-je vendre uniquement en euros sans crédits CEI?",a5:"Non. La plateforme CEI exige que TOUTES les annonces incluent des crédits CEI dans le prix. Vous pouvez vendre à 100% en crédits CEI, ou créer un prix hybride (euros + crédits) avec au moins 20% en crédits CEI.",q6:"Combien d'annonces puis-je créer?",a6:"Les utilisateurs gratuits n'ont pas de limites sur le nombre d'annonces, mais ne peuvent télécharger que 3 photos par annonce. Les utilisateurs professionnels (50â¬/an) peuvent créer jusqu'à 50 annonces avec 10 photos + 1 vidéo chacune.",q7:"Comment modifier ou supprimer une annonce?",a7:"Allez au Tableau de Bord, cliquez sur 'Mes Annonces', trouvez l'annonce que vous voulez modifier et cliquez sur l'icône de modification. Pour supprimer une annonce, cliquez sur l'icône de corbeille. Attention: la suppression est permanente.",creditsTitle:"Crédits CEI",q8:"Que sont les crédits CEI?",a8:"Les crédits CEI sont une Unité de Compte qui représente la valeur du travail, des compétences et des contributions à la communauté. Ils ne peuvent pas être achetés ou vendus - ils sont gagnés uniquement en offrant des biens, des services ou des contributions de bénévolat certifiées.",q9:"Comment puis-je gagner des crédits CEI?",a9:"Vous pouvez gagner des crédits CEI de trois façons: 1) En vendant des produits ou services via le marketplace, 2) En recevant des transferts d'autres utilisateurs, 3) En participant à des activités de bénévolat certifiées par la communauté. Les administrateurs peuvent également attribuer des crédits pour des contributions spéciales.",q10:"Puis-je convertir les crédits CEI en euros?",a10:"Non. Les crédits CEI ne sont pas convert
720ibles en euros. Ils sont conçus pour circuler au sein du réseau CEI comme outil d'échange communautaire. Vous pouvez les utiliser pour acheter des biens et services auprès d'autres membres de la communauté.",professionalTitle:"Compte Professionnel",q11:"Quels sont les avantages du compte professionnel?",a11:"Le compte professionnel (50â¬/an) vous permet de: créer jusqu'à 50 vitrines, télécharger 10 photos + 1 vidéo par annonce, obtenir un badge 'Professionnel' visible sur vos annonces, une Page Boutique personnelle avec image de couverture personnalisable, recevoir un support prioritaire de la communauté et accéder aux fonctionnalités avancées.",q12:"Comment devenir utilisateur professionnel?",a12:"Contactez l'administrateur de la plateforme pour demander la mise à niveau Professionnel (50â¬/an). La mise à niveau est immédiate et dure une année entière.",storeTitle:"Page Boutique",q24:"Qu'est-ce que la Page Boutique?",a24:"La Page Boutique est une vitrine personnelle disponible pour les utilisateurs professionnels. C'est une page dédiée où les clients peuvent voir toutes vos annonces au même endroit, avec votre photo de profil, profession, ville et une image de couverture personnalisable.",q25:"Comment accéder à ma Page Boutique?",a25:"Votre Page Boutique a une URL dédiée du type: comunitaeconomicaindipendente.it/store/[votre-id]. Les clients peuvent aussi y accéder en cliquant le bouton 'Visiter ma boutique' sur toutes vos annonces. Vous pouvez partager ce lien sur les réseaux sociaux ou dans vos supports promotionnels.",q26:"Comment personnaliser la couverture de ma boutique?",a26:"Allez sur 'Modifier le Profil' depuis le Tableau de Bord. Dans la section pour les utilisateurs professionnels, vous trouverez 'Couverture Boutique'. Téléchargez une image (recommandé 1200x400px, max 5Mo) qui représente votre activité. Elle apparaîtra en haut de votre Page Boutique.",q27:"Les clients peuvent-ils me contacter depuis la Page Boutique?",a27:"Depuis la Page Boutique, les clients peuvent voir toutes vos annonces et cliquer sur chacune pour les détails. De là , ils peuvent vous contacter via le système de messagerie de la plateforme. La Page Boutique affiche aussi votre site web (si ajouté à votre profil) comme lien cliquable.",safetyTitle:"Communication et Sécurité",q13:"Comment contacter un vendeur?",a13:"Cliquez sur le bouton 'Contacter' dans l'annonce ou sur la carte interactive. Cela ouvrira le chat interne où vous pouvez envoyer des messages en temps réel. Toutes les conversations sont privées et sécurisées.",q14:"Comment fonctionne le paiement?",a14:"Les paiements en EUROS se font HORS de la plateforme - vous et le vendeur convenez de la méthode (virement bancaire, espèces, etc). Les paiements en crédits CEI se font directement sur la plateforme: lorsque vous confirmez l'achat, les crédits sont automatiquement transférés de votre portefeuille à celui du vendeur.",referralTitle:"Programme de Parrainage",q15:"Qu'est-ce que le programme de parrainage?",a15:"Le programme de parrainage vous permet d'inviter des amis sur la plateforme CEI. Quand quelqu'un s'inscrit avec votre lien personnel, vous recevez tous les deux des crédits bonus: vous obtenez 20 crédits CEI en remerciement, et votre ami reçoit 10 crédits bonus pour commencer.",q16:"Comment trouver mon lien de parrainage?",a16:"Allez à la page 'Système de Parrainage' depuis votre Tableau de Bord. Vous y trouverez votre code personnel et un lien unique à partager. Vous pouvez copier le lien et le partager via WhatsApp, Telegram, email ou tout autre canal que vous préférez.",q17:"Combien de personnes puis-je inviter?",a17:"Il n'y a pas de limite! Vous pouvez inviter autant de personnes que vous voulez. Pour chaque ami qui s'inscrit et complète son profil avec votre lien, vous recevrez 20 crédits CEI. Plus vous invitez de personnes, plus vous gagnez de crédits.",q18:"Comment mes parrainages sont-ils suivis?",a18:"Le système utilise un cookie qui dure 30 jours. Quand quelqu'un clique sur votre lien, votre code est enregistré. S'il s'inscrit dans les 30 jours, vous serez reconnu comme parrain. Vous pouvez voir tous vos parrainages et crédits gagnés sur la page dédiée.",volunteerTitle:"Services de Bénévolat",q19:"Que sont les Services de Bénévolat?",a19:"Les Services de Bénévolat sont une catégorie spéciale d'annonces où les membres de la communauté peuvent demander de l'aide pour des activités d'intérêt commun. Ceux qui répondent et complètent le service sont payés par la plateforme elle-même en crédits CEI, pas par le demandeur.",q20:"Comment fonctionne le paiement pour les bénévoles?",a20:"Quand un bénévole termine un service, la plateforme CEI paie automatiquement des crédits CEI directement dans son portefeuille. Le montant est défini par la personne qui crée l'annonce de bénévolat (minimum 1 crédit CEI). Ce paiement provient de la réserve de la plateforme, pas du demandeur de service. C'est une façon de récompenser ceux qui contribuent à la communauté.",q21:"Comment puis-je postuler pour un service de bénévolat?",a21:"Recherchez les annonces dans la catégorie 'Services de Bénévolat' sur le marketplace. Quand vous trouvez une opportunité intéressante, cliquez sur 'Postuler' pour envoyer votre disponibilité. Le demandeur recevra une notification et pourra accepter votre candidature.",q22:"Quels sont les états d'une mission de bénévolat?",a22:"Le flux est: 1) 'Candidat' - vous avez envoyé votre disponibilité, 2) 'Accepté' - le demandeur a confirmé, 3) 'Service Terminé' - vous avez fini l'activité, 4) 'Confirmé' - le demandeur confirme et vous recevez les crédits. Si le service ne fonctionne pas, il peut être 'Rejeté' ou 'Annulé'.",q23:"Puis-je créer des demandes de bénévolat?",a23:"Oui! Allez sur 'Créer une Annonce' et sélectionnez la catégorie 'Services de Bénévolat'. Décrivez l'activité pour laquelle vous avez besoin d'aide (par ex., aide au déménagement, cours particuliers, accompagnement) et indiquez combien de crédits CEI le bénévole recevra en compensation (minimum 1 crédit). Les bénévoles intéressés postuleront et vous pourrez choisir qui accepter. Rappel: c'est la plateforme qui paiera le bénévole, pas vous.",voucherTitle:"Campagnes Voucher",q28:"Que sont les campagnes voucher?",a28:"Les campagnes voucher sont un système de distribution de crédits CEI bonus lors d'événements communautaires. L'administrateur crée un code voucher avec un montant spécifique, et les participants aux événements peuvent l'utiliser pour recevoir des crédits supplémentaires dans leur portefeuille.",q29:"Comment utiliser un code voucher?",a29:"Dans votre Tableau de Bord, vous trouverez la section 'Utiliser un Voucher'. Entrez le code reçu lors de l'événement et cliquez sur 'Utiliser'. Les crédits bonus seront ajoutés immédiatement à votre portefeuille. Chaque voucher ne peut être utilisé qu'une seule fois par utilisateur.",q30:"Comment obtenir un code voucher?",a30:"Les codes voucher sont distribués lors des événements de la communauté CEI. Participez aux réunions, assemblées et activités organisées par la communauté pour recevoir les codes. Les vouchers peuvent avoir une date d'expiration et un nombre maximum d'utilisations, alors utilisez-les dès que possible.",mapTitle:"Carte Interactive",q31:"Comment fonctionne la carte interactive?",a31:"La carte montre tous les membres de la communauté CEI avec un marqueur sur leur position. Vous pouvez cliquer sur chaque marqueur pour voir le profil de l'utilisateur, ses annonces et le contacter directement. Les utilisateurs professionnels ont un marqueur différent pour les distinguer.",q32:"Comment apparaître sur la carte?",a32:"Pour apparaître sur la carte, vous devez compléter votre profil en indiquant votre ville et votre adresse. Le système calcule automatiquement les coordonnées à partir de votre position. Si vous remarquez que votre position n'est pas précise, essayez de sauvegarder à nouveau votre profil avec une adresse plus détaillée.",stillNeedHelp:"Vous ne trouvez pas ce que vous cherchez?",contactSupport:"Contacter le Support"},CEe={bannerText:"Nouveau? Découvrez comment vous inscrire",bannerCta:"Guide étape par étape",backToMarketplace:"Retour au Marketplace",heroTitle:"Guide d'Inscription",heroSubtitle:"Suivez ces 8 étapes simples pour créer votre compte CEI",timeEstimate:"Temps estimé: 3-5 minutes",beforeYouStart:"Avant de commencer, assurez-vous d'avoir:",requirement1:"Une adresse email valide à laquelle vous pouvez accéder",requirement2:"Quelques minutes pour compléter l'inscription",requirement3:"Vos informations personnelles (prénom, nom, ville)",tipLabel:"Conseil:",step1Title:'Cliquez sur "Se Connecter"',step1Desc:`Depuis la page principale du marketplace CEI, trouvez le bouton "Se Connecter" dans le coin supérieur droit. 721 722Cliquez sur le bouton pour commencer le processus d'inscription.`,step1Tips:"Si vous êtes sur smartphone, le bouton peut être dans le menu hamburger (les trois lignes horizontales).",step2Title:'Choisissez "Continue with email"',step2Desc:`Une fenêtre Replit s'ouvrira (le système qui gère les comptes). 723 724Cliquez sur "Continue with email" (Continuer avec email), puis entrez votre adresse email et choisissez un mot de passe.`,step2Tips:"Utilisez un email que vous consultez régulièrement. Choisissez un mot de passe sécurisé dont vous vous souviendrez.",step3Title:"Vérifiez le Code Email",step3Desc:`Replit enverra un code de vérification à 6 chiffres à votre email. 725 726Ouvrez votre boîte de réception, trouvez l'email de Replit (vérifiez aussi spam/indésirables), copiez le code et collez-le dans la fenêtre Replit.`,step3Tips:`Le code expire après quelques minutes. S'il n'arrive pas, cliquez "Resend code" pour le recevoir à nouveau.`,step4Title:"Créez votre Compte Replit",step4Desc:`Si c'est la première fois que vous utilisez Replit, on vous demandera de: 727 728⢠Créer un nom d'utilisateur 729⢠Remplir quelques champs optionnels (profession, ce que vous voulez faire, etc.) 730 731Ces formulaires viennent de Replit, pas de CEI. Vous pouvez les remplir rapidement ou les ignorer si possible.`,step4Tips:"Choisissez un nom d'utilisateur simple. Les champs supplémentaires (profession, projets) sont pour Replit et n'affectent pas votre compte CEI.",step5Title:"Autorisez l'Accès à CEI",step5Desc:`Replit vous demandera d'autoriser l'accès à la plateforme CEI. 732 733Cliquez sur "Authorize" (Autoriser) pour permettre à CEI de lire vos informations de base (email et nom d'utilisateur).`,step5Tips:"Cette autorisation est sécurisée. CEI n'aura jamais accès à votre mot de passe Replit.",step6Title:"Complétez votre Profil CEI",step6Desc:`Vous êtes maintenant sur la plateforme CEI! Un formulaire apparaîtra pour compléter votre profil. 734 735Entrez: 736⢠Prénom et Nom 737⢠Numéro de téléphone 738⢠Votre profession ou activité`,step6Tips:"Remplissez tous les champs avec attention. Ces informations aideront les autres utilisateurs à vous connaître.",step7Title:"Ajoutez votre Position",step7Desc:`Entrez votre adresse complète et ville. Ces données sont essentielles pour: 739 740⢠Apparaître sur la carte du marketplace 741⢠Ãtre trouvé par ceux qui cherchent des services dans votre zone 742⢠Trouver des offres près de chez vous 743 744Notre communauté est fondée sur la confiance et la transparence.`,step7Tips:"Une adresse précise aide les autres membres de la communauté à vous trouver facilement.",step8Title:"Enregistrez et Commencez!",step8Desc:`Cliquez sur "Enregistrer le Profil" pour terminer l'inscription. 745
746Félicitations! Vous avez créé votre compte CEI et reçu vos premiers crédits de bienvenue!`,step8Tips:"Vous pouvez maintenant explorer le marketplace, créer des annonces et commencer à utiliser vos crédits CEI.",completedTitle:"Inscription Terminée!",completedDesc:"Une fois toutes les étapes complétées, vous aurez un accès complet à la plateforme CEI:",benefit1:"Crédits de bienvenue dans votre portefeuille",benefit2:"Possibilité de créer des annonces sur le marketplace",benefit3:"Chat pour contacter vendeurs et acheteurs",benefit4:"Accès au programme de parrainage pour inviter des amis",readyToStart:"Prêt à commencer?",startButton:"Aller au Marketplace et S'inscrire",needHelp:"Encore des questions?",checkFaq:"Consultez la FAQ"},EEe={redeemTitle:"Utiliser un Voucher",redeemDescription:"Entrez un code voucher pour recevoir des crédits CEI bonus",enterCode:"Entrez le code voucher...",redeem:"Utiliser",congratulations:"Félicitations!",redeemSuccess:"Vous avez reçu {{amount}} crédits CEI bonus!",title:"Campagnes Voucher",subtitle:"Créez et gérez des campagnes voucher pour les événements communautaires",create:"Créer Voucher",edit:"Modifier Voucher",createDesc:"Configurez un nouveau code voucher pour la distribution communautaire",editDesc:"Modifier les paramètres du voucher",noVouchers:"Aucune campagne voucher",createFirst:"Créez votre première campagne voucher",active:"Actif",inactive:"Inactif",scheduled:"Programmé",expired:"Expiré",newUsersOnly:"Nouveaux Utilisateurs Uniquement",existingUsersOnly:"Utilisateurs Existants Uniquement",allUsers:"Tous les Utilisateurs",code:"Code",description:"Description",descriptionPlaceholder:"Décrivez cette campagne voucher...",bonusType:"Type de Bonus",fixed:"Montant Fixe",multiplier:"Multiplicateur",bonusValue:"Valeur du Bonus",targetAudience:"Public Cible",startsAt:"Date de Début",endsAt:"Date de Fin",maxRedemptions:"Utilisations Max",unlimited:"Illimité",isActive:"Actif",redemptions:"Utilisations",totalDistributed:"Total Distribué",sendBroadcast:"Envoyer Diffusion",broadcastDesc:"Envoyer le code voucher {{code}} à tous les utilisateurs",broadcastTemplate:"Bonus spécial! Utilisez le code {{code}} pour recevoir {{bonus}} crédits!",message:"Message",send:"Envoyer",errors:{notFound:"Code voucher non trouvé",inactive:"Ce voucher n'est plus actif",notStarted:"Ce voucher n'est pas encore valide",expired:"Ce voucher a expiré",newUsersOnly:"Ce voucher est réservé aux nouveaux utilisateurs",existingUsersOnly:"Ce voucher est réservé aux utilisateurs existants",maxRedemptionsReached:"Ce voucher a atteint son nombre maximum d'utilisations",alreadyRedeemed:"Vous avez déjà utilisé ce voucher",generic:"Impossible d'utiliser le voucher. Veuillez réessayer"},admin:{title:"Campagnes Voucher",description:"Créez et gérez des campagnes voucher pour les événements communautaires",createNew:"Créer Voucher",noVouchers:"Aucune campagne voucher",noVouchersDesc:"Créez votre première campagne pour distribuer des crédits bonus lors d'événements",code:"Code",name:"Nom de la Campagne",namePlaceholder:"ex., Ãvénement Ãté 2025",bonusType:"Type de Bonus",bonusTypeFixed:"Montant Fixe",bonusTypeMultiplier:"Multiplicateur",bonusAmount:"Montant du Bonus",bonusMultiplier:"Multiplicateur (ex., 1.5 = 50% supplémentaire)",targetAudience:"Public Cible",targetAll:"Tous les Utilisateurs",targetNewUsers:"Nouveaux Utilisateurs Uniquement",targetExistingUsers:"Utilisateurs Existants Uniquement",maxRedemptions:"Utilisations Max (0 = illimité)",startDate:"Date de Début",endDate:"Date de Fin",active:"Actif",inactive:"Inactif",redemptions:"Utilisations",created:"Créé",actions:"Actions",edit:"Modifier",toggleStatus:"Changer le Statut",delete:"Supprimer",deleteConfirm:"Supprimer cette campagne voucher?",deleteDesc:"Cette action est irréversible. Toutes les données d'utilisation seront perdues.",createSuccess:"Campagne voucher créée avec succès",updateSuccess:"Campagne voucher mise à jour avec succès",deleteSuccess:"Campagne voucher supprimée",statusUpdated:"Statut du voucher mis à jour",error:"Une erreur s'est produite",broadcast:"Diffuser",broadcastTitle:"Diffuser le Code Voucher",broadcastDesc:"Envoyer le code voucher à tous les utilisateurs via message système",broadcastMessage:"Contenu du Message",broadcastMessagePlaceholder:"Ãcrivez un message pour accompagner le code voucher...",broadcastSend:"Envoyer à Tous les Utilisateurs",broadcastSuccess:"Code voucher diffusé avec succès",statistics:"Statistiques",totalRedemptions:"Utilisations Totales",creditsDistributed:"Crédits Distribués"}},AEe={academy:{title:"Galerie Vidéo",subtitle:"Découvrez des tutoriels, actualités et contenus éducatifs de notre c
746ommunauté",allVideos:"Tous",news:"Actualités",divulgazione:"Ãducatif",tutorial:"Tutoriel",medicoAmico:"Médecin Ami","interviste-giraldi":"Interviews Prof. Giraldi","considerazioni-scientifiche":"Considérations Scientifiques",intervisteGiraldi:"Interviews Prof. Giraldi",considerazioniScientifiche:"Considérations Scientifiques",noVideos:"Aucune vidéo disponible",noVideosDesc:"Les vidéos seront bientôt disponibles",watchVideo:"Regarder la Vidéo",duration:"Durée"},admin:{title:"Gestion des Vidéos",description:"Téléchargez et gérez les vidéos de la Galerie Vidéo",createVideo:"Télécharger une Nouvelle Vidéo",createVideoDesc:"Ajouter une nouvelle vidéo à la Galerie Vidéo",editVideo:"Modifier la Vidéo",editVideoDesc:"Mettre à jour les informations de la vidéo",deleteVideo:"Supprimer la Vidéo",deleteVideoConfirm:'Ãtes-vous sûr de vouloir supprimer la vidéo "{{title}}"? Cette action est irréversible.',noVideos:"Aucune vidéo téléchargée",videoFile:"Fichier Vidéo",thumbnail:"Image Miniature",titleField:"Titre",titlePlaceholder:"Titre de la vidéo...",descriptionField:"Description",descriptionPlaceholder:"Description de la vidéo...",category:"Catégorie",duration:"Durée (secondes)",durationPlaceholder:"ex., 120",durationHint:"Durée en secondes",featuredOrder:"Ordre en Vedette",orderHint:"Les nombres plus petits apparaissent en premier",published:"Publié",featured:"En Vedette",draft:"Brouillon",noDescription:"Aucune description",selectFile:"Sélectionner un Fichier",selectImage:"Sélectionner une Image",fileTooLarge:"Le fichier est trop volumineux. Maximum {{max}}MB",uploadFailed:"Ãchec du téléchargement. Veuillez réessayer",createSuccess:"Vidéo téléchargée avec succès",updateSuccess:"Vidéo mise à jour avec succès",deleteSuccess:"Vidéo supprimée avec succès",publish:"Publier",unpublish:"Dépublier",feature:"Mettre en Vedette",unfeature:"Retirer de la Vedette"}},IEe={dialogTitle:"Acceptation de la Politique de Confidentialité",dialogDesc:"Avant d'utiliser la plateforme, veuillez lire et accepter notre politique de confidentialité.",dataControllerTitle:"Responsable du Traitement",dataControllerText:"L'Associazione Comunità Economica Indipendente est responsable du traitement de vos données personnelles.",dataCollectedTitle:"Données Collectées",dataCollectedText:"Nous collectons des données personnelles telles que nom, email, téléphone, adresse et données de transactions pour fournir nos services.",purposeTitle:"Finalité",purposeText:"Vos données sont utilisées pour gérer votre compte, vous permettre de publier des annonces, effectuer des transactions et communiquer avec d'autres utilisateurs.",rightsTitle:"Vos Droits",rightsText:"Vous avez le droit d'accéder, rectifier, supprimer vos données et vous opposer au traitement. Contactez-nous à [email protected]",readFullPolicy:"Lire la politique de confidentialité complète",acceptCheckbox:"J'ai lu et j'accepte la politique de confidentialité et j'autorise le traitement de mes données personnelles conformément au RGPD.",acceptButton:"Accepter et Continuer",acceptedTitle:"Confidentialité Acceptée",acceptedDesc:"Merci d'avoir accepté notre politique de confidentialité.",acceptError:"Erreur lors de l'acceptation. Veuillez réessayer."},kEe={title:"Documents",subtitle:"Confidentialité, Code d'Ãthique et Règlements de la Communauté",backToHome:"Retour à l'Accueil",noDocuments:"Aucun document disponible pour le moment.",typePrivacy:"Politique de Confidentialité",typeEthics:"Code d'Ãthique",typeRegulations:"Règlements",typeOther:"Autres Documents",view:"Voir",download:"Télécharger"},PEe={sectionTitle:"Carte de Membre CEI",title:"CARTE DE MEMBRE",download:"Télécharger la Carte",number:"Carte n.",birthDate:"Date de naissance",city:"Ville",memberSince:"Membre depuis"},NEe={common:nEe,categories:rEe,header:sEe,landing:oEe,marketplace:aEe,orders:lEe,myListings:cEe,createListing:uEe,listingDetail:dEe,dashboard:hEe,admin:pEe,transaction:fEe,messages:mEe,user:gEe,profile:yEe,validation:_Ee,map:vEe,referral:xEe,upload:bEe,volunteer:wEe,about:SEe,faq:TEe,registrationGuide:CEe,voucher:EEe,video:AEe,privacy:IEe,documents:kEe,memberCard:PEe},MEe={loading:"Cargando...",signIn:"Iniciar Sesión",signUp:"Registrarse",enter:"Entrar",signOut:"Cerrar Sesión",getStarted:"Comenzar",cancel:"Cancelar",save:"Guardar",edit:"Editar",send:"Enviar",clear:"Limpiar",clearAll:"Limpiar todo",filters:"Filtros",search:"Buscar",credits:"Créditos",chooseLanguage:"Elige tu idioma",dashboard:"Panel",backToDashboard:"Volver al Panel"},DEe={"Professional Services":"Servicios Profesionales","Home & Garden":"Casa y JardÃn","Health & Wellness":"Salud y Bienestar",Education:"Educación",Technology:"TecnologÃa","Creative Services":"Servicios Creativos","Food & Catering":"C
746omida y Catering",Transportation:"Transporte","Volunteer Services":"Solicitudes de Servicios de Voluntariado",Entertainment:"Entretenimiento","B&B, Hospitality & Catering":"B&B, HostelerÃa y Restauración","Present Your Project":"Presenta tu proyecto","Free Services":"Servicios Gratuitos"},REe={walletManager:"Gestor de Billetera",adminDashboard:"Panel de Administrador",myWallet:"Mi Billetera"},jEe={title:"Gestiona Tus Créditos",subtitle:"De Forma Segura y Eficiente",description:"Una plataforma profesional de gestión de billeteras para rastrear y transferir puntos y créditos personalizados. Simple, segura y diseñada para equipos.",purchaseTitle:"Compra con créditos de los productores registrados en CEI",feature1Title:"Una Billetera Por Usuario",feature1Desc:"Cada usuario obtiene una billetera segura creada automáticamente al registrarse. Consulta tu saldo y el historial de transacciones de un vistazo.",feature2Title:"Transferencias Fáciles",feature2Desc:"Transfiere créditos a otros usuarios al instante. Todas las transacciones se rastrean con historial completo y descripciones.",feature3Title:"Controles de Administrador",feature3Desc:"Los administradores pueden agregar créditos a cualquier billetera, ver todos los usuarios y gestionar toda la plataforma con herramientas potentes.",footer:"Plataforma de gestión de créditos segura."},zEe={communityName:"Comunidad Económica Independiente",heroTitle:"Descubre Servicios Locales y Apoya a Tu Comunidad",heroSubtitle:"Explora productos y servicios con precios hÃbridos: euros + créditos comunitarios CEI",searchPlaceholder:"Buscar servicios, productos...",cityPlaceholder:"Ciudad",selectCategory:"Todas las CategorÃas",searchButton:"Buscar",viewMap:"Ver Mapa",supportProject:"Apoyar el Proyecto",noListingsTitle:"No se encontraron anuncios",noListingsDesc:"Intenta ajustar tus filtros",foundUsers:"Perfiles encontrados",userFound:"perfil encontrado",usersFound:"perfiles encontrados",featuredListings:"Anuncios destacados 100% créditos CEI",loading:"Cargando anuncios...",browseMarketplace:"Explorar Marketplace",viewDetails:"Ver Detalles",upgradeSuccessful:"¡Actualización Exitosa!",upgradeSuccessfulDesc:"Ahora eres un vendedor profesional. ¡Bienvenido!",donationTitle:"Apoyar COMUNITA' ECONOMICA INDIPENDENTE",donationDesc:"Ayúdanos a mantener la plataforma funcionando y apoyar nuestras iniciativas comunitarias",donationChooseAmount:"Elige una cantidad",donationCustomAmount:"O ingresa una cantidad personalizada (â¬)",donationEnterAmount:"Ingresar cantidad",donationProcessing:"Procesando...",donateButton:"Donar â¬{{amount}}",securePayment:"Procesamiento de pago seguro impulsado por Stripe",upgradeTitle:"Actualizar a Profesional",upgradeDesc:"Desbloquea funciones premium y haz crecer tu negocio en CEI Marketplace",upgradePerYear:"por año",upgradeIncluded:"Qué está incluido:",upgradeFeature1:"Hasta 50 escaparates en el marketplace",upgradeFeature2:"10 fotos + 1 video por anuncio",upgradeFeature3:"Soporte prioritario al cliente",upgradeFeature4:"Insignia profesional en tus anuncios",upgradeFeature5:"Panel de análisis avanzado",upgradeFeature6:"Posicionamiento destacado en resultados de búsqueda",upgradeButton:"Actualizar Ahora",upgradeProcessing:"Procesando...",authRequired:"Inicio de Sesión Requerido",authRequiredDesc:"INICIA SESIÃN GRATIS PARA ACTIVAR LOS SERVICIOS",searchByCity:"Por Ciudad",searchByRadius:"Por Radio",allSellers:"Todos",professionalOnly:"Solo Profesionales",privateOnly:"Solo Particulares",useMyLocation:"Usar mi ubicación",locationSet:"Ubicación establecida",locating:"Localizando...",locationFound:"Ubicación encontrada"},LEe={title:"Mis Pedidos",purchases:"Compras",sales:"Ventas",noPurchases:"Aún no hay compras",noPurchasesDesc:"Tus pedidos como comprador aparecerán aquÃ",noSales:"Aún no hay ventas",noSalesDesc:"Tus pedidos como vendedor aparecerán aquÃ",pending:"Pendiente",reserved:"Reservado",completed:"Completado",cancelled:"Cancelado",expired:"Expirado",seller:"Vendedor",buyer:"Comprador",listing:"Anuncio",unknown:"Desconocido",price:"Precio",status:"Estado",orderDate:"Fecha del pedido",expiresOn:"Expira el",buyerNotes:"Notas del comprador",confirmOrder:"Confirmar Pedido",confirmReceipt:"Confirmar Recepción",cancelOrder:"Cancelar Pedido",contactCounterpart:"Contactar",waitingBuyerConfirmation:"Esperando que el comprador confirme la recepción. Los créditos se transferirán después de la confirmación.",confirmTitle:"¿Confirmar recepción?",confirmDesc:"¿Confirmas haber recibido el servicio o producto? Los créditos serán transferidos al vendedor.",cancelTitle:"¿Cancelar este pedido?",cancelDesc:"Los créditos reservados serán devueltos al comprador.",updating:"Actualizando...",orderUpdated:"Pedido Actualizado",orderConfirmed:"Pedido confirmado con éxito.",orderCancelled:"Pedido cancelado con éxito.",updateFailed:"Actualización Fallida",updateError:"No se pudo actualizar el estado del pedido",manageYourOrders:"Gestiona tus pedidos y ventas"}
746,OEe={title:"Mis Anuncios",createNew:"Crear Nuevo Anuncio",noListings:"Aún no hay anuncios",noListingsDesc:"Tus anuncios aparecerán aquà una vez que los crees",active:"Activo",inactive:"Inactivo",toggleActive:"Activar/Desactivar",edit:"Editar",delete:"Eliminar",deleteTitle:"¿Eliminar este anuncio?",deleteDesc:"Esta acción no se puede deshacer. El anuncio será eliminado permanentemente.",deleting:"Eliminando...",listingDeleted:"Anuncio Eliminado",listingDeletedDesc:"Tu anuncio ha sido eliminado con éxito.",deleteFailed:"Eliminación Fallida",deleteError:"No se pudo eliminar el anuncio",statusUpdated:"Estado Actualizado",statusUpdatedDesc:"El estado del anuncio ha sido cambiado.",statusFailed:"Actualización Fallida",statusError:"No se pudo actualizar el estado del anuncio"},FEe={createTitle:"Crear Nuevo Anuncio",editTitle:"Editar Anuncio",basicInfo:"Información Básica",basicInfoDesc:"Ingresa los detalles principales de tu anuncio",title:"TÃtulo",titlePlaceholder:"ej., ConsultorÃa Profesional de Diseño Web",description:"Descripción",descriptionPlaceholder:"Describe tu producto o servicio en detalle...",category:"CategorÃa",selectCategory:"Selecciona una categorÃa",pricing:"Precios",pricingDesc:"Establece tus precios (al menos uno requerido)",pricingOptionalDesc:"Para esta categorÃa, el precio es opcional. Puedes dejar los campos vacÃos.",clearPrices:"Borrar precios",priceEuros:"Cuota ⬠(mÃn. 0% máx 80%)",priceCredits:"Cuota Créditos CEI (mÃn. 20% máx. 100%)",hybridPricingNote:"Al usar ambos, los créditos deben ser al menos el 20% del valor total",location:"Ubicación",locationDesc:"Agrega tu ubicación para aparecer en el mapa",address:"Dirección",city:"Ciudad",country:"PaÃs",latitude:"Latitud",longitude:"Longitud",imageUrl:"URL de Imagen",imageUrlPlaceholder:"https://ejemplo.com/imagen.jpg",requiresContact:"Requiere contacto previo",requiresContactDesc:"Activa si el comprador debe contactarte antes de ordenar (ej. para acordar talla, cantidad, fechas)",activeStatus:"Estado Activo",activeStatusDesc:"Hacer visible este anuncio a los compradores",saving:"Guardando...",createButton:"Crear Anuncio",updateButton:"Actualizar Anuncio",cancel:"Cancelar",success:"¡Ãxito!",listingCreated:"Tu anuncio ha sido creado con éxito.",listingUpdated:"Tu anuncio ha sido actualizado con éxito.",error:"Error",createError:"No se pudo crear el anuncio. Por favor, inténtalo de nuevo.",updateError:"No se pudo actualizar el anuncio. Por favor, inténtalo de nuevo.",validationError:"Por favor, verifica el formulario para errores de validación"},BEe={professional:"Profesional",postedOn:"Publicado el",location:"Ubicación",price:"Precio",yourBalance:"Tu Saldo",aboutSeller:"Acerca del Vendedor",viewProfile:"Ver Perfil",viewStore:"Ver Vitrina",description:"Descripción",placeOrder:"Realizar Pedido",contactSeller:"Contactar Vendedor",interestedMessage:"¡Hola! Estoy interesado/a en tu anuncio: {{title}}",backToListings:"Volver a Anuncios",orderPlaced:"¡Pedido Realizado!",orderPlacedDesc:"Tu pedido ha sido creado. Los créditos han sido reservados.",insufficientCredits:"Créditos Insuficientes",insufficientCreditsDesc:"No tienes suficientes créditos CEI para este pedido.",orderFailed:"Pedido Fallido",orderError:"No se pudo crear el pedido. Por favor, inténtalo de nuevo.",notesLabel:"Notas para el Vendedor",notesPlaceholder:"Notas adicionales para el vendedor (opcional)...",noteLabel:"Nota",euroNote:"El importe en euros debe pagarse directamente al vendedor según lo acordado.",creditsNote:"Los créditos CEI se reservarán al realizar el pedido y se transferirán al completarse.",requiresContactInfo:"Para este anuncio, debes contactar primero al vendedor para acordar los detalles del pedido.",ownListing:"Este es tu propio anuncio",editListing:"Editar Anuncio",submit:"Enviar Pedido",submitting:"Enviando..."},UEe={title:"Mi Billetera",subtitle:"Gestiona tus créditos y consulta el historial de transacciones",balance:"Saldo",customizeName:"Personalizar nombre de billetera",walletName:"Nombre de la Billetera",walletNamePlaceholder:"ej., Mi Billetera Principal",walletNameDescription:"Dale un n
746ombre personalizado a tu billetera para personalizar tu experiencia.",walletBalance:"Saldo de la Billetera",transferCredits:"Transferir Créditos",recipient:"Destinatario",selectUser:"Selecciona un usuario",noOtherUsers:"No hay otros usuarios disponibles",recipientEmail:"Email del Destinatario",amount:"Cantidad",amountPlaceholder:"0,00",description:"Descripción",descriptionOptional:"Descripción (opcional)",descriptionPlaceholder:"¿Para qué es esta transferencia?",transactionHistory:"Historial de Transacciones",transferSubmit:"Transferir Créditos",transferring:"Transfiriendo...",saving:"Guardando...",noTransactionsTitle:"Aún no hay transacciones",noTransactionsDesc:"Tu historial de transacciones aparecerá aquà una vez que comiences a transferir créditos.",myListings:"Mis Anuncios",myOrders:"Mis Pedidos",messages:"Mensajes",createListing:"Crear Anuncio",goToMarketplace:"Ir al Marketplace"},VEe={title:"Gestión de Usuarios",subtitle:"Ver todos los usuarios y gestionar créditos de billetera",allUsers:"Todos los Usuarios",noUsers:"No se encontraron usuarios",addCredits:"Agregar Créditos a la Billetera",user:"Usuario",selectUser:"Selecciona un usuario",noUsersAvailable:"No hay usuarios disponibles",userEmail:"Email del Usuario",amount:"Cantidad",amountPlaceholder:"0,00",reason:"Motivo",reasonOptional:"Motivo (opcional)",reasonPlaceholder:"¿Por qué estás agregando estos créditos?",addCreditsSubmit:"Agregar Créditos",addingCredits:"Agregando...",allTransactions:"Todas las Transacciones",editWalletName:"Editar Nombre de Billetera",admin:"Administrador",unknownUser:"Usuario Desconocido",signupBonus:"Bono de Registro",signupBonusTitle:"Configurar Bono de Registro",signupBonusDesc:"Establecer la cantidad de créditos que los nuevos usuarios reciben al crear una cuenta",signupBonusAmount:"Cantidad del Bono",signupBonusPlaceholder:"100,00",signupBonusSave:"Guardar Bono de Registro",signupBonusSaving:"Guardando...",signupBonusSuccess:"Bono de registro actualizado",signupBonusSuccessDesc:"Los nuevos usuarios ahora recibirán {{amount}} créditos al registrarse",signupBonusError:"Error al actualizar el bono de registro",currentBonus:"Actual: {{amount}} créditos",professionalPriceTitle:"Precio de Upgrade Profesional",professionalPriceDesc:"Establece el costo anual para actualizar a una cuenta profesional",professionalPriceAmount:"Precio (EUR)",professionalPricePlaceholder:"50,00",professionalPriceSave:"Guardar Precio",professionalPriceSaving:"Guardando...",professionalPriceSuccess:"Precio de upgrade actualizado",professionalPriceSuccessDesc:"El nuevo precio del upgrade profesional es â¬{{amount}}/año",professionalPriceError:"Error al actualizar el precio",currentPrice:"Actual: â¬{{amount}}/año",totalCreditsIssued:"Total Créditos Emitidos",creditsIssuedDesc:"Total histórico hasta hoy",exchangeVolume:"Volumen de Intercambios",exchangeVolumeDesc:"Transacciones entre usuarios",professionalStatusTitle:"Gestión del Estado Profesional",professionalStatusDesc:"Activar o desactivar manualmente el estado profesional para los usuarios",activateProfessional:"Activar",deactivateProfessional:"Desactivar",manualProfessionalActivation:"Activación manual del estado profesional",manualProfessionalDeactivation:"Desactivación manual del estado profesional",deleteUser:"Eliminar Usuario",deleteUserWarning:"¿Estás seguro de que quieres eliminar al usuario",deleteUserPermanent:"Esta acción es irreversible. Todos los datos del usuario (billetera, anuncios, pedidos, mensajes) serán eliminados permanentemente.",userDeleted:"Usuario eliminado con éxito",deleteUserFailed:"Error al eliminar el usuario",confirmDelete:"Eliminar Permanentemente",processing:"Procesando...",bulkCreditTitle:"Crédito Masivo a Todos los Usuarios",bulkCreditDesc:"Agregue créditos a todos los usuarios a la vez. Esto acreditará a cada usuario en el sistema con la cantidad especificada.",bulkCreditSuccess:"Crédito Masivo Exitoso",bulkCreditSuccessDesc:"Acreditados {{successCount}} de {{totalUsers}} usuarios ({{failCount}} fallidos)",bulkCreditError:"Error de Crédito Masivo",bulkCreditErrorDesc:"Error al acreditar usuarios",bulkCreditPlaceholder:"Razón del crédito masivo (obligatorio)",bulkCreditButton:"Acreditar a Todos los Usuarios",broadcastTitle:"Mensaje de Difusión",broadcastDesc:"EnvÃe un mensaje a todos los usuarios a la vez. Cada usuario recibirá este mensaje en su bandeja de entrada.",broadcastSuccess:"Mensaje de Difusión Enviado",broadcastSuccessDesc:"Enviado a {{successCount}} de {{totalRecipients}} usuarios ({{failCount}} fallidos)",broadcastError:"Error de Difusión",broadcastErrorDesc:"Error al enviar el mensaje de difusión",broadcastLabel:"Contenido del Mensaje",broadcastPlaceholder:"Escriba su mensaje de difusión aquÃ...",broadcastButton:"Enviar a Todos los Usuarios",sending:"Enviando...",exportMembers:"E
746xportar Registro de Socios (CSV)",exportMembersDesc:"Descarga el registro completo de socios en formato CSV"},$Ee={type:"Tipo",typeAll:"Todos los Tipos",typeTransfer:"Transferencia",typeAdminCredit:"Crédito de Administrador",date:"Fecha",startDate:"Fecha de Inicio",endDate:"Fecha de Fin",amount:"Cantidad",minAmount:"Cantidad MÃnima",maxAmount:"Cantidad Máxima",description:"Descripción",from:"De",to:"Para",createdBy:"Creado Por",noTransactions:"Aún no hay transacciones",noTransactionsDesc:"Tu historial de transacciones aparecerá aquà una vez que comiences a transferir créditos.",history:"Historial de Transacciones",you:"Tú",system:"Sistema",searchPlaceholder:"Buscar transacciones..."},qEe={unauthorized:"No Autorizado",unauthorizedDesc:"Has cerrado sesión. Iniciando sesión de nuevo...",unauthorizedLogin:"Por favor, inicia sesión nuevamente para continuar.",accessDenied:"Acceso Denegado",accessDeniedDesc:"No tienes privilegios de administrador.",transferSuccess:"Transferencia exitosa",transferSuccessDesc:"Los créditos se han transferido exitosamente.",transferError:"Transferencia fallida",transferErrorDesc:"Error al transferir créditos. Por favor, inténtalo de nuevo.",creditSuccess:"Créditos agregados",creditSuccessDesc:"Los créditos se han agregado a la billetera del usuario exitosamente.",creditError:"Error al agregar créditos",creditErrorDesc:"Error al agregar créditos. Por favor, inténtalo de nuevo.",walletUpdateSuccess:"Billetera actualizada",walletUpdateSuccessDesc:"El nombre de tu billetera se ha actualizado exitosamente.",walletUpdateError:"Error",walletUpdateErrorDesc:"Error al actualizar el nombre de la billetera",donationFailed:"Donación Fallida",donationFailedDesc:"No se pudo procesar la donación",invalidAmount:"Cantidad Inválida",invalidAmountDesc:"Por favor, ingresa una cantidad de donación válida",upgradeFailed:"Actualización Fallida",upgradeFailedDesc:"No se pudo iniciar el proceso de actualización",error:"Error",success:"Ãxito",fetchError:"No se pudo cargar",sendError:"No se pudo enviar el mensaje",loadingMessages:"Cargando mensajes...",loadingOrders:"Cargando pedidos...",typeMessage:"Escribe tu mensaje...",userFallback:"Usuario",broadcastNoReply:"Este es un mensaje de difusión - no se permiten respuestas",broadcastHistory:"Historial de Difusiones",messageSent:"mensaje enviado",messagesSent:"mensajes enviados",sentTo:"enviado a",recipients:"destinatarios",upgradeCancelled:"Actualización Cancelada",upgradeCancelledDesc:"Tu actualización profesional fue cancelada.",thankYou:"¡Gracias!",donationSuccess:"Tu donación ayuda a apoyar nuestra plataforma comunitaria.",donationCancelled:"Donación Cancelada",donationCancelledDesc:"Tu donación fue cancelada.",categoryPlaceholder:"CategorÃa",promotedToAdmin:"Promovido a administrador",demotedFromAdmin:"Degradado de administrador",failedToUpdateRole:"Error al actualizar el rol"},HEe={defaultName:"Usuario",fetchError:"Error al obtener las transacciones"},GEe={title:"Completa Tu Perfil",subtitle:"Completa la información requerida para comenzar a usar tu billetera",editTitle:"Editar Perfil",editSubtitle:"Actualiza tu información personal",welcomeTitle:"¡Bienvenido!",welcomeMessage:"Completa tu perfil para usar el servicio",completeNow:"Completar Ahora",firstName:"Nombre",firstNamePlaceholder:"Juan",lastName:"Apellido",lastNamePlaceholder:"GarcÃa",phone:"Teléfono",phonePlaceholder:"+34 123 456 789",address:"Dirección",addressPlaceholder:"Calle Mayor 123",city:"Ciudad",cityPlaceholder:"Madrid",dateOfBirth:"Fecha de Nacim
746iento",profession:"Profesión",professionPlaceholder:"ej. Ingeniero, Médico, Profesor",bio:"Sobre mÃ",bioPlaceholder:"Cuéntanos sobre ti, tus habilidades, intereses y lo que ofreces a la comunidad...",website:"Sitio Web (opcional)",websitePlaceholder:"https://tusitio.com",saveProfile:"Guardar Perfil",updateProfile:"Actualizar Perfil",updating:"Actualizando...",successTitle:"Perfil actualizado",successDesc:"Tu información ha sido guardada exitosamente.",errorTitle:"Error",errorDesc:"Error al actualizar el perfil. Por favor, inténtalo de nuevo.",userProfile:"Perfil de Usuario",noAdditionalInfo:"No hay información adicional disponible",userNotFound:"Usuario no encontrado",email:"Correo Electrónico",adminStatus:"Estado de Administrador",isAdmin:"Administrador",notAdmin:"Usuario Estándar"},WEe={titleMin:"El tÃtulo debe tener al menos 5 caracteres",descMin:"La descripción debe tener al menos 20 caracteres",validUrl:"Debe ser una URL válida",priceRequired:"Al menos un precio (euros o créditos) debe estar establecido",hybridPricing:"Al usar precios hÃbridos, los créditos deben ser al menos el 20% del valor total",creditsRequired:"Los créditos CEI son obligatorios para todos los anuncios (100% créditos o precio hÃbrido)",creditsMinimum:"Al usar precios hÃbridos, los créditos deben ser al menos el 20% del valor total"},KEe={marker:"marcador",markers:"marcadores",listing:"anuncio",listings:"anuncios",user:"usuario",users:"usuarios",onMap:"en el mapa",totalMembers:"miembros totales",legend:"Leyenda",professionalListing:"Anuncio Profesional",privateListing:"Anuncio Privado",professionalUser:"Usuario Profesional",privateUser:"Usuario Privado",contactSeller:"Contactar Vendedor",sendMessage:"Enviar Mensaje",noUsers:"No hay usuarios en el mapa",noUsersDescription:"Actualmente no hay usuarios con datos de ubicación para mostrar.",viewListings:"Ver Anuncios",viewProfile:"Ver Perfil",viewStore:"Ver Tienda",viewAll:"Ver Todos",centerOnMe:"Centrar en mÃ",searchUser:"Buscar usuario...",noSearchResults:"Ningún usuario encontrado",completeProfileFirst:"Completa el perfil para habilitar",noLocationTitle:"Ubicación Faltante",noLocationDesc:"Completa tu perfil con dirección y ciudad para usar esta función",invalidCoordsTitle:"Coordenadas Inválidas",invalidCoordsDesc:"Tus coordenadas están corruptas. Actualiza tu perfil para corregir"},ZEe={title:"Sistema de Referidos",heroTitle:"Invita Amigos y Gana Créditos CEI",heroDescription:"Comparte tu enlace de referidos y recibe 20 créditos CEI por cada amigo que se registre. ¡Tu amigo recibirá 10 créditos bonus adicionales!",friendsInvited:"Amigos Invitados",creditsEarned:"Créditos Ganados",yourCode:"Tu Código",shareLink:"Comparte Tu Enlace de Referidos",shareLinkDesc:"Copia y comparte este enlace con tus amigos para invitarlos a la plataforma",copy:"Copiar",copied:"¡Copiado!",copiedDesc:"Enlace de referidos copiado al portapapeles",copyError:"Error al copiar el enlace",yourReferrals:"Tus Referidos",yourReferralsDesc:"Personas que se registraron a través de tu enlace",noReferrals:"Aún no has invitado a nadie",joinedOn:"Se unió el {{date}}",active:"Activo",emailSubject:"Ãnete a la Comunidad Económica Independiente",emailBody:"¡Hola! Te invito a unirte a la plataforma CEI. RegÃstrate con mi enlace y recibe 10 créditos bonus: {{link}}",whatsappMessage:"¡Hola! Te invito a unirte a la plataforma CEI. Recibe 10 créditos bonus registrándote con mi enlace: {{link}}",telegramMessage:"Ãnete a la plataforma CEI y recibe 10 créditos bonus"},XEe={browse:"explorar archivos",dropPasteFiles:"Arrastra archivos aquÃ, pega o %{browse}",dropHint:"Arrastra tus archivos aquÃ",uploading:"Subiendo...",complete:"Subida completa",failed:"Error al subir",uploadImages:"Subir Imágenes",uploadVideo:"Subir Video",imagesUploaded:"{{count}} imagen(es) subida(s)",videoUploaded:"1 video subido",uploadSuccess:"Ãxito",uploadSuccessDesc:"{{count}} imagen(es) subida(s) con éxito",videoUploadSuccess:"Video subido con éxito",professionalLimit:"Los usuarios profesionales pueden subir hasta 10 imágenes y 1 video por anuncio",freeLimit:"Los usuarios gratuitos pueden subir hasta 3 imágenes por anuncio"},YEe={opportunities:{title:"Oportunidades de Voluntariado",subtitle:"Contribuye a la comunidad y gana créditos CEI",available:"oportunidades",noResults:"No se encontraron oportunidades",tryDifferentFilters:"Intenta modificar los filtros de búsqueda"},myApplications:"Mis Solicitudes",myRequests:"Mis Peticiones",search:"Buscar oportunidades...",allCities:"Todas las ciudades",viewListing:"Ver Anuncio",accept:"Aceptar",confirmService:"Confirmar Servicio",confirmServiceTitle:"Confirmar Finalización",confirmServiceDescription:"¿Confirmas que el servicio ha sido completado? El voluntario recibirá automáticamente la compensación en créditos CEI.",confirmAndPay:"Confirmar y Pagar",applicationSent:"Solicitud enviada",applicationSentDesc:"El solicitante revisará tu solicitud",applicationError:"No se puede enviar la solicitud",applicationAccepted:"Solicitud aceptada",volunteerNotified:"El voluntario ha sido notificado",acceptError:"No se puede aceptar la solicitud",serviceConfirmed:"Servicio confirmado",paymentProcessed:"El pago ha sido procesado",confirmError:"No se puede confirmar el servicio",browseOpportunities:"Explorar Oportunidades",createRequest:"Nueva Petición",pen
746ding:"Pendientes",active:"Activas",completed:"Completadas",noPendingRequests:"No hay solicitudes pendientes",noActiveRequests:"No hay peticiones activas",noCompletedRequests:"No hay peticiones completadas",requests:{subtitle:"Gestionar solicitudes recibidas"},requestDetails:"Detalles de Solicitud de Voluntariado",compensation:"Compensación en Créditos CEI",compensationDesc:"Cuántos créditos CEI recibirá el voluntario al completar el servicio. La plataforma pagará este monto.",recurringService:"Servicio Recurrente",recurringServiceDesc:"¿Es una oportunidad de voluntariado única o recurrente?",maxVolunteers:"Máximo de Voluntarios",maxVolunteersDesc:"¿Cuántos voluntarios pueden ayudar con esta solicitud? Deja vacÃo para ilimitado.",compensationRequired:"La compensación en créditos CEI es obligatoria para las solicitudes de voluntariado (mÃnimo 1 CEI)"},QEe={backToHome:"Volver al Inicio",heroTitle:"Bienvenidos a la Comunidad Económica Independiente",heroSubtitle:"Una EconomÃa Solidaria para Fortalecer Nuestras Comunidades",philosophyTitle:"Comprender el Dinero: Una Revolución Cultural",philosophyText1:"El dinero es simplemente una representación de la riqueza, no la riqueza misma. Si la riqueza es creada por nuestras manos, nuestro trabajo, nuestras habilidades, ¿por qué su representación deberÃa ser propiedad de bancos centrales privados?",philosophyText2:"Los Créditos CEI son nuestra respuesta: una Unidad de Cuenta que no se compra ni se vende. Los créditos se ganan solo mediante el HACER a favor del bien común: ofreciendo productos, servicios, habilidades a la comunidad, o contribuyendo con acciones de voluntariado certificadas.",featuresTitle:"Cómo Funciona la Plataforma CEI",freeUsersTitle:"Para todos los usuarios:",freeFeature1:"Billetera personal con gestión de créditos CEI",freeFeature2:"Marketplace comunitario para intercambiar bienes y servicios",freeFeature3:"Precios hÃbridos: 100% créditos CEI o euros + créditos (mÃnimo 20% en créditos)",freeFeature4:"Mapa interactivo para descubrir ofertas en tu zona y más allá",freeFeature5:"MensajerÃa para contactar vendedores y compradores",freeFeature6:"Perfil público para presentar tu actividad",proUsersTitle:"Para usuarios profesionales (â¬50/año):",proFeature1:"Hasta 50 escaparates con 10 fotos + 1 video cada uno",proFeature2:'Insignia "Profesional" para mayor visibilidad',proFeature3:"Soporte prioritario de la comunidad",benefitsTitle:"Los Beneficios de Participar",benefitsIntro:"Recuperar la confianza mutua en un ambiente protegido y solidario, donde:",benefit1:"Las relaciones económicas se basan en la cooperación, no en la competencia",benefit2:"Las comunidades locales se fortalecen a través de intercambios territoriales",benefit3:"Cada contribución al bien común es reconocida y retribuida en créditos",benefit4:"La riqueza circula dentro de la red, sin intermediarios financieros",benefit5:"Las comunidades aisladas se conectan en una red solidaria nacional",gettingStartedTitle:"Comienza Ahora",step1:"Completa tu perfil con ciudad y habilidades",step2:"Recibe tu bono de bienvenida en créditos CEI",step3:"Crea tu primer escaparate o explora el marketplace",step4:"Intercambia con confianza en tu comunidad territorial y más allá",closingStatement:"CEI es más que una plataforma: es una manera de reapropiarnos de nuestra riqueza y construir juntos una economÃa al servicio de las personas, no del beneficio.",getStartedButton:"Comenzar Ahora",bannerText:"EconomÃa solidaria ⢠Comunidades territoriales ⢠Créditos que se ganan, no se compran",learnMore:"Saber Más"},JEe={backToMarketplace:"Volver al Marketplace",heroTitle:"Preguntas Frecuentes",heroSubtitle:"Todo lo que necesitas saber para utilizar la plataforma CEI",bannerText:"¿Tienes preguntas? Consulta las FAQ",gettingStartedTitle:"Primeros Pasos",q1:"¿Cómo me registro en la plataforma?",a1:"Haz clic en 'Acceder' y sigue el proceso de autenticación con Replit. Después del primer acceso, completa tu perfil ingresando nombre, apellido, ciudad y una breve descripción de ti o de tu actividad.",q2:"¿Recibo créditos cuando me registro?",a2:"¡SÃ! Cada nuevo usuario recibe un bono de bienvenida en créditos CEI al completar el perfil. Esto te permite empezar inmediatamente a explorar el marketplace y hacer tus primeras compras.",q3:"¿Cómo completo mi perfil?",a3:"Ve a tu Panel de Control y haz clic en 'Editar Perfil'. Completa todos los campos requeridos: nombre, apellido, ciudad y descripción. La ciudad es obligatoria porque sirve para posicionarte en el mapa interactivo del marketplace.",listingsTitle:"Crear y Gestionar Anuncios",q4:"¿Cómo creo un anuncio?",a4:"Desde el Panel de Control, haz clic en 'Crear Anuncio'. Ingresa tÃtulo, descripción, categorÃa, precio en euros y créditos CEI (al menos el 20% debe estar en créditos), tu ciudad, y sube las fotos. Los usuarios gratuitos pueden subir hasta 3 fotos, los profesionales hasta 10 fotos + 1 video.",q5:"¿Puedo vender solo en euros sin créditos CEI?",a5:"No. La plataforma CEI requiere que TODOS los anuncios incluyan créditos CEI en el precio. Puedes vender al 100% en créditos CEI, o crear un precio hÃbrido (euros + créditos) con al menos el 20% en créditos CEI.",q6:"¿Cuántos anuncios puedo crear?",a6:"Los usuarios gratuitos no tienen lÃmites en el número de anuncios, pero solo pueden subir 3 fotos por anuncio. Los usuarios profesionales (â¬50/año) pueden crear hasta 50 anuncios con 10 fotos + 1 video cada uno.",q7:"¿Cómo modifico o elimino un anuncio?",a7:"Ve al Panel de Control, haz clic en 'Mis Anuncios', encuentra el anuncio que quieres modificar y haz clic en el icono de edición. Para eliminar un anuncio, haz clic en el icono de papelera. Atención: la eliminación es permanente.",creditsTitle:"Créditos CEI",q8:"¿Qué son los créditos CEI?",a8:"Los créditos CEI son una Unidad de Cuenta que representa el valor del trabajo, las habilidades y las contribuciones a la comunidad. No se compran ni se venden - se ganan solo ofreciendo bienes, servicios o contribuciones de voluntariado certificadas.",q9:"¿Cómo puedo ganar créditos CEI?",a9:"Puedes ganar créditos CEI de tres maneras: 1) Vendiendo productos o servicios a través del marketplace, 2) Recibiendo transferencias de otros usuarios, 3) Participando en actividades de voluntariado certificadas por la comunidad. Los administradores también pueden asignar créditos por contribuciones especiales.",q10:"¿Puedo convert
746ir los créditos CEI en euros?",a10:"No. Los créditos CEI no son convertibles a euros. Están diseñados para circular dentro de la red CEI como herramienta de intercambio comunitario. Puedes usarlos para comprar bienes y servicios de otros miembros de la comunidad.",professionalTitle:"Cuenta Profesional",q11:"¿Cuáles son las ventajas de la cuenta profesional?",a11:"La cuenta profesional (â¬50/año) te permite: crear hasta 50 escaparates, subir 10 fotos + 1 video por anuncio, obtener una insignia 'Profesional' visible en tus anuncios, una Página de Tienda personal con imagen de portada personalizable, recibir soporte prioritario de la comunidad y acceder a funcionalidades avanzadas.",q12:"¿Cómo me convierto en usuario profesional?",a12:"Contacta al administrador de la plataforma para solicitar la actualización a Profesional (â¬50/año). La actualización es inmediata y dura un año entero.",storeTitle:"Página de Tienda",q24:"¿Qué es la Página de Tienda?",a24:"La Página de Tienda es un escaparate personal disponible para usuarios profesionales. Es una página dedicada donde los clientes pueden ver todos tus anuncios en un solo lugar, con tu foto de perfil, profesión, ciudad y una imagen de portada personalizable.",q25:"¿Cómo accedo a mi Página de Tienda?",a25:"Tu Página de Tienda tiene una URL dedicada como: comunitaeconomicaindipendente.it/store/[tu-id]. Los clientes también pueden acceder haciendo clic en el botón 'Visitar mi tienda' en todos tus anuncios. Puedes compartir este enlace en redes sociales o en tus materiales promocionales.",q26:"¿Cómo personalizo la portada de mi tienda?",a26:"Ve a 'Editar Perfil' desde el Panel de Control. En la sección para usuarios profesionales, encontrarás 'Portada de Tienda'. Sube una imagen (recomendado 1200x400px, máx 5MB) que represente tu negocio. Esta aparecerá en la parte superior de tu Página de Tienda.",q27:"¿Los clientes pueden contactarme desde la Página de Tienda?",a27:"Desde la Página de Tienda, los clientes pueden ver todos tus anuncios y hacer clic en cada uno para los detalles. Desde ahà pueden contactarte a través del sistema de mensajerÃa de la plataforma. La Página de Tienda también muestra tu sitio web (si lo agregaste a tu perfil) como enlace clicable.",safetyTitle:"Comunicación y Seguridad",q13:"¿Cómo contacto a un vendedor?",a13:"Haz clic en el botón 'Contactar' en el anuncio o en el mapa interactivo. Se abrirá el chat interno donde puedes enviar mensajes en tiempo real. Todas las conversaciones son privadas y seguras.",q14:"¿Cómo funciona el pago?",a14:"Los pagos en EUROS ocurren EXTERNAMENTE a la plataforma - tú y el vendedor acuerdan el método (transferencia bancaria, efectivo, etc). Los pagos en créditos CEI ocurren directamente en la plataforma: cuando confirmas la compra, los créditos se transfieren automáticamente de tu billetera a la del vendedor.",referralTitle:"Programa de Referidos",q15:"¿Qué es el programa de referidos?",a15:"El programa de referidos te permite invitar amigos a la plataforma CEI. Cuando alguien se registra usando tu enlace personal, ambos reciben créditos bonus: tú obtienes 20 créditos CEI como agradecimiento, y tu amigo recibe 10 créditos bonus para empezar.",q16:"¿Cómo encuentro mi enlace de referido?",a16:"Ve a la página 'Sistema de Referidos' desde tu Panel de Control. Encontrarás tu código personal y un enlace único para compartir. Puedes copiar el enlace y compartirlo por WhatsApp, Telegram, email o cualquier otro canal que prefieras.",q17:"¿Cuántas personas puedo invitar?",a17:"¡No hay lÃmite! Puedes invitar a tantas personas como quieras. Por cada amigo que se registre y complete su perfil usando tu enlace, recibirás 20 créditos CEI. Cuantas más personas invites, más créditos ganarás.",q18:"¿Cómo se rastrean mis referidos?",a18:"El sistema usa una cookie que dura 30 dÃas. Cuando alguien hace clic en tu enlace, tu código se guarda. Si se registra en los siguientes 30 dÃas, serás reconocido como referente. Puedes ver todos tus referidos y créditos ganados en la página dedicada.",volunteerTitle:"Servicios de Voluntariado",q19:"¿Qué son los Servicios de Voluntariado?",a19:"Los Servicios de Voluntariado son una categorÃa especial de anuncios donde los miembros de la comunidad pueden solicitar ayuda para actividades de interés común. Quienes responden y completan el servicio son pagados por la propia plataforma en créditos CEI, no por el solicitante.",q20:"¿Cómo funciona el pago para voluntarios?",a20:"Cuando un voluntario completa un servicio, la plataforma CEI paga automáticamente créditos CEI directamente a su billetera. El monto es establecido por quien crea el anuncio de voluntariado (mÃnimo 1 crédito CEI). Este pago viene de la reserva de la plataforma, no del solicitante del servicio. Es una forma de recompensar a quienes contribuyen a la comunidad.",q21:"¿Cómo puedo postularme para un servicio de voluntariado?",a21:"Busca anuncios en la categorÃa 'Servicios de Voluntariado' en el marketplace. Cuando encuentres una oportunidad interesante, haz clic en 'Postularse' para enviar tu disponibilidad. El solicitante recibirá una notificación y podrá aceptar tu postulación.",q22:"¿Cuáles son los estados de una asignación de voluntariado?",a22:"El flujo es: 1) 'Postulado' - has enviado tu disponibilidad, 2) 'Aceptado' - el solicitante confirmó, 3) 'Servicio Completado' - has terminado la actividad, 4) 'Confirmado' - el solicitante confirma y recibes los créditos. Si el servicio no funciona, puede ser 'Rechazado' o 'Cancelado'.",q23:"¿Puedo crear solicitudes de voluntariado?",a23:"¡SÃ! Ve a 'Crear Anuncio' y selecciona la categorÃa 'Servicios de Voluntariado'. Describe la actividad para la que necesitas ayuda (ej., ayuda con mudanza, clases particulares, acompañamiento) e indica cuántos créditos CEI recibirá el voluntario como compensación (mÃnimo 1 crédito). Los voluntarios interesados se postularán y podrás elegir a quién aceptar. Recuerda: la plataforma pagará al voluntario, no tú.",voucherTitle:"Campañas de Voucher",q28:"¿Qué son las campañas de voucher?",a28:"Las campañas de voucher son un sistema para distribuir créditos CEI bonus durante eventos de la comunidad. El administrador crea un código voucher con un monto especÃfico, y los participantes en los eventos pueden canjearlo para recibir créditos extra en su billetera.",q29:"¿Cómo canjeo un código voucher?",a29:"En tu Panel de Control encontrarás la sección 'Canjear Voucher'. Ingresa el código que recibiste durante el evento y haz clic en 'Canjear'. Los créditos bonus se añadirán
746inmediatamente a tu billetera. Cada voucher solo puede canjearse una vez por usuario.",q30:"¿Cómo obtengo un código voucher?",a30:"Los códigos voucher se distribuyen durante los eventos de la comunidad CEI. Participa en reuniones, asambleas y actividades organizadas por la comunidad para recibir los códigos. Los vouchers pueden tener fecha de caducidad y un número máximo de usos, asà que canjéalos lo antes posible.",mapTitle:"Mapa Interactivo",q31:"¿Cómo funciona el mapa interactivo?",a31:"El mapa muestra a todos los miembros de la comunidad CEI con un marcador en su ubicación. Puedes hacer clic en cada marcador para ver el perfil del usuario, sus anuncios y contactarlo directamente. Los usuarios profesionales tienen un marcador diferente para distinguirlos.",q32:"¿Cómo aparezco en el mapa?",a32:"Para aparecer en el mapa debes completar tu perfil ingresando tu ciudad y dirección. El sistema calcula automáticamente las coordenadas desde tu ubicación. Si notas que tu posición no es precisa, intenta guardar tu perfil nuevamente con una dirección más detallada.",stillNeedHelp:"¿No encuentras lo que buscas?",contactSupport:"Contactar Soporte"},e2e={bannerText:"¿Nuevo? Descubre cómo registrarte",bannerCta:"GuÃa paso a paso",backToMarketplace:"Volver al Marketplace",heroTitle:"GuÃa de Registro",heroSubtitle:"Sigue estos 8 simples pasos para crear tu cuenta CEI",timeEstimate:"Tiempo estimado: 3-5 minutos",beforeYouStart:"Antes de empezar, asegúrate de tener:",requirement1:"Una dirección de email válida a la que puedas acceder",requirement2:"Unos minutos para completar el registro",requirement3:"Tus datos personales (nombre, apellido, ciudad)",tipLabel:"Consejo:",step1Title:'Haz clic en "Acceder"',step1Desc:`Desde la página principal del marketplace CEI, encuentra el botón "Acceder" en la esquina superior derecha. 747 748Haz clic en el botón para iniciar el proceso de registro.`,step1Tips:"Si estás en smartphone, el botón puede estar en el menú hamburguesa (las tres lÃneas horizontales).",step2Title:'Elige "Continue with email"',step2Desc:`Se abrirá una ventana de Replit (el sistema que gestiona las cuentas). 749 750Haz clic en "Continue with email" (Continuar con email), luego ingresa tu dirección de email y elige una contraseña.`,step2Tips:"Usa un email que revises regularmente. Elige una contraseña segura que recordarás.",step3Title:"Verifica el Código Email",step3Desc:`Replit enviará un código de verificación de 6 dÃgitos a tu email. 751 752Abre tu bandeja de entrada, encuentra el email de Replit (revisa también spam/correo no deseado), copia el código y pégalo en la ventana de Replit.`,step3Tips:'El código expira después de unos minutos. Si no llega, haz clic en "Resend code" para recibirlo de nuevo.',step4Title:"Crea tu Cuenta Replit",step4Desc:`Si es la primera vez que usas Replit, se te pedirá: 753
754⢠Crear un nombre de usuario 755⢠Completar algunos campos opcionales (profesión, qué quieres hacer, etc.) 756 757Estos formularios son de Replit, no de CEI. Puedes completarlos rápidamente u omitirlos si es posible.`,step4Tips:"Elige un nombre de usuario simple. Los campos adicionales (profesión, proyectos) son para Replit y no afectan tu cuenta CEI.",step5Title:"Autoriza el Acceso a CEI",step5Desc:`Replit te pedirá autorizar el acceso a la plataforma CEI. 758 759Haz clic en "Authorize" (Autorizar) para permitir que CEI lea tu información básica (email y nombre de usuario).`,step5Tips:"Esta autorización es segura. CEI nunca tendrá acceso a tu contraseña de Replit.",step6Title:"Completa tu Perfil CEI",step6Desc:`¡Ahora estás en la plataforma CEI! Aparecerá un formulario para completar tu perfil. 760 761Ingresa: 762⢠Nombre y Apellido 763⢠Número de teléfono 764⢠Tu profesión o actividad`,step6Tips:"Completa todos los campos con atención. Esta información ayudará a otros usuarios a conocerte.",step7Title:"Añade tu Ubicación",step7Desc:`Ingresa tu dirección completa y ciudad. Estos datos son esenciales para: 765 766⢠Aparecer en el mapa del marketplace 767⢠Ser encontrado por quienes buscan servicios en tu zona 768⢠Encontrar ofertas cerca de ti 769 770Nuestra comunidad se basa en la confianza y la transparencia.`,step7Tips:"Una dirección precisa ayuda a otros miembros de la comunidad a encontrarte fácilmente.",step8Title:"¡Guarda y Empieza!",step8Desc:`Haz clic en "Guardar Perfil" para completar el registro. 771 772¡Felicidades! Has creado tu cuenta CEI y recibido tus primeros créditos de bienvenida!`,step8Tips:"Ahora puedes explorar el marketplace, crear anuncios y empezar a usar tus créditos CEI.",completedTitle:"¡Registro Completado!",completedDesc:"Una vez completados todos los pasos, tendrás acceso completo a la plataforma CEI:",benefit1:"Créditos de bienvenida en tu billetera",benefit2:"Posibilidad de crear anuncios en el marketplace",benefit3:"Chat para contactar vendedores y compradores",benefit4:"Acceso al programa de referidos para invitar amigos",readyToStart:"¿Listo para empezar?",startButton:"Ir al Marketplace y Registrarse",needHelp:"¿Aún tienes dudas?",checkFaq:"Consulta las FAQ"},t2e={redeemTitle:"Canjear Voucher",redeemDescription:"Ingresa un código voucher para recibir créditos CEI bonus",enterCode:"Ingresa código voucher...",redeem:"Canjear",congratulations:"¡Felicidades!",redeemSuccess:"¡Has recibido {{amount}} créditos CEI bonus!",title:"Campañas de Voucher",subtitle:"Crea y gestiona campañas de voucher para eventos comunitarios",create:"Crear Voucher",edit:"Editar Voucher",createDesc:"Configura un nuevo código voucher para distribución comunitaria",editDesc:"Actualizar configuración del voucher",noVouchers:"Sin campañas de voucher",createFirst:"Crea tu primera campaña de voucher",active:"Activo",inactive:"Inactivo",scheduled:"Programado",expired:"Expirado",newUsersOnly:"Solo Nuevos Usuarios",existingUsersOnly:"Solo Usuarios Existentes",allUsers:"Todos los Usuarios",code:"Código",description:"Descripción",descriptionPlaceholder:"Describe esta campaña de voucher...",bonusType:"Tipo de Bonus",fixed:"Monto Fijo",multiplier:"Multiplicador",bonusValue:"Valor del Bonus",targetAudience:"Público Objetivo",startsAt:"Fecha de Inicio",endsAt:"Fecha de Fin",maxRedemptions:"Usos Máximos",unlimited:"Ilimitado",isActive:"Activo",redemptions:"Usos",totalDistributed:"Total Distribuido",sendBroadcast:"Enviar Difusión",broadcastDesc:"Enviar código voucher {{code}} a todos los usuarios",broadcastTemplate:"¡Bonus especial! Usa el código {{code}} para recibir {{bonus}} créditos!",message:"Mensaje",send:"Enviar",errors:{notFound:"Código voucher no encontrado",inactive:"Este voucher ya no está activo",notStarted:"Este voucher aún no es válido",expired:"Este voucher ha expirado",newUsersOnly:"Este voucher es solo para nuevos usuarios",existingUsersOnly:"Este voucher es solo para usuarios existentes",maxRedemptionsReached:"Este voucher ha alcanzado su máximo de usos",alreadyRedeemed:"Ya has canjeado este voucher",generic:"No se pudo canjear el voucher. Inténtalo de nuevo"},admin:{title:"Campañas de Voucher",description:"Crea y gestiona campañas de voucher para eventos comunitarios",createNew:"Crear Voucher",noVouchers:"Sin campañas de voucher",noVouchersDesc:"Crea tu primera campaña para distribuir créditos bonus en eventos",code:"Código",name:"Nombre de Campaña",namePlaceholder:"ej., Evento Verano 2025",bonusType:"Tipo de Bonus",bonusTypeFixed:"Monto Fijo",bonusTypeMultiplier:"Multiplicador",bonusAmount:"Monto del Bonus",bonusMultiplier:"Multiplicador (ej., 1.5 = 50% extra)",targetAudience:"Público Objetivo",targetAll:"Todos los Usuarios",targetNewUsers:"Solo Nuevos Usuarios",targetExistingUsers:"Solo Usuarios Existentes",maxRedemptions:"Usos Máximos (0 = ilimitado)",startDate:"Fecha de Inicio",endDate:"Fecha de Fin",active:"Activo",inactive:"Inactivo",redemptions:"Usos",created:"Creado",actions:"Acciones",edit:"Editar",toggleStatus:"Cambiar Estado",delete:"Eliminar",deleteConfirm:"¿Eliminar esta campaña de voucher?",deleteDesc:"Esta acción no se puede deshacer. Todos los datos de uso se perderán.",createSuccess:"Campaña de voucher creada exitosamente",updateSuccess:"Campaña de voucher actualizada exitosamente",deleteSuccess:"Campaña de voucher eliminada",statusUpdated:"Estado del voucher actualizado",error:"Ocurrió un error",broadcast:"Difundir",broadcastTitle:"Difundir Código Voucher",broadcastDesc:"Enviar el código voucher a todos los usuarios por mensaje del sistema",broadcastMessage:"Contenido del Mensaje",broadcastMessagePlaceholder:"Escribe un mensaje para acompañar el código voucher...",broadcastSend:"Enviar a Todos los Usuarios",broadcastSuccess:"Código voucher difundido exitosamente",statistics:"EstadÃsticas",totalRedemptions:"Usos Totales",creditsDistributed:"Créditos Distribuidos"}}
772,i2e={academy:{title:"GalerÃa de Videos",subtitle:"Descubre tutoriales, noticias y contenido educativo de nuestra comunidad",allVideos:"Todos",news:"Noticias",divulgazione:"Educativo",tutorial:"Tutorial",medicoAmico:"Médico Amigo","interviste-giraldi":"Entrevistas Prof. Giraldi","considerazioni-scientifiche":"Consideraciones CientÃficas",intervisteGiraldi:"Entrevistas Prof. Giraldi",considerazioniScientifiche:"Consideraciones CientÃficas",noVideos:"No hay videos disponibles",noVideosDesc:"Los videos estarán disponibles pronto",watchVideo:"Ver Video",duration:"Duración"},admin:{title:"Gestión de Videos",description:"Sube y gestiona los videos de la GalerÃa de Videos",createVideo:"Subir Nuevo Video",createVideoDesc:"Agregar un nuevo video a la GalerÃa de Videos",editVideo:"Editar Video",editVideoDesc:"Actualizar información del video",deleteVideo:"Eliminar Video",deleteVideoConfirm:'¿Estás seguro de que quieres eliminar el video "{{title}}"? Esta acción no se puede deshacer.',noVideos:"No hay videos subidos",videoFile:"Archivo de Video",thumbnail:"Imagen en Miniatura",titleField:"TÃtulo",titlePlaceholder:"TÃtulo del video...",descriptionField:"Descripción",descriptionPlaceholder:"Descripción del video...",category:"CategorÃa",duration:"Duración (segundos)",durationPlaceholder:"ej., 120",durationHint:"Duración en segundos",featuredOrder:"Orden Destacado",orderHint:"Los números más bajos aparecen primero",published:"Publicado",featured:"Destacado",draft:"Borrador",noDescription:"Sin descripción",selectFile:"Seleccionar Archivo",selectImage:"Seleccionar Imagen",fileTooLarge:"El archivo es demasiado grande. Máximo {{max}}MB",uploadFailed:"Error al subir. Por favor intenta de nuevo",createSuccess:"Video subido exitosamente",updateSuccess:"Video actualizado exitosamente",deleteSuccess:"Video eliminado exitosamente",publish:"Publicar",unpublish:"Despublicar",feature:"Destacar",unfeature:"Quitar Destacado"}},n2e={dialogTitle:"Aceptación de la PolÃtica de Privacidad",dialogDesc:"Antes de usar la plataforma, por favor lee y acepta nuestra polÃtica de privacidad.",dataControllerTitle:"Responsable del Tratamiento",dataControllerText:"La Associazione Comunità Economica Indipendente es responsable del tratamiento de tus datos personales.",dataCollectedTitle:"Datos Recopilados",dataCollectedText:"Recopilamos datos personales como nombre, email, teléfono, dirección y datos de transacciones para proporcionar nuestros servicios.",purposeTitle:"Finalidad",purposeText:"Tus datos se utilizan para gestionar tu cuenta, permitirte publicar anuncios, realizar transacciones y comunicarte con otros usuarios.",rightsTitle:"Tus Derechos",rightsText:"Tienes derecho a acceder, rectificar, eliminar tus datos y oponerte al tratamiento. Contáctanos en [email protected]",readFullPolicy:"Leer la polÃtica de privacidad completa",acceptCheckbox:"He leÃdo y acepto la polÃtica de privacidad y autorizo el tratamiento de mis datos personales según el RGPD.",acceptButton:"Aceptar y Continuar",acceptedTitle:"Privacidad Aceptada",acceptedDesc:"Gracias por aceptar nuestra polÃtica de privacidad.",acceptError:"Error al aceptar. Por favor intenta de nuevo."},r2e={title:"Documentos",subtitle:"Privacidad, Código Ãtico y Reglamentos de la Comunidad",backToHome:"Volver al Inicio",noDocuments:"No hay documentos disponibles en este momento.",typePrivacy:"PolÃtica de Privacidad",typeEthics:"Código Ãtico",typeRegulations:"Reglamentos",typeOther:"Otros Documentos",view:"Ver",download:"Descargar"},s2e={sectionTitle:"Tarjeta de Socio CEI",title:"TARJETA DE SOCIO",download:"Descargar Tarjeta",number:"Tarjeta n.",birthDate:"Fecha de nacimiento",city:"Ciudad",memberSince:"Socio desde"},o2e={common:MEe,categories:DEe,header:REe,landing:jEe,marketplace:zEe,orders:LEe,myListings:OEe,createListing:FEe,listingDetail:BEe,dashboard:UEe,admin:VEe,transaction:$Ee,messages:qEe,user:HEe,profile:GEe,validation:WEe,map:KEe,referral:ZEe,upload:XEe,volunteer:YEe,about:QEe,faq:JEe,registrationGuide:e2e,voucher:t2e,video:i2e,privacy:n2e,documents:r2e,memberCard:s2e},a2e={loading:"Laden...",signIn:"Anmelden",signUp:"Registrieren",enter:"Eintreten",signOut:"Abmelden",getStarted:"Loslegen",cancel:"Abbrechen",save:"Speichern",edit:"Bearbeiten",send:"Senden",clear:"Löschen",clearAll:"Alles löschen",filters:"Filter",search:"Suchen",credits:"Guthaben",chooseLanguage:"Wählen Sie Ihre Sprache",dashboard:"Dashboard",backToDashboard:"Zurück zum Dashboard"},l2e={"Professional Services":"Professionelle Dienstleistungen","Home & Garden":"Haus und Garten","Health & Wellness":"Gesundheit und Wohlbefinden",Education:"Bildung",Technology:"Technologie","Creative Services":"Kreative Dienstleistungen","Food & Catering":"Essen und Catering",Transportation:"Transport","Volunteer Services":"Freiwilligendienst-Anfragen",Entertainment:"Unterhaltung","B&B, Hospital
772ity & Catering":"B&B, Gastgewerbe und Gastronomie","Present Your Project":"Präsentieren Sie Ihr Projekt","Free Services":"Kostenlose Dienste"},c2e={walletManager:"Wallet-Manager",adminDashboard:"Admin-Dashboard",myWallet:"Meine Wallet"},u2e={title:"Verwalten Sie Ihr Guthaben",subtitle:"Sicher und Effizient",description:"Eine professionelle Wallet-Management-Plattform zum Verfolgen und Ãbertragen von benutzerdefinierten Punkten und Guthaben. Einfach, sicher und für Teams entwickelt.",purchaseTitle:"Kaufen Sie mit Guthaben von CEI-registrierten Produzenten",feature1Title:"Eine Wallet Pro Benutzer",feature1Desc:"Jeder Benutzer erhält bei der Registrierung automatisch eine sichere Wallet. Sehen Sie Ihren Saldo und Ihre Transaktionshistorie auf einen Blick.",feature2Title:"Einfache Ãberweisungen",feature2Desc:"Ãbertragen Sie sofort Guthaben an andere Benutzer. Alle Transaktionen werden mit vollständiger Historie und Beschreibungen verfolgt.",feature3Title:"Admin-Steuerungen",feature3Desc:"Administratoren können Guthaben zu jeder Wallet hinzufügen, alle Benutzer anzeigen und die gesamte Plattform mit leistungsstarken Tools verwalten.",footer:"Sichere Guthaben-Management-Plattform."},d2e={communityName:"Unabhängige Wirtschaftsgemeinschaft",heroTitle:"Entdecken Sie lokale Dienstleistungen und unterstützen Sie Ihre Gemeinschaft",heroSubtitle:"Durchsuchen Sie Produkte und Dienstleistungen mit hybrider Preisgestaltung: Euro + CEI-Gemeinschaftsguthaben",searchPlaceholder:"Dienstleistungen, Produkte suchen...",cityPlaceholder:"Stadt",selectCategory:"Alle Kategorien",searchButton:"Suchen",viewMap:"Karte Anzeigen",supportProject:"Projekt Unterstützen",noListingsTitle:"Keine Anzeigen gefunden",noListingsDesc:"Versuchen Sie, Ihre Filter anzupassen",foundUsers:"Gefundene Profile",userFound:"Profil gefunden",usersFound:"Profile gefunden",featuredListings:"Hervorgehobene Anzeigen 100% CEI-Guthaben",loading:"Anzeigen werden geladen...",browseMarketplace:"Marketplace Durchsuchen",viewDetails:"Details Anzeigen",upgradeSuccessful:"Upgrade Erfolgreich!",upgradeSuccessfulDesc:"Sie sind jetzt ein professioneller Verkäufer. Willkommen!",donationTitle:"COMUNITA' ECONOMICA INDIPENDENTE Unterstützen",donationDesc:"Helfen Sie uns, die Plattform am Laufen zu halten und unsere Gemeinschaftsinitiativen zu unterstützen",donationChooseAmount:"Wählen Sie einen Betrag",donationCustomAmount:"Oder geben Sie einen benutzerdefinierten Betrag ein (â¬)",donationEnterAmount:"Betrag eingeben",donationProcessing:"Verarbeitung...",donateButton:"â¬{{amount}} Spenden",securePayment:"Sichere Zahlungsabwicklung von Stripe",upgradeTitle:"Auf Professionell Upgraden",upgradeDesc:"Schalten Sie Premium-Funktionen frei und lassen Sie Ihr Geschäft auf CEI Marketplace wachsen",upgradePerYear:"pro Jahr",upgradeIncluded:"Was ist enthalten:",upgradeFeature1:"Bis zu 50 Marketplace-Schaufenster",upgradeFeature2:"10 Fotos + 1 Video pro Anzeige",upgradeFeature3:"Prioritäts-Kundensupport",upgradeFeature4:"Professionelles Badge auf Ihren Anzeigen",upgradeFeature5:"Erweitertes Analyse-Dashboard",upgradeFeature6:"Hervorgehobene Platzierung in Suchergebnissen",upgradeButton:"Jetzt Upgraden",upgradeProcessing:"Verarbeitung...",authRequired:"Anmeldung Erforderlich",authRequiredDesc:"MELDEN SIE SICH KOSTENLOS AN, UM DIE DIENSTE ZU AKTIVIEREN",searchByCity:"Nach Stadt",searchByRadius:"Nach Radius",allSellers:"Alle",professionalOnly:"Nur Professionelle",privateOnly:"Nur Private",useMyLocation:"Meinen Standort verwenden",locationSet:"Standort festgelegt",locating:"Lokalisieren...",locationFound:"Standort gefunden"},h2e={title:"Meine Bestellungen",purchases:"Käufe",sales:"Verkäufe",noPurchases:"Noch keine Käufe",noPurchasesDesc:"Ihre Bestellungen als Käufer werden hier angezeigt",noSales:"Noch keine Verkäufe",noSalesDesc:"Ihre Bestellungen als Verkäufer werden hier angezeigt",pending:"Ausstehend",reserved:"Reserviert",completed:"Abgeschlossen",cancelled:"Storniert",expired:"Abgelaufen",seller:"Verkäufer",buyer:"Käufer",listing:"Anzeige",unknown:"Unbekannt",price:"Preis",status:"Status",orderDate:"Bestelldatum",expiresOn:"Läuft ab am",buyerNotes:"Käufer-Notizen",confirmOrder:"Bestellung Bestätigen",confirmReceipt:"Empfang Bestätigen",cancelOrder:"Bestellung Stornieren",contactCounterpart:"Kontaktieren",waitingBuyerConfirmation:"Warten auf Empfangsbestätigung des Käufers. Guthaben wird nach der Bestätigung übertragen.",confirmTitle:"Empfang bestätigen?",confirmDesc:"Bestätigen Sie den Erhalt des Services oder Produkts? Das Guthaben wird an den Verkäufer übertragen.",cancelTitle:"Diese Bestellung stornieren?",cancelDesc:"Reserviertes Guthaben wird an den Käufer zurückerstattet.",updating:"Aktualisierung...",orderUpdated:"Bestellung Aktualisiert",orderConfirmed:"Bestellung erfolgreich bestätigt.",orderCancelled:"Bestellung erfolgreich storniert.",updateFailed:"Aktualisierung Fehlgeschlagen",updateError:"Bestellstatus konnte nicht aktualisiert werden",manageYourOrders:"Verwalten Sie Ihre Bestellungen und Verkäufe"}
772,p2e={title:"Meine Anzeigen",createNew:"Neue Anzeige Erstellen",noListings:"Noch keine Anzeigen",noListingsDesc:"Ihre Anzeigen werden hier angezeigt, sobald Sie sie erstellen",active:"Aktiv",inactive:"Inaktiv",toggleActive:"Aktivieren/Deaktivieren",edit:"Bearbeiten",delete:"Löschen",deleteTitle:"Diese Anzeige löschen?",deleteDesc:"Diese Aktion kann nicht rückgängig gemacht werden. Die Anzeige wird dauerhaft entfernt.",deleting:"Löschen...",listingDeleted:"Anzeige Gelöscht",listingDeletedDesc:"Ihre Anzeige wurde erfolgreich entfernt.",deleteFailed:"Löschen Fehlgeschlagen",deleteError:"Anzeige konnte nicht gelöscht werden",statusUpdated:"Status Aktualisiert",statusUpdatedDesc:"Der Anzeigenstatus wurde geändert.",statusFailed:"Aktualisierung Fehlgeschlagen",statusError:"Anzeigenstatus konnte nicht aktualisiert werden"},f2e={createTitle:"Neue Anzeige Erstellen",editTitle:"Anzeige Bearbeiten",basicInfo:"Grundinformationen",basicInfoDesc:"Geben Sie die Hauptdetails Ihrer Anzeige ein",title:"Titel",titlePlaceholder:"z.B., Professionelle Webdesign-Beratung",description:"Beschreibung",descriptionPlaceholder:"Beschreiben Sie Ihr Produkt oder Ihre Dienstleistung im Detail...",category:"Kategorie",selectCategory:"Kategorie auswählen",pricing:"Preisgestaltung",pricingDesc:"Legen Sie Ihre Preise fest (mindestens einer erforderlich)",pricingOptionalDesc:"Für diese Kategorie ist der Preis optional. Sie können die Felder leer lassen.",clearPrices:"Preise löschen",priceEuros:"â¬-Anteil (min. 0% max 80%)",priceCredits:"CEI-Guthaben-Anteil (min. 20% max. 100%)",hybridPricingNote:"Bei Verwendung beider müssen Guthaben mindestens 20% des Gesamtwerts betragen",location:"Standort",locationDesc:"Fügen Sie Ihren Standort hinzu, um auf der Karte zu erscheinen",address:"Adresse",city:"Stadt",country:"Land",latitude:"Breitengrad",longitude:"Längengrad",imageUrl:"Bild-URL",imageUrlPlaceholder:"https://beispiel.com/bild.jpg",requiresContact:"Kontakt vorher erforderlich",requiresContactDesc:"Aktivieren, wenn der Käufer Sie vor der Bestellung kontaktieren muss (z.B. für GröÃe, Menge, Termine)",activeStatus:"Aktiv-Status",activeStatusDesc:"Diese Anzeige für Käufer sichtbar machen",saving:"Speichern...",createButton:"Anzeige Erstellen",updateButton:"Anzeige Aktualisieren",cancel:"Abbrechen",success:"Erfolg!",listingCreated:"Ihre Anzeige wurde erfolgreich erstellt.",listingUpdated:"Ihre Anzeige wurde erfolgreich aktualisiert.",error:"Fehler",createError:"Anzeige konnte nicht erstellt werden. Bitte versuchen Sie es erneut.",updateError:"Anzeige konnte nicht aktualisiert werden. Bitte versuchen Sie es erneut.",validationError:"Bitte überprüfen Sie das Formular auf Validierungsfehler"},m2e={professional:"Professionell",postedOn:"Veröffentlicht am",location:"Standort",price:"Preis",yourBalance:"Ihr Guthaben",aboutSeller:"Ãber den Verkäufer",viewProfile:"Profil Anzeigen",viewStore:"Vitrine Ansehen",description:"Beschreibung",placeOrder:"Bestellung Aufgeben",contactSeller:"Verkäufer Kontaktieren",interestedMessage:"Hallo! Ich interessiere mich für Ihre Anzeige: {{title}}",backToListings:"Zurück zu Anzeigen",orderPlaced:"Bestellung Aufgegeben!",orderPlacedDesc:"Ihre Bestellung wurde erstellt. Guthaben wurde reserviert.",insufficientCredits:"Unzureichendes Guthaben",insufficientCreditsDesc:"Sie haben nicht genug CEI-Guthaben für diese Bestellung.",orderFailed:"Bestellung Fehlgeschlagen",orderError:"Bestellung konnte nicht erstellt werden. Bitte versuchen Sie es erneut.",notesLabel:"Notizen für den Verkäufer",notesPlaceholder:"Zusätzliche Notizen für den Verkäufer (optional)...",noteLabel:"Hinweis",euroNote:"Der Euro-Betrag sollte direkt an den Verkäufer wie vereinbart gezahlt werden.",creditsNote:"CEI-Guthaben wird bei Bestellung reserviert und nach Abschluss übertragen.",requiresContactInfo:"Für diese Anzeige müssen Sie zuerst den Verkäufer kontaktieren, um Bestelldetails zu vereinbaren.",ownListing:"Dies ist Ihre eigene Anzeige",editListing:"Anzeige Bearbeiten",submit:"Bestellung Absenden",submitting:"Wird Abgesendet..."}
772,g2e={title:"Meine Wallet",subtitle:"Verwalten Sie Ihr Guthaben und sehen Sie die Transaktionshistorie",balance:"Saldo",customizeName:"Wallet-Namen anpassen",walletName:"Wallet-Name",walletNamePlaceholder:"z.B., Meine Haupt-Wallet",walletNameDescription:"Geben Sie Ihrer Wallet einen benutzerdefinierten Namen, um Ihre Erfahrung zu personalisieren.",walletBalance:"Wallet-Saldo",transferCredits:"Guthaben Ãbertragen",recipient:"Empfänger",selectUser:"Wählen Sie einen Benutzer",noOtherUsers:"Keine anderen Benutzer verfügbar",recipientEmail:"Empfänger E-Mail",amount:"Betrag",amountPlaceholder:"0,00",description:"Beschreibung",descriptionOptional:"Beschreibung (optional)",descriptionPlaceholder:"Wofür ist diese Ãberweisung?",transactionHistory:"Transaktionshistorie",transferSubmit:"Guthaben Ãbertragen",transferring:"Ãbertragung...",saving:"Speichern...",noTransactionsTitle:"Noch keine Transaktionen",noTransactionsDesc:"Ihre Transaktionshistorie wird hier angezeigt, sobald Sie mit der Ãbertragung von Guthaben beginnen.",myListings:"Meine Anzeigen",myOrders:"Meine Bestellungen",messages:"Nachrichten",createListing:"Anzeige Erstellen",goToMarketplace:"Zum Marketplace"},y2e={title:"Benutzerverwaltung",subtitle:"Alle Benutzer anzeigen und Wallet-Guthaben verwalten",allUsers:"Alle Benutzer",noUsers:"Keine Benutzer gefunden",addCredits:"Guthaben zur Wallet Hinzufügen",user:"Benutzer",selectUser:"Wählen Sie einen Benutzer",noUsersAvailable:"Keine Benutzer verfügbar",userEmail:"Benutzer E-Mail",amount:"Betrag",amountPlaceholder:"0,00",reason:"Grund",reasonOptional:"Grund (optional)",reasonPlaceholder:"Warum fügen Sie dieses Guthaben hinzu?",addCreditsSubmit:"Guthaben Hinzufügen",addingCredits:"Hinzufügen...",allTransactions:"Alle Transaktionen",editWalletName:"Wallet-Namen Bearbeiten",admin:"Administrator",unknownUser:"Unbekannter Benutzer",signupBonus:"Anmeldebonus",signupBonusTitle:"Anmeldebonus Konfigurieren",signupBonusDesc:"Legen Sie den Betrag der Guthaben fest, den neue Benutzer bei der Kontoerstellung erhalten",signupBonusAmount:"Bonusbetrag",signupBonusPlaceholder:"100,00",signupBonusSave:"Anmeldebonus Speichern",signupBonusSaving:"Speichern...",signupBonusSuccess:"Anmeldebonus aktualisiert",signupBonusSuccessDesc:"Neue Benutzer erhalten jetzt {{amount}} Guthaben bei der Registrierung",signupBonusError:"Fehler beim Aktualisieren des Anmeldebonus",currentBonus:"Aktuell: {{amount}} Guthaben",professionalPriceTitle:"Professioneller Upgrade-Preis",professionalPriceDesc:"Legen Sie die jährlichen Kosten für das Upgrade auf ein professionelles Konto fest",professionalPriceAmount:"Preis (EUR)",professionalPricePlaceholder:"50,00",professionalPriceSave:"Preis Speichern",professionalPriceSaving:"Speichern...",professionalPriceSuccess:"Upgrade-Preis aktualisiert",professionalPriceSuccessDesc:"Der neue professionelle Upgrade-Preis beträgt â¬{{amount}}/Jahr",professionalPriceError:"Fehler beim Aktualisieren des Preises",currentPrice:"Aktuell: â¬{{amount}}/Jahr",totalCreditsIssued:"Ausgegebene Kredite Gesamt",creditsIssuedDesc:"Historischer Gesamtbetrag bis heute",exchangeVolume:"Handelsvolumen",exchangeVolumeDesc:"Transaktionen zwischen Benutzern",professionalStatusTitle:"Verwaltung des Professionellen Status",professionalStatusDesc:"Manuelles Aktivieren oder Deaktivieren des professionellen Status für Benutzer",activateProfessional:"Aktivieren",deactivateProfessional:"Deaktivieren",manualProfessionalActivation:"Manuelle Aktivierung des professionellen Status",manualProfessionalDeactivation:"Manuelle Deaktivierung des professionellen Status",deleteUser:"Benutzer Löschen",deleteUserWarning:"Möchten Sie den Benutzer wirklich löschen",deleteUserPermanent:"Diese Aktion ist unwiderruflich. Alle Benutzerdaten (Wallet, Anzeigen, Bestellungen, Nachrichten) werden dauerhaft gelöscht.",userDeleted:"Benutzer erfolgreich gelöscht",deleteUserFailed:"Benutzer konnte nicht gelöscht werden",confirmDelete:"Dauerhaft Löschen",processing:"Verarbeitung...",bulkCreditTitle:"Massenguthaben für Alle Benutzer",bulkCreditDesc:"Fügen Sie allen Benutzern auf einmal Guthaben hinzu. Dies wird jeden Benutzer im System mit dem angegebenen Betrag gutsc
772hreiben.",bulkCreditSuccess:"Massenguthaben Erfolgreich",bulkCreditSuccessDesc:"{{successCount}} von {{totalUsers}} Benutzern gutgeschrieben ({{failCount}} fehlgeschlagen)",bulkCreditError:"Massenguthaben Fehler",bulkCreditErrorDesc:"Fehler beim Gutschreiben der Benutzer",bulkCreditPlaceholder:"Grund für Massenguthaben (erforderlich)",bulkCreditButton:"Alle Benutzer Gutschreiben",broadcastTitle:"Broadcast-Nachricht",broadcastDesc:"Senden Sie eine Nachricht an alle Benutzer auf einmal. Jeder Benutzer erhält diese Nachricht in seinem Posteingang.",broadcastSuccess:"Broadcast-Nachricht Gesendet",broadcastSuccessDesc:"An {{successCount}} von {{totalRecipients}} Benutzern gesendet ({{failCount}} fehlgeschlagen)",broadcastError:"Broadcast-Fehler",broadcastErrorDesc:"Fehler beim Senden der Broadcast-Nachricht",broadcastLabel:"Nachrichteninhalt",broadcastPlaceholder:"Geben Sie hier Ihre Broadcast-Nachricht ein...",broadcastButton:"An Alle Benutzer Senden",sending:"Wird gesendet...",exportMembers:"Mitgliederverzeichnis exportieren (CSV)",exportMembersDesc:"Laden Sie das vollständige Mitgliederverzeichnis im CSV-Format herunter"},_2e={type:"Typ",typeAll:"Alle Typen",typeTransfer:"Ãberweisung",typeAdminCredit:"Admin-Guthaben",date:"Datum",startDate:"Startdatum",endDate:"Enddatum",amount:"Betrag",minAmount:"Mindestbetrag",maxAmount:"Höchstbetrag",description:"Beschreibung",from:"Von",to:"An",createdBy:"Erstellt Von",noTransactions:"Noch keine Transaktionen",noTransactionsDesc:"Ihre Transaktionshistorie wird hier angezeigt, sobald Sie mit der Ãbertragung von Guthaben beginnen.",history:"Transaktionshistorie",you:"Sie",system:"System",searchPlaceholder:"Transaktionen suchen..."},v2e={unauthorized:"Nicht Autorisiert",unauthorizedDesc:"Sie sind abgemeldet. Erneut anmelden...",unauthorizedLogin:"Bitte melden Sie sich erneut an, um fortzufahren.",accessDenied:"Zugriff Verweigert",accessDeniedDesc:"Sie haben keine Administrator-Berechtigungen.",transferSuccess:"Ãberweisung erfolgreich",transferSuccessDesc:"Guthaben wurde erfolgreich übertragen.",transferError:"Ãberweisung fehlgeschlagen",transferErrorDesc:"Fehler beim Ãbertragen von Guthaben. Bitte versuchen Sie es erneut.",creditSuccess:"Guthaben hinzugefügt",creditSuccessDesc:"Guthaben wurde erfolgreich zur Wallet des Benutzers hinzugefügt.",creditError:"Fehler beim Hinzufügen von Guthaben",creditErrorDesc:"Fehler beim Hinzufügen von Guthaben. Bitte versuchen Sie es erneut.",walletUpdateSuccess:"Wallet aktualisiert",walletUpdateSuccessDesc:"Ihr Wallet-Name wurde erfolgreich aktualisiert.",walletUpdateError:"Fehler",walletUpdateErrorDesc:"Fehler beim Aktualisieren des Wallet-Namens",donationFailed:"Spende Fehlgeschlagen",donationFailedDesc:"Spende konnte nicht verarbeitet werden",invalidAmount:"Ungültiger Betrag",invalidAmountDesc:"Bitte geben Sie einen gültigen Spendenbetrag ein",upgradeFailed:"Upgrade Fehlgeschlagen",upgradeFailedDesc:"Upgrade-Prozess konnte nicht gestartet werden",error:"Fehler",success:"Erfolg",fetchError:"Laden fehlgeschlagen",sendError:"Nachricht konnte nicht gesendet werden",loadingMessages:"Nachrichten werden geladen...",loadingOrders:"Bestellungen werden geladen...",typeMessage:"Geben Sie Ihre Nachricht ein...",userFallback:"Benutzer",broadcastNoReply:"Dies ist eine Broadcast-Nachricht - Antworten sind nicht erlaubt",broadcastHistory:"Broadcast-Verlauf",messageSent:"Nachricht gesendet",messagesSent:"Nachrichten gesendet",sentTo:"gesendet an",recipients:"Empfänger",upgradeCancelled:"Upgrade Abgebrochen",upgradeCancelledDesc:"Ihr professionelles Upgrade wurde abgebrochen.",thankYou:"Vielen Dank!",donationSuccess:"Ihre Spende hilft, unsere Community-Plattform zu unterstützen.",donationCancelled:"Spende Abgebrochen",donationCancelledDesc:"Ihre Spende wurde abgebrochen.",categoryPlaceholder:"Kategorie",promotedToAdmin:"Zum Administrator befördert",demotedFromAdmin:"Von Administrator herabgestuft",failedToUpdateRole:"Fehler beim Aktualisieren der Rolle"},x2e={defaultName:"Benutzer",fetchError:"Fehler beim Abrufen der Transaktionen"}
772,b2e={title:"Vervollständigen Sie Ihr Profil",subtitle:"Füllen Sie die erforderlichen Informationen aus, um Ihre Wallet zu nutzen",editTitle:"Profil Bearbeiten",editSubtitle:"Aktualisieren Sie Ihre persönlichen Informationen",welcomeTitle:"Willkommen!",welcomeMessage:"Vervollständigen Sie Ihr Profil, um den Service zu nutzen",completeNow:"Jetzt Vervollständigen",firstName:"Vorname",firstNamePlaceholder:"Max",lastName:"Nachname",lastNamePlaceholder:"Mustermann",phone:"Telefon",phonePlaceholder:"+49 123 456 7890",address:"Adresse",addressPlaceholder:"HauptstraÃe 123",city:"Stadt",cityPlaceholder:"Berlin",dateOfBirth:"Geburtsdatum",profession:"Beruf",professionPlaceholder:"z.B. Ingenieur, Arzt, Lehrer",bio:"Ãber mich",bioPlaceholder:"Erzählen Sie uns etwas über sich, Ihre Fähigkeiten, Interessen und was Sie der Gemeinschaft bieten...",website:"Webseite (optional)",websitePlaceholder:"https://ihrewebsite.de",saveProfile:"Profil Speichern",updateProfile:"Profil Aktualisieren",updating:"Aktualisierung...",successTitle:"Profil aktualisiert",successDesc:"Ihre Informationen wurden erfolgreich gespeichert.",errorTitle:"Fehler",errorDesc:"Fehler beim Aktualisieren des Profils. Bitte versuchen Sie es erneut.",userProfile:"Benutzerprofil",noAdditionalInfo:"Keine zusätzlichen Informationen verfügbar",userNotFound:"Benutzer nicht gefunden",email:"E-Mail",adminStatus:"Administrator-Status",isAdmin:"Administrator",notAdmin:"Standardbenutzer"},w2e={titleMin:"Der Titel muss mindestens 5 Zeichen lang sein",descMin:"Die Beschreibung muss mindestens 20 Zeichen lang sein",validUrl:"Muss eine gültige URL sein",priceRequired:"Mindestens ein Preis (Euro oder Guthaben) muss festgelegt werden",hybridPricing:"Bei hybrider Preisgestaltung müssen die Guthaben mindestens 20% des Gesamtwerts betragen",creditsRequired:"CEI-Guthaben sind für alle Anzeigen erforderlich (100% Guthaben oder hybride Preisgestaltung)",creditsMinimum:"Bei hybrider Preisgestaltung müssen die Guthaben mindestens 20% des Gesamtwerts betragen"},S2e={marker:"Markierung",markers:"Markierungen",listing:"Anzeige",listings:"Anzeigen",user:"Benutzer",users:"Benutzer",onMap:"auf der Karte",totalMembers:"Mitglieder insgesamt",legend:"Legende",professionalListing:"Professionelle Anzeige",privateListing:"Private Anzeige",professionalUser:"Professioneller Benutzer",privateUser:"Privater Benutzer",contactSeller:"Verkäufer Kontaktieren",sendMessage:"Nachricht Senden",noUsers:"Keine Benutzer auf der Karte",noUsersDescription:"Derzeit gibt es keine Benutzer mit Standortdaten anzuzeigen.",viewListings:"Anzeigen Ansehen",viewProfile:"Profil Ansehen",viewStore:"Geschäft Ansehen",viewAll:"Alle Anzeigen",centerOnMe:"Auf mich zentrieren",searchUser:"Benutzer suchen...",noSearchResults:"Kein Benutzer gefunden",completeProfileFirst:"Profil vervollständigen zum Aktivieren",noLocationTitle:"Standort Fehlt",noLocationDesc:"Vervollständigen Sie Ihr Profil mit Adresse und Stadt, um diese Funktion zu nutzen",invalidCoordsTitle:"Ungültige Koordinaten",invalidCoordsDesc:"Ihre Koordinaten sind beschädigt. Aktualisieren Sie Ihr Profil, um zu beheben"},T2e={title:"Empfehlungssystem",heroTitle:"Laden Sie Freunde Ein und Verdienen Sie CEI-Guthaben",heroDescription:"Teilen Sie Ihren Empfehlungslink und erhalten Sie 20 CEI-Guthaben für jeden Freund, der sich anmeldet. Ihr Freund erhält 10 zusätzliche Bonus-Guthaben!",friendsInvited:"Eingeladene Freunde",creditsEarned:"Verdiente Guthaben",yourCode:"Ihr Code",shareLink:"Teilen Sie Ihren Empfehlungslink",shareLinkDesc:"Kopieren und teilen Sie diesen Link mit Ihren Freunden, um sie zur Plattform einzuladen",copy:"Kopieren",copied:"Kopiert!",copiedDesc:"Empfehlungslink in die Zwischenablage kopiert",copyError:"Link konnte nicht kopiert werden",yourReferrals:"Ihre Empfehlungen",yourReferralsDesc:"Personen, die sich über Ihren Link angemeldet haben",noReferrals:"Sie haben noch niemanden eingeladen",joinedOn:"Beigetreten am {{date}}",active:"Aktiv",emailSubject:"Treten Sie der Unabhängigen Wirtschaftsgemeinschaft bei",emailBody:"Hallo! Ich lade dich ein, der CEI-Plattform beizutreten. Melde dich mit meinem Link an und erhalte 10 Bonus-Guthaben: {{link}}",whatsappMessage:"Hallo! Ich lade dich ein, der CEI-Plattform beizutreten. Erhalte 10 Bonus-Guthaben, indem du dich mit meinem Link anmeldest: {{link}}",telegramMessage:"Tritt der CEI-Plattform bei und erhalte 10 Bonus-Guthaben"},C2e={browse:"Dateien durchsuchen",dropPasteFiles:"Dateien hier ablegen, einfügen oder %{browse}",dropHint:"Legen Sie Ihre Dateien hier ab",uploading:"Wird hochgeladen...",complete:"Upload abgeschlossen",failed:"Upload fehlgeschlagen",uploadImages:"Bilder Hochladen",uploadVideo:"Video Hochladen",imagesUploaded:"{{count}} Bild(er) hochgeladen",videoUploaded:"1 Video hochgeladen",uploadSuccess:"Erfolg",uploadSuccessDesc:"{{count}} Bild(er) erfolgreich hochgeladen",videoUploadSuccess:"Video erfolgreich hochgeladen",professionalLimit:"Professionelle Benutzer können bis zu 10 Bilder und 1 Video pro Anzeige hochladen",freeLimit:"Kostenlose Benutzer können bis zu 3 Bilder pro Anzeige hochladen"},E2e={opportunities:{title:"Freiwilligen-Möglichkeiten",subtitle:"Tragen Sie zur Gemeinschaft bei und verdienen Sie CEI-Guthaben",available:"Möglichkeiten",noResults:"Keine Möglichkeiten gefunden",tryDifferentFilters:"Versuchen Sie, die Suchfilter zu ändern"},myApplications:"Meine Bewerbungen",myRequests:"Meine Anfragen",search:"Möglichkeiten suchen...",allCities:"Alle Städte",viewListing:"Anzeige Ansehen",accept:"Akzeptieren",confirmService:"Dienst Bestätigen",confirmServiceTitle:"Fertigstellung Bestätigen",confirmServiceDescription:"Bestätigen Sie, dass der Dienst abgeschlossen wurde? Der Freiwillige erhält automatisch die Vergütung in CEI-Guthaben.",confirmAndPay:"Bestätigen und Bezahlen",applicationSent:"Bewerbung gesendet",applicationSentDesc:"Der Anfragende wird Ihre Bewerbung prüfen",applicationError:"Bewerbung kann nicht gesendet werden",applicationAccepted:"Bewerbung akzeptiert",volunteerNotified:"Der Freiwillige wurde benachrichtigt",acceptError:"Bewerbung kann nicht akzeptiert werden",serviceConfirmed:"Dienst bestätigt",paymentProcessed:"Die Zahlung wurde verarbeitet",confirmError:"Dienst kann nicht bestätigt werden",browseOpportunities:"Möglichkeiten Durchsuchen",createRequest:"Neue Anfrage",pending:"Ausstehend",active:"Aktiv",completed:"Abgeschlossen",noPendingRequests:"Keine ausstehenden Bewerbungen",noActiveRequests:"Keine aktiven Anfragen",noCompletedRequests:"Keine abgeschlossenen Anfragen",requests:{subtitle:"Empfangene Bewerbungen verwalten"},requestDetails:"Details zur Freiwilligenanfrage",compensation:"Vergütung in CEI-Guthaben",compensationDesc:"Wie viele CEI-Guthaben der Freiwillige bei Abschluss des Dienstes erhält. Die Plattform zahlt diesen Betrag.",recurringService:"Wiederkehrender Dienst",recurringServiceDesc:"Handelt es sich um eine einmalige oder wiederkehrende Freiwilligenarbeit?",maxVolunteers:"Maximale Freiwillige",maxVolunteersDesc:"Wie viele Freiwillige können bei dieser Anfrage helfen? Leer lassen für unbegrenzt.",compensationRequired:"Die CEI-Guthaben-Vergütung ist für Freiwilligenanfragen obligatorisch (mindestens 1 CEI)"},A2e={backToHome:"Zurück zur Startseite",heroTitle:"Willkommen in der Unabhängigen Wirtschaftsgemeinschaft",heroSubtitle:"Eine Solidarwirtschaft zur Stärkung Unserer Gemeinschaften",philosophyTitle:"Geld Verstehen: Eine Kulturelle Revolution",philosophyText1:"Geld ist einfach eine Darstellung von Reichtum, nicht der Reichtum selbst. Wenn Reichtum von unseren Händen, unserer Arbeit, unseren Fähigkeiten geschaffen wird, warum sollte seine Darstellung privaten Zentralbanken gehören?",philosophyText2:"CEI-Guthaben sind unsere Antwort: eine Rechnungseinheit, die nicht gekauft oder verkauft werden kann. Guthaben werden nur durch TUN für das Gemeinwohl verdient: indem man Produkte, Dienstleistungen, Fähigkeiten der Gemeinschaft anbietet oder durch zertifizierte Freiwilligenarbeit beiträgt.",featuresTitle:"Wie die CEI-Plattform Funktioniert",freeUsersTitle:"Für alle Benutzer:",freeFeature1:"Persönliche Brieftasche mit CEI-Guthaben-Verwaltung",freeFeature2:"Community-Marktplatz zum Austausch von Waren und Dienstleistungen",freeFeature3:"Hybride Preisgestaltung: 100% CEI-Guthaben oder Euro + Guthaben (mindestens 20% in Guthaben)",freeFeature4:"Interaktive Karte zur Entdeckung von Angeboten in Ihrer Region und darüber hinaus",freeFeature5:"Messaging zum Kontakt mit Verkäufern und
772Käufern",freeFeature6:"Ãffentliches Profil zur Präsentation Ihrer Aktivität",proUsersTitle:"Für professionelle Benutzer (50â¬/Jahr):",proFeature1:"Bis zu 50 Schaufenster mit je 10 Fotos + 1 Video",proFeature2:'"Professionell"-Abzeichen für bessere Sichtbarkeit',proFeature3:"Prioritätsunterstützung von der Community",benefitsTitle:"Die Vorteile der Teilnahme",benefitsIntro:"Gegenseitiges Vertrauen in einer geschützten und solidarischen Umgebung wiedergewinnen, wo:",benefit1:"Wirtschaftliche Beziehungen auf Zusammenarbeit basieren, nicht auf Wettbewerb",benefit2:"Lokale Gemeinschaften durch territorialen Austausch gestärkt werden",benefit3:"Jeder Beitrag zum Gemeinwohl anerkannt und in Guthaben vergütet wird",benefit4:"Reichtum innerhalb des Netzwerks zirkuliert, ohne Finanzintermediäre",benefit5:"Isolierte Gemeinschaften sich in einem nationalen Solidaritätsnetzwerk verbinden",gettingStartedTitle:"Jetzt Starten",step1:"Vervollständigen Sie Ihr Profil mit Stadt und Fähigkeiten",step2:"Erhalten Sie Ihren Willkommensbonus in CEI-Guthaben",step3:"Erstellen Sie Ihr erstes Schaufenster oder erkunden Sie den Marktplatz",step4:"Handeln Sie vertrauensvoll in Ihrer territorialen Gemeinschaft und darüber hinaus",closingStatement:"CEI ist mehr als eine Plattform: Es ist ein Weg, unseren Reichtum zurückzugewinnen und gemeinsam eine Wirtschaft aufzubauen, die den Menschen dient, nicht dem Profit.",getStartedButton:"Jetzt Starten",bannerText:"Solidarwirtschaft ⢠Territoriale Gemeinschaften ⢠Guthaben, die verdient werden, nicht gekauft",learnMore:"Mehr Erfahren"},I2e={backToMarketplace:"Zurück zum Marketplace",heroTitle:"Häufig Gestellte Fragen",heroSubtitle:"Alles, was Sie wissen müssen, um die CEI-Plattform zu nutzen",bannerText:"Haben Sie Fragen? Schauen Sie sich die FAQ an",gettingStartedTitle:"Erste Schritte",q1:"Wie registriere ich mich auf der Plattform?",a1:"Klicken Sie auf 'Anmelden' und folgen Sie dem Authentifizierungsprozess mit Replit. Nach der ersten Anmeldung vervollständigen Sie Ihr Profil, indem Sie Vorname, Nachname, Stadt und eine kurze Beschreibung von sich oder Ihrer Aktivität eingeben.",q2:"Erhalte ich Guthaben, wenn ich mich registriere?",a2:"Ja! Jeder neue Benutzer erhält bei Vervollständigung des Profils einen Willkommensbonus in CEI-Guthaben. Dies ermöglicht es Ihnen, sofort mit der Erkundung des Marktplatzes zu beginnen und Ihre ersten Einkäufe zu tätigen.",q3:"Wie vervollständige ich mein Profil?",a3:"Gehen Sie zu Ihrem Dashboard und klicken Sie auf 'Profil Bearbeiten'. Füllen Sie alle erforderlichen Felder aus: Vorname, Nachname, Stadt und Beschreibung. Die Stadt ist obligatorisch, da sie dazu dient, Sie auf der interaktiven Marktplatzkarte zu positionieren.",listingsTitle:"Angebote Erstellen und Verwalten",q4:"Wie erstelle ich ein Angebot?",a4:"Klicken Sie im Dashboard auf 'Angebot Erstellen'. Geben Sie Titel, Beschreibung, Kategorie, Preis in Euro und CEI-Guthaben ein (mindestens 20% müssen in Guthaben sein), Ihre Stadt, und laden Sie Fotos hoch. Kostenlose Benutzer können bis zu 3 Fotos hochladen, professionelle bis zu 10 Fotos + 1 Video.",q5:"Kann ich nur in Euro ohne CEI-Guthaben verkaufen?",a5:"Nein. Die CEI-Plattform verlangt, dass ALLE Angebote CEI-Guthaben im Preis enthalten. Sie können zu 100% in CEI-Guthaben verkaufen oder einen Hybridpreis (Euro + Guthaben) mit mindestens 20% in CEI-Guthaben erstellen.",q6:"Wie viele Angebote kann ich erstellen?",a6:"Kostenlose Benutzer haben keine Begrenzung bei der Anzahl der Angebote, können aber nur 3 Fotos pro Angebot hochladen. Professionelle Benutzer (50â¬/Jahr) können bis zu 50 Angebote mit je 10 Fotos + 1 Video erstellen.",q7:"Wie bearbeite oder lösche ich ein Angebot?",a7:"Gehen Sie zum Dashboard, klicken Sie auf 'Meine Angebote', finden Sie das Angebot, das Sie bearbeiten möchten, und klicken Sie auf das Bearbeitungssymbol. Um ein Angebot zu löschen, klicken Sie auf das Papierkorbsymbol. Achtung: Die Löschung ist dauerhaft.",creditsTitle:"CEI-Guthaben",q8:"Was sind CEI-Guthaben?",a8:"CEI-Guthaben sind eine Rechnungseinheit, die den Wert von Arbeit, Fähigkeiten und Beiträgen zur Gemeinschaft repräsentiert. Sie können nicht gekauft oder verkauft werden - sie werden nur durch das Anbieten von Waren, Dienstleistungen oder zertifizierten Freiwilligenbeiträgen verdient.",q9:"Wie kann ich CEI-Guthaben verdienen?",a9:"Sie können CEI-Guthaben auf drei Arten verdienen: 1) Durch den Verkauf von Produkten oder Dienstleistungen über den Marktplatz, 2) Durch den Erhalt von Ãberweisungen von anderen Benutzern, 3) Durch die Teilnahme an von der Gemeinschaft zertifizierten Freiwilligenaktivitäten. Administratoren können auch Guthaben für besondere Beiträge zuweisen.",q10:"Kann ich CEI-Guthaben in Euro umwandeln?",a10:"Nein. CEI-Guthaben sind nicht in Euro umwandelbar. Sie sind dafür konzipiert, innerhalb des CEI-Netzwerks als gemeinschaftliches Austauschinstrument zu zirkulieren. Sie können sie verwenden, um Waren und Dienstleistungen von anderen Gemeinschaftsmitgliedern zu kaufen.",professionalTitle:"Professionelles Konto",q11:"Was sind die Vorteile eines professionellen Kontos?",a11:"Das professionelle Konto (50â¬/Jahr) ermöglicht es Ihnen: bis zu 50 Schaufenster zu erstellen, 10 Fotos + 1 Video pro Angebot hochzuladen, ein auf Ihren Angeboten sichtbares 'Professionell'-Abzeichen zu erhalten, eine persönliche Shop-Seite mit anpassbarem Titelbild, prioritäre Unterstützung von der Gemeinschaft zu erhalten und auf erweiterte Funktionen zuzugreifen.",q12:"Wie werde ich professioneller Benutzer?",a12:"Kontaktieren Sie den Plattformadministrator, um das Professional-Upgrade anzufordern (50â¬/Jahr). Das Upgrade ist sofort und dauert ein ganzes Jahr.",storeTitle:"Shop-Seite",q24:"Was ist die Shop-Seite?",a24:"Die Shop-Seite ist ein persönliches Schaufenster für professionelle Benutzer. Es ist eine dedizierte Seite, auf der Kunden alle Ihre Angebote an einem Ort sehen können, mit Ihrem Profilbild, Beruf, Stadt und einem anpassbaren Titelbild.",q25:"Wie greife ich auf meine Shop-Seite zu?",a25:"Ihre Shop-Seite hat eine eigene URL wie: comunitaeconomicaindipendente.it/store/[ihre-id]. Kunden können auch darauf zugreifen, indem sie auf die Schaltfläche 'Meinen Shop besuchen' bei allen Ihren Angeboten klicken. Sie können diesen Link in sozialen Medien oder in Ihren Werbematerialien teilen.",q26:"Wie personalisiere ich mein Shop-Titelbild?",a26:"Gehen Sie zu 'Profil Bearbeiten' im Dashboard. Im Bereich für professionelle Benutzer finden Sie 'Shop-Titelbild'. Laden Sie ein Bild hoch (empfohlen 1200x400
772px, max 5MB), das Ihr Unternehmen repräsentiert. Dieses erscheint oben auf Ihrer Shop-Seite.",q27:"Können Kunden mich von der Shop-Seite aus kontaktieren?",a27:"Von der Shop-Seite aus können Kunden alle Ihre Angebote sehen und auf jedes für Details klicken. Von dort können sie Sie über das Nachrichtensystem der Plattform kontaktieren. Die Shop-Seite zeigt auch Ihre Website (falls zu Ihrem Profil hinzugefügt) als klickbaren Link.",safetyTitle:"Kommunikation und Sicherheit",q13:"Wie kontaktiere ich einen Verkäufer?",a13:"Klicken Sie auf die 'Kontakt'-Schaltfläche im Angebot oder auf der interaktiven Karte. Dies öffnet den internen Chat, wo Sie Nachrichten in Echtzeit senden können. Alle Gespräche sind privat und sicher.",q14:"Wie funktioniert die Zahlung?",a14:"EURO-Zahlungen erfolgen EXTERN zur Plattform - Sie und der Verkäufer vereinbaren die Methode (Banküberweisung, Bargeld, etc.). CEI-Guthaben-Zahlungen erfolgen direkt auf der Plattform: Wenn Sie den Kauf bestätigen, werden Guthaben automatisch von Ihrer Brieftasche zur Brieftasche des Verkäufers übertragen.",referralTitle:"Empfehlungsprogramm",q15:"Was ist das Empfehlungsprogramm?",a15:"Das Empfehlungsprogramm ermöglicht es Ihnen, Freunde zur CEI-Plattform einzuladen. Wenn sich jemand über Ihren persönlichen Link anmeldet, erhalten Sie beide Bonusguthaben: Sie bekommen 20 CEI-Guthaben als Dankeschön, und Ihr Freund erhält 10 Bonusguthaben zum Start.",q16:"Wie finde ich meinen Empfehlungslink?",a16:"Gehen Sie zur Seite 'Empfehlungssystem' in Ihrem Dashboard. Sie finden dort Ihren persönlichen Code und einen einzigartigen Link zum Teilen. Sie können den Link kopieren und über WhatsApp, Telegram, E-Mail oder einen anderen Kanal Ihrer Wahl teilen.",q17:"Wie viele Personen kann ich einladen?",a17:"Es gibt kein Limit! Sie können so viele Personen einladen, wie Sie möchten. Für jeden Freund, der sich anmeldet und sein Profil mit Ihrem Link vervollständigt, erhalten Sie 20 CEI-Guthaben. Je mehr Personen Sie einladen, desto mehr Guthaben verdienen Sie.",q18:"Wie werden meine Empfehlungen verfolgt?",a18:"Das System verwendet ein Cookie, das 30 Tage dauert. Wenn jemand auf Ihren Link klickt, wird Ihr Code gespeichert. Wenn er sich innerhalb von 30 Tagen anmeldet, werden Sie als Empfehler anerkannt. Sie können alle Ihre Empfehlungen und verdienten Guthaben auf der entsprechenden Seite sehen.",volunteerTitle:"Freiwilligendienste",q19:"Was sind Freiwilligendienste?",a19:"Freiwilligendienste sind eine spezielle Kategorie von Angeboten, bei denen Gemeinschaftsmitglieder Hilfe für Aktivitäten von gemeinsamem Interesse anfordern können. Diejenigen, die reagieren und den Dienst abschlieÃen, werden von der Plattform selbst in CEI-Guthaben bezahlt, nicht vom Antragsteller.",q20:"Wie funktioniert die Bezahlung für Freiwillige?",a20:"Wenn ein Freiwilliger einen Dienst abschlieÃt, zahlt die CEI-Plattform automatisch CEI-Guthaben direkt in seine Brieftasche. Der Betrag wird von der Person festgelegt, die das Freiwilligenangebot erstellt (mindestens 1 CEI-Guthaben). Diese Zahlung kommt aus der Reserve der Plattform, nicht vom Antragsteller. Es ist eine Möglichkeit, diejenigen zu belohnen, die zur Gemeinschaft beitragen.",q21:"Wie kann ich mich für einen Freiwilligendienst bewerben?",a21:"Suchen Sie nach Angeboten in der Kategorie 'Freiwilligendienste' auf dem Marktplatz. Wenn Sie eine interessante Gelegenheit finden, klicken Sie auf 'Bewerben', um Ihre Verfügbarkeit zu senden. Der Antragsteller erhält eine Benachrichtigung und kann Ihre Bewerbung akzeptieren.",q22:"Was sind die Zustände einer Freiwilligenaufgabe?",a22:"Der Ablauf ist: 1) 'Beworben' - Sie haben Ihre Verfügbarkeit gesendet, 2) 'Akzeptiert' - der Antragsteller hat bestätigt, 3) 'Dienst Abgeschlossen' - Sie haben die Aktivität beendet, 4) 'Bestätigt' - der Antragsteller bestätigt und Sie erhalten Guthaben. Wenn der Dienst nicht klappt, kann er 'Abgelehnt' oder 'Storniert' werden.",q23:"Kann ich Freiwilligenanfragen erstellen?",a23:"Ja! Gehen Sie zu 'Angebot Erstellen' und wählen Sie die Kategorie 'Freiwilligendienste'. Beschreiben Sie die Aktivität, bei der Sie Hilfe benötigen (z.B. Umzugshilfe, Nachhilfe, Begleitung) und geben Sie an, wie viele CEI-Guthaben der Freiwillige als Vergütung erhält (mindestens 1 Guthaben). Interessierte Freiwillige werden sich bewerben und Sie können wählen, wen Sie akzeptieren. Denken Sie daran: Die Plattform bezahlt den Freiwilligen, nicht Sie.",voucherTitle:"Voucher-Kampagnen",q28:"Was sind Voucher-Kampagnen?",a28:"Voucher-Kampagnen sind ein System zur Verteilung von Bonus-CEI-Guthaben bei Gemeinschaftsveranstaltungen. Der Administrator erstellt einen Voucher-Code mit einem bestimmten Betrag, und die Teilnehmer der Veranstaltungen können ihn einlösen, um zusätzliche Guthaben in ihrer Brieftasche zu erhalten.",q29:"Wie löse ich einen Voucher-Code ein?",a29:"In Ihrem Dashboard finden Sie den Bereich 'Voucher Einlösen'. Geben Sie den Code ein, den Sie bei der Veranstaltung erhalten haben, und klicken Sie auf 'Einlösen'. Die Bonusguthaben werden sofort Ihrer Brieftasche gutgeschrieben. Jeder Voucher kann nur einmal pro Benutzer eingelöst werden.",q30:"Wie bek
772omme ich einen Voucher-Code?",a30:"Voucher-Codes werden bei CEI-Gemeinschaftsveranstaltungen verteilt. Nehmen Sie an Treffen, Versammlungen und Aktivitäten teil, die von der Gemeinschaft organisiert werden, um Codes zu erhalten. Voucher können ein Ablaufdatum und eine maximale Anzahl von Einlösungen haben, also lösen Sie sie so schnell wie möglich ein.",mapTitle:"Interaktive Karte",q31:"Wie funktioniert die interaktive Karte?",a31:"Die Karte zeigt alle Mitglieder der CEI-Gemeinschaft mit einem Marker an ihrem Standort. Sie können auf jeden Marker klicken, um das Profil des Benutzers, seine Angebote zu sehen und ihn direkt zu kontaktieren. Professionelle Benutzer haben einen anderen Marker zur Unterscheidung.",q32:"Wie erscheine ich auf der Karte?",a32:"Um auf der Karte zu erscheinen, müssen Sie Ihr Profil vervollständigen, indem Sie Ihre Stadt und Adresse eingeben. Das System berechnet automatisch die Koordinaten aus Ihrem Standort. Wenn Sie bemerken, dass Ihre Position nicht genau ist, versuchen Sie, Ihr Profil erneut mit einer detaillierteren Adresse zu speichern.",stillNeedHelp:"Finden Sie nicht, wonach Sie suchen?",contactSupport:"Support Kontaktieren"},k2e={bannerText:"Neu hier? Erfahren Sie, wie Sie sich registrieren",bannerCta:"Schritt-für-Schritt-Anleitung",backToMarketplace:"Zurück zum Marketplace",heroTitle:"Registrierungsanleitung",heroSubtitle:"Folgen Sie diesen 8 einfachen Schritten, um Ihr CEI-Konto zu erstellen",timeEstimate:"Geschätzte Zeit: 3-5 Minuten",beforeYouStart:"Bevor Sie beginnen, stellen Sie sicher, dass Sie haben:",requirement1:"Eine gültige E-Mail-Adresse, auf die Sie zugreifen können",requirement2:"Einige Minuten Zeit, um die Registrierung abzuschlieÃen",requirement3:"Ihre persönlichen Daten (Vorname, Nachname, Stadt)",tipLabel:"Tipp:",step1Title:'Klicken Sie auf "Anmelden"',step1Desc:`Finden Sie auf der Hauptseite des CEI-Marktplatzes die Schaltfläche "Anmelden" in der oberen rechten Ecke. 773 774Klicken Sie auf die Schaltfläche, um den Registrierungsprozess zu starten.`,step1Tips:"Wenn Sie auf einem Smartphone sind, könnte die Schaltfläche im Hamburger-Menü sein (die drei horizontalen Linien).",step2Title:'Wählen Sie "Continue with email"',step2Desc:`Ein Replit-Fenster wird geöffnet (das System, das Konten verwaltet). 775 776Klicken Sie auf "Continue with email" (Mit E-Mail fortfahren), dann geben Sie Ihre E-Mail-Adresse ein und wählen Sie ein Passwort.`,step2Tips:"Verwenden Sie eine E-Mail, die Sie regelmäÃig überprüfen. Wählen Sie ein sicheres Passwort, das Sie sich merken werden.",step3Title:"E-Mail-Code verifizieren",step3Desc:`Replit sendet einen 6-stelligen Verifizierungscode an Ihre E-Mail. 777 778Ãffnen Sie Ihren Posteingang, finden Sie die E-Mail von Replit (überprüfen Sie auch Spam/Junk), kopieren Sie den Code und fügen Sie ihn im Replit-Fenster ein.`,step3Tips:'Der Code läuft nach einigen Minuten ab. Wenn er nicht ankommt, klicken Sie auf "Resend code", um ihn erneut zu erhalten.',step4Title:"Erstellen Sie Ihr Replit-Konto",step4Desc:`Wenn Sie Replit zum ersten Mal verwenden, werden Sie gebeten: 779 780⢠Einen Benutzernamen zu erstellen 781⢠Einige optionale Felder auszufüllen (Beruf, was Sie tun möchten, usw.) 782 783Diese Formulare stammen von Replit, nicht von CEI. Sie können sie schnell ausfüllen oder wenn möglich überspringen.`,step4Tips:"Wählen Sie einen einfachen Benutzernamen. Die zusätzlichen Felder (Beruf, Projekte) sind für Replit und beeinflussen Ihr CEI-Konto nicht.",step5Title:"CEI-Zugang autorisieren",step5Desc:`Replit wird Sie bitten, den Zugang zur CEI-Plattform zu autorisieren. 784 785Klicken Sie auf "Authorize" (Autorisieren), um CEI zu erlauben, Ihre grundlegenden Informationen (E-Mail und Benutzername) zu lesen.`,step5Tips:"Diese Autorisierung ist sicher. CEI wird niemals Zugang zu Ihrem Replit-Passwort haben.",step6Title:"Vervollständigen Sie Ihr CEI-Profil",step6Desc:`Jetzt sind Sie auf der CEI-Plattform! Es erscheint ein Formular zur Vervollständigung Ihres Profils. 786 787Geben Sie ein: 788⢠Vor- und Nachname 789⢠Telefonnummer 790⢠Ihre Beruf oder Tätigkeit`,step6Tips:"Füllen Sie alle Felder sorgfältig aus. Diese Informationen helfen anderen Benutzern, Sie kennenzulernen.",step7Title:"Fügen Sie Ihren Standort hinzu",step7Desc:`Geben Sie Ihre vollständige Adresse und Stadt ein. Diese Daten sind wichtig für: 791 792⢠Erscheinen auf der Marktplatzkarte 793⢠Gefunden werden von denen, die Dienstleistungen in Ihrer Gegend suchen 794⢠Angebote in Ihrer Nähe finden 795
796Unsere Gemeinschaft basiert auf Vertrauen und Transparenz.`,step7Tips:"Eine genaue Adresse hilft anderen Gemeinschaftsmitgliedern, Sie leicht zu finden.",step8Title:"Speichern und Starten!",step8Desc:`Klicken Sie auf "Profil Speichern", um die Registrierung abzuschlieÃen. 797 798Herzlichen Glückwunsch! Sie haben Ihr CEI-Konto erstellt und Ihre ersten Willkommensguthaben erhalten!`,step8Tips:"Jetzt können Sie den Marktplatz erkunden, Angebote erstellen und Ihre CEI-Guthaben verwenden.",completedTitle:"Registrierung Abgeschlossen!",completedDesc:"Sobald Sie alle Schritte abgeschlossen haben, haben Sie vollen Zugang zur CEI-Plattform:",benefit1:"Willkommensguthaben in Ihrer Brieftasche",benefit2:"Möglichkeit, Angebote auf dem Marktplatz zu erstellen",benefit3:"Chat zum Kontaktieren von Verkäufern und Käufern",benefit4:"Zugang zum Empfehlungsprogramm, um Freunde einzuladen",readyToStart:"Bereit zu starten?",startButton:"Zum Marketplace gehen und Registrieren",needHelp:"Noch Fragen?",checkFaq:"FAQ ansehen"},P2e={redeemTitle:"Voucher Einlösen",redeemDescription:"Geben Sie einen Voucher-Code ein, um Bonus-CEI-Guthaben zu erhalten",enterCode:"Voucher-Code eingeben...",redeem:"Einlösen",congratulations:"Herzlichen Glückwunsch!",redeemSuccess:"Sie haben {{amount}} Bonus-CEI-Guthaben erhalten!",title:"Voucher-Kampagnen",subtitle:"Erstellen und verwalten Sie Voucher-Kampagnen für Gemeinschaftsveranstaltungen",create:"Voucher Erstellen",edit:"Voucher Bearbeiten",createDesc:"Richten Sie einen neuen Voucher-Code für die Gemeinschaftsverteilung ein",editDesc:"Voucher-Einstellungen aktualisieren",noVouchers:"Keine Voucher-Kampagnen",createFirst:"Erstellen Sie Ihre erste Voucher-Kampagne",active:"Aktiv",inactive:"Inaktiv",scheduled:"Geplant",expired:"Abgelaufen",newUsersOnly:"Nur Neue Benutzer",existingUsersOnly:"Nur Bestehende Benutzer",allUsers:"Alle Benutzer",code:"Code",description:"Beschreibung",descriptionPlaceholder:"Beschreiben Sie diese Voucher-Kampagne...",bonusType:"Bonus-Typ",fixed:"Fester Betrag",multiplier:"Multiplikator",bonusValue:"Bonus-Wert",targetAudience:"Zielgruppe",startsAt:"Startdatum",endsAt:"Enddatum",maxRedemptions:"Max. Einlösungen",unlimited:"Unbegrenzt",isActive:"Aktiv",redemptions:"Einlösungen",totalDistributed:"Gesamt Verteilt",sendBroadcast:"Nachricht Versenden",broadcastDesc:"Voucher-Code {{code}} an alle Benutzer senden",broadcastTemplate:"Sonderbonus! Verwenden Sie den Code {{code}} um {{bonus}} Guthaben zu erhalten!",message:"Nachricht",send:"Senden",errors:{notFound:"Voucher-Code nicht gefunden",inactive:"Dieser Voucher ist nicht mehr aktiv",notStarted:"Dieser Voucher ist noch nicht gültig",expired:"Dieser Voucher ist abgelaufen",newUsersOnly:"Dieser Voucher gilt nur für neue Benutzer",existingUsersOnly:"Dieser Voucher gilt nur für bestehende Benutzer",maxRedemptionsReached:"Dieser Voucher hat die maximale Anzahl an Einlösungen erreicht",alreadyRedeemed:"Sie haben diesen Voucher bereits eingelöst",generic:"Voucher konnte nicht eingelöst werden. Bitte versuchen Sie es erneut"},admin:{title:"Voucher-Kampagnen",description:"Erstellen und verwalten Sie Voucher-Kampagnen für Gemeinschaftsveranstaltungen",createNew:"Voucher Erstellen",noVouchers:"Keine Voucher-Kampagnen",noVouchersDesc:"Erstellen Sie Ihre erste Kampagne, um Bonus-Guthaben bei Veranstaltungen zu verteilen",code:"Code",name:"Kampagnenname",namePlaceholder:"z.B., Sommer-Event 2025",bonusType:"Bonus-Typ",bonusTypeFixed:"Fester Betrag",bonusTypeMultiplier:"Multiplikator",bonusAmount:"Bonus-Betrag",bonusMultiplier:"Multiplikator (z.B., 1.5 = 50% extra)",targetAudience:"Zielgruppe",targetAll:"Alle Benutzer",targetNewUsers:"Nur Neue Benutzer",targetExistingUsers:"Nur Bestehende Benutzer",maxRedemptions:"Max. Einlösungen (0 = unbegrenzt)",startDate:"Startdatum",endDate:"Enddatum",active:"Aktiv",inactive:"Inaktiv",redemptions:"Einlösungen",created:"Erstellt",actions:"Aktionen",edit:"Bearbeiten",toggleStatus:"Status Ãndern",delete:"Löschen",deleteConfirm:"Diese Voucher-Kampagne löschen?",deleteDesc:"Diese Aktion kann nicht rückgängig gemacht werden. Alle Einlösungsdaten gehen verloren.",createSuccess:"Voucher-Kampagne erfolgreich erstellt",updateSuccess:"Voucher-Kampagne erfolgreich aktualisiert",deleteSuccess:"Voucher-Kampagne gelöscht",statusUpdated:"Voucher-Status aktualisiert",error:"Ein Fehler ist aufgetreten",broadcast:"Versenden",broadcastTitle:"Voucher-Code Versenden",broadcastDesc:"Den Voucher-Code an alle Benutzer per Systemnachricht senden",broadcastMessage:"Nachrichteninhalt",broadcastMessagePlaceholder:"Schreiben Sie eine Nachricht zum Voucher-Code...",broadcastSend:"An Alle Benutzer Senden",broadcastSuccess:"Voucher-Code erfolgreich versendet",statistics:"Statistiken",totalRedemptions:"Gesamte Einlösungen",creditsDistributed:"Verteilte Guthaben"}},N2e={academy:{title:"Video-Galerie",subtitle:"Entdecken Sie Tutorials, Neuigkeiten und Bildungsinhalte unserer Gemeinschaft",allVideos:"Alle",news:"Neuigkeiten",divulgazione:"Bildung",tutorial:"Tutorial",medicoAmico:"Arztfreund","interviste-giraldi":"Interviews Prof. Giraldi","considerazioni-scientifiche":"Wissenschaftliche Ãberlegungen",intervisteGiraldi:"Interviews Prof. Giraldi",considerazioniScientifiche:"Wissenschaftliche Ãberlegungen",noVideos:"Keine Videos verfügbar",noVideosDesc:"Videos werden bald verfügbar sein",wat
798chVideo:"Video Ansehen",duration:"Dauer"},admin:{title:"Video-Verwaltung",description:"Hochladen und Verwalten von Videos der Video-Galerie",createVideo:"Neues Video Hochladen",createVideoDesc:"Ein neues Video zur Video-Galerie hinzufügen",editVideo:"Video Bearbeiten",editVideoDesc:"Video-Informationen aktualisieren",deleteVideo:"Video Löschen",deleteVideoConfirm:'Sind Sie sicher, dass Sie das Video "{{title}}" löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.',noVideos:"Keine Videos hochgeladen",videoFile:"Video-Datei",thumbnail:"Vorschaubild",titleField:"Titel",titlePlaceholder:"Video-Titel...",descriptionField:"Beschreibung",descriptionPlaceholder:"Video-Beschreibung...",category:"Kategorie",duration:"Dauer (Sekunden)",durationPlaceholder:"z.B., 120",durationHint:"Dauer in Sekunden",featuredOrder:"Hervorgehobene Reihenfolge",orderHint:"Niedrigere Zahlen erscheinen zuerst",published:"Veröffentlicht",featured:"Hervorgehoben",draft:"Entwurf",noDescription:"Keine Beschreibung",selectFile:"Datei Auswählen",selectImage:"Bild Auswählen",fileTooLarge:"Datei ist zu groÃ. Maximum {{max}}MB",uploadFailed:"Upload fehlgeschlagen. Bitte versuchen Sie es erneut",createSuccess:"Video erfolgreich hochgeladen",updateSuccess:"Video erfolgreich aktualisiert",deleteSuccess:"Video erfolgreich gelöscht",publish:"Veröffentlichen",unpublish:"Veröffentlichung aufheben",feature:"Hervorheben",unfeature:"Hervorhebung aufheben"}},M2e={dialogTitle:"Datenschutzerklärung Akzeptieren",dialogDesc:"Bevor Sie die Plattform nutzen, lesen und akzeptieren Sie bitte unsere Datenschutzerklärung.",dataControllerTitle:"Verantwortlicher",dataControllerText:"Die Associazione Comunità Economica Indipendente ist für die Verarbeitung Ihrer personenbezogenen Daten verantwortlich.",dataCollectedTitle:"Erhobene Daten",dataCollectedText:"Wir erheben personenbezogene Daten wie Name, E-Mail, Telefon, Adresse und Transaktionsdaten, um unsere Dienste bereitzustellen.",purposeTitle:"Zweck",purposeText:"Ihre Daten werden verwendet, um Ihr Konto zu verwalten, Ihnen das Veröffentlichen von Anzeigen zu ermöglichen, Transaktionen durchzuführen und mit anderen Nutzern zu kommunizieren.",rightsTitle:"Ihre Rechte",rightsText:"Sie haben das Recht auf Zugang, Berichtigung, Löschung Ihrer Daten und Widerspruch gegen die Verarbeitung. Kontaktieren Sie uns unter [email protected]",readFullPolicy:"Vollständige Datenschutzerklärung lesen",acceptCheckbox:"Ich habe die Datenschutzerklärung gelesen und akzeptiere die Verarbeitung meiner personenbezogenen Daten gemäà DSGVO.",acceptButton:"Akzeptieren und Fortfahren",acceptedTitle:"Datenschutz Akzeptiert",acceptedDesc:"Vielen Dank für die Annahme unserer Datenschutzerklärung.",acceptError:"Fehler beim Akzeptieren. Bitte versuchen Sie es erneut."},D2e={title:"Dokumente",subtitle:"Datenschutz, Ethikkodex und Gemeinschaftsregeln",backToHome:"Zurück zur Startseite",noDocuments:"Derzeit keine Dokumente verfügbar.",typePrivacy:"Datenschutzerklärung",typeEthics:"Ethikkodex",typeRegulations:"Regelungen",typeOther:"Andere Dokumente",view:"Ansehen",download:"Herunterladen"},R2e={sectionTitle:"CEI Mitgliedskarte",title:"MITGLIEDSKARTE",download:"Karte herunterladen",number:"Karte Nr.",birthDate:"Geburtsdatum",city:"Stadt",memberSince:"Mitglied seit"},j2e={common:a2e,categories:l2e,header:c2e,landing:u2e,marketplace:d2e,orders:h2e,myListings:p2e,createListing:f2e,listingDetail:m2e,dashboard:g2e,admin:y2e,transaction:_2e,messages:v2e,user:x2e,profile:b2e,validation:w2e,map:S2e,referral:T2e,upload:C2e,volunteer:E2e,about:A2e,faq:I2e,registrationGuide:k2e,voucher:P2e,video:N2e,privacy:M2e,documents:D2e,memberCard:R2e},z2e={en:{translation:ECe},it:{translation:iEe},fr:{translation:NEe},es:{translation:o2e},de:{translation:j2e}},L2e=()=>typeof window<"u"&&window.localStorage&&localStorage.getItem("language")||"en";kl.use(r1e).init({resources:z2e,lng:L2e(),fallbackLng:"en",interpolation:{escapeValue:!1}});function Tne(t){const e=`categories.${t}`,i=kl.t(e);return i===e?t:i}const wq=["interviste-giraldi","considerazioni-scientifiche"],qj={all:{icon:fT,color:"bg-gray-500"},news:{icon:AJ,color:"bg-blue-500"}
798,divulgazione:{icon:SJ,color:"bg-amber-500"},tutorial:{icon:bJ,color:"bg-green-500"},"medico-amico":{icon:Bk,color:"bg-rose-500"},"interviste-giraldi":{icon:Bk,color:"bg-rose-500"},"considerazioni-scientifiche":{icon:EJ,color:"bg-purple-600"}};function Sq(t){if(!t)return"";const e=Math.floor(t/60),i=t%60;return`${e}:${i.toString().padStart(2,"0")}`}function O2e(){var C;const{t}=pr(),[e,i]=K.useState("all"),[n,o]=K.useState(null),{data:c=[],isLoading:f}=Xn({queryKey:["/api/videos/public"],staleTime:6e4}),r=e==="medico-amico"||wq.includes(e),S=[...e==="all"?c:e==="medico-amico"?c.filter(I=>wq.includes(I.category)):c.filter(I=>I.category===e)].sort((I,N)=>I.isFeatured&&!N.isFeatured?-1:!I.isFeatured&&N.isFeatured?1:I.isFeatured&&N.isFeatured?(I.featuredOrder??0)-(N.featuredOrder??0):new Date(N.createdAt??0).getTime()-new Date(I.createdAt??0).getTime());return f?d.jsxs("section",{className:"max-w-7xl mx-auto px-6 py-16 border-t",children:[d.jsxs("div",{className:"text-center mb-12",children:[d.jsx("h2",{className:"text-3xl font-bold mb-2",children:t("video.academy.title")}),d.jsx("p",{className:"text-muted-foreground",children:t("video.academy.subtitle")})]}),d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3].map(I=>d.jsx("div",{className:"bg-muted animate-pulse rounded-lg h-64"},I))})]}):c.length===0?null:d.jsxs("section",{className:"max-w-7xl mx-auto px-6 py-16 border-t","data-testid":"section-video-academy",children:[d.jsxs("div",{className:"text-center mb-8",children:[d.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[d.jsx(Eb,{className:"w-8 h-8 text-primary"}),d.jsx("h2",{className:"text-3xl font-bold","data-testid":"text-video-academy-title",children:t("video.academy.title")})]}),d.jsx("p",{className:"text-muted-foreground","data-testid":"text-video-academy-subtitle",children:t("video.academy.subtitle")})]}),d.jsxs("div",{className:"flex flex-col items-center gap-2 mb-8","data-testid":"tabs-video-categories",children:[d.jsxs("div",{className:"flex gap-2 justify-center flex-wrap",children:[d.jsxs(tt,{variant:e==="all"?"default":"outline",size:"sm",onClick:()=>i("all"),"data-testid":"tab-video-all",children:[d.jsx(fT,{className:"w-4 h-4 mr-2"}),t("video.academy.allVideos")]}),d.jsxs(tt,{variant:e==="news"?"default":"outline",size:"sm",onClick:()=>i("news"),"data-testid":"tab-video-news",children:[d.jsx(AJ,{className:"w-4 h-4 mr-2"}),t("video.academy.news")]}),d.jsxs(tt,{variant:e==="divulgazione"?"default":"outline",size:"sm",onClick:()=>i("divulgazione"),"data-testid":"tab-video-divulgazione",children:[d.jsx(SJ,{className:"w-4 h-4 mr-2"}),t("video.academy.divulgazione")]}),d.jsxs(tt,{variant:e==="tutorial"?"default":"outline",size:"sm",onClick:()=>i("tutorial"),"data-testid":"tab-video-tutorial",children:[d.jsx(bJ,{className:"w-4 h-4 mr-2"}),t("video.academy.tutorial")]}),d.jsxs(tt,{variant:r?"default":"outline",size:"sm",onClick:()=>i(r?"all":"medico-amico"),"data-testid":"tab-video-medico-amico",children:[d.jsx(Bk,{className:"w-4 h-4 mr-2"}),t("video.academy.medicoAmico")]})]}),r&&d.jsxs("div",{className:"flex gap-2 justify-center flex-wrap pl-4 border-l-2 border-rose-300",children:[d.jsx(tt,{variant:e==="medico-amico"?"default":"outline",size:"sm",onClick:()=>i("medico-amico"),"data-testid":"tab-video-medico-amico-all",className:"text-xs",children:t("video.academy.allVideos")}),d.jsxs(tt,{variant:e==="interviste-giraldi"?"default":"outline",size:"sm",onClick:()=>i("interviste-giraldi"),"data-testid":"tab-video-interviste-giraldi",className:"text-xs",children:[d.jsx(Bk,{className:"w-3 h-3 mr-1"}),t("video.academy.intervisteGiraldi")]}),d.jsxs(tt,{variant:e==="considerazioni-scientifiche"?"default":"outline",size:"sm",onClick:()=>i("considerazioni-scientifiche"),"data-testid":"tab-video-considerazioni-scientifiche",className:"text-xs",children:[d.jsx(EJ,{className:"w-3 h-3 mr-1"}),t("video.academy.considerazioniScientifiche")]})]})]}),S.length===0?d.jsxs("div",{className:"text-center py-12","data-testid":"text-no-videos",children:[d.jsx("p",{className:"text-muted-foreground",children:t("video.academy.noVideos")}),d.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t("video.academy.noVideosDesc")})]}):d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6","data-testid":"grid-videos",children:S.map(I=>{var V,B;const N=((V=qj[I.category])==null?void 0:V.icon)||fT,D=((B=qj[I.category])==null?void 0:B.color)||"bg-gray-500";return d.jsxs(Ti,{className:"overflow-hidden hover-elevate cursor-pointer group",onClick:()=>o(I),"data-testid":`card-video-${I.id}`,children:[d.jsxs("div",{className:"relative aspect-video bg-muted",children:[I.thumbnailUrl?d.jsx("img",{src:I.thumbnailUrl,alt:I.title,className:"w-full h-full object-cover","data-testid":`img-video-thumbnail-${I.id}`}):d.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-accent/20",children:d.jsx(Eb,{className:"w-12 h-12 text-muted-foreground"})}),d.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:d.jsx("div",{className:"w-16 h-16 rounded-full bg-white/90 flex items-center justify-center",children:d.jsx(fT,{className:"w-8 h-8 text-primary ml-1"})})}),I.isFeatured&&d.jsx(En,{className:"absolute top-2 left-2 bg-amber-500 text-white","data-testid":`badge-featured-${I.id}`,children:t("video.admin.featured")}),d.jsxs(En,{className:`absolute top-2 right-2 ${D} text-white`,"data-testid":`badge-category-${I.id}`,children:[d.jsx(N,{className:"w-3 h-3 mr-1"}),t(`video.academy.${I.category}`)]}),I.duration&&d.jsxs("div",{className:"absolute bottom-2 right-2 px-2 py-1 bg-black/70 text-white text-xs rounded flex items-center gap-1",children:[d.jsx(qh,{className:"w-3 h-3"}),Sq(I.duration)]})]}),d.jsxs(Ji,{className:"p-4",children:[d.jsx("h3",{className:"font-semibold line-clamp-2 mb-2","data-testid":`text-video-title-${I.id}`,children:I.title}),I.description&&d.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2","data-testid":`text-video-desc-${I.id}`,children:I.description})]})]},I.id)})}),d.jsx(ll,{open:!!n,onOpenChange:()=>o(null),children:d.jsxs(Va,{className:"max-w-4xl p-0 overflow-hidden","data-testid":"dialog-video-player",children:[d.jsx(cl,{className:"p-4 pb-0",children:d.jsx("div",{className:"flex items-start justify-between gap-4",children:d.jsxs("div",{children:[d.jsx($a,{className:"text-xl","data-testid":"text-dialog-video-title",children:n==null?void 0:n.title}),(n==null?void 0:n.description)&&d.jsx(Oc,{className:"mt-2","data-testid":"text-dialog-video-desc",children:n.description})]})})}),n&&d.jsxs("div",{className:"p-4 pt-2",children:[d.jsx("div",{className:"aspect-video bg-black rounded-lg overflow-hidden",children:d.jsx("video",{src:n.videoUrl,controls:!0,autoPlay:!0,className:"w-full h-full","data-testid":"video-player",children:"Your browser does not support the video tag."})}),d.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[n.category&&d.jsx(En,{className:`${((C=qj[n.category])==null?void 0:C.color)||"bg-gray-500"} text-white`,children:t(`video.academy.${n.category}`)}),n.duration&&d.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[d.jsx(qh,{className:"w-4 h-4"}),t("video.academy.duration"),": ",Sq(n.duration)]})]})]})]})})]})}var D4="Avatar",[F2e,R8e]=Wa(D4),[B2e,Cne]=F2e(D4),Ene=K.forwardRef((t,e)=>{const{__scopeAvatar:i,...n}=t,[o,c]=K.useState("idle");return d.jsx(B2e,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:c,children:d.jsx(vn.span,{...n,ref:e})})});Ene.displayName=D4;var Ane="AvatarImage",Ine=K.forwardRef((t,e)=>{const{__scopeAvatar:i,src:n,onLoadingStatusChange:o=()=>{},...c}=t,f=Cne(Ane,i),r=U2e(n,c),x=go(S=>{o(S),f.onImageLoadingStatusChange(S)});return Jo(()=>{r!=="idle"&&x(r)}
798,[r,x]),r==="loaded"?d.jsx(vn.img,{...c,ref:e,src:n}):null});Ine.displayName=Ane;var kne="AvatarFallback",Pne=K.forwardRef((t,e)=>{const{__scopeAvatar:i,delayMs:n,...o}=t,c=Cne(kne,i),[f,r]=K.useState(n===void 0);return K.useEffect(()=>{if(n!==void 0){const x=window.setTimeout(()=>r(!0),n);return()=>window.clearTimeout(x)}},[n]),f&&c.imageLoadingStatus!=="loaded"?d.jsx(vn.span,{...o,ref:e}):null});Pne.displayName=kne;function Tq(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function U2e(t,{referrerPolicy:e,crossOrigin:i}){const n=$2e(),o=K.useRef(null),c=n?(o.current||(o.current=new window.Image),o.current):null,[f,r]=K.useState(()=>Tq(c,t));return Jo(()=>{r(Tq(c,t))},[c,t]),Jo(()=>{const x=I=>()=>{r(I)};if(!c)return;const S=x("loaded"),C=x("error");return c.addEventListener("load",S),c.addEventListener("error",C),e&&(c.referrerPolicy=e),typeof i=="string"&&(c.crossOrigin=i),()=>{c.removeEventListener("load",S),c.removeEventListener("error",C)}},[c,i,e]),f}function V2e(){return()=>{}}function $2e(){return K.useSyncExternalStore(V2e,()=>!0,()=>!1)}var Nne=Ene,Mne=Ine,Dne=Pne;const Nc=K.forwardRef(({className:t,...e},i)=>d.jsx(Nne,{ref:i,className:nn(` 799 after:content-[''] after:block after:absolute after:inset-0 after:rounded-full after:pointer-events-none after:border after:border-black/10 dark:after:border-white/10 800 relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,t),...e}));Nc.displayName=Nne.displayName;const Rd=K.forwardRef(({className:t,...e},i)=>d.jsx(Mne,{ref:i,className:nn("aspect-square h-full w-full",t),...e}));Rd.displayName=Mne.displayName;const Mc=K.forwardRef(({className:t,...e},i)=>d.jsx(Dne,{ref:i,className:nn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Mc.displayName=Dne.displayName;const Uc=K.forwardRef(({className:t,...e},i)=>d.jsx("textarea",{className:nn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base 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 md:text-sm",t),ref:i,...e}));Uc.displayName="Textarea";const nI=1e3,q2e=t=>{var e,i;return`${((e=t.firstName)==null?void 0:e[0])||""}${((i=t.lastName)==null?void 0:i[0])||""}`.toUpperCase()||"CE"},Cq=(t,e)=>+new Date(e.createdAt)-+new Date(t.createdAt)||(t.id<e.id?1:t.id>e.id?-1:0);function H2e(){const{t}=pr(),{toast:e}=ks(),{isAdmin:i}=Ka(),n=V3(),[o,c]=K.useState(""),[f,r]=K.useState(null),[x,S]=K.useState(null),[C,I]=K.useState([]),[N,D]=K.useState(null),[V,B]=K.useState(null),[W,$]=K.useState(!0),G=K.useRef(null),te=Xn({queryKey:["/api/community-chat/messages","latest"],queryFn:async()=>{const Je=await fetch("/api/community-chat/messages?limit=30",{credentials:"include"});if(!Je.ok)throw new Error("Unable to load community chat");return Je.json()},refetchInterval:5e3});K.useEffect(()=>{te.data&&(I(Je=>{const dt=[...Je,...te.data.messages],At=new Map(dt.map(qt=>[qt.id,qt]));return Array.from(At.values()).sort(Cq)}),B(Je=>Je||te.data.nextBeforeId||null))},[te.data]),K.useEffect(()=>()=>{x&&URL.revokeObjectURL(x)},[x]);const ce=async()=>{if(!(!V||!W))try{const Je=await fetch(`/api/community-chat/messages?limit=30&beforeId=${encodeURIComponent(V)}`,{credentials:"include"});if(!Je.ok)throw new Error;const dt=await Je.json();I(At=>{const qt=new Map([...dt.messages,...At].map(kt=>[kt.id,kt]));return Array.from(qt.values()).sort(Cq)}),B(dt.nextBeforeId||null),$(!!dt.nextBeforeId)}catch{e({variant:"destructive",title:t("communityChat.error","Chat non disponibile"),description:t("communityChat.loadOlderError","Non è stato possibile caricare i messaggi precedenti.")})}},_e=Je=>{if(Je){if(!["image/jpeg","image/png","image/webp","image/gif"].includes(Je.type)||Je.size>5*1024*1024){e({variant:"destructive",title:t("communityChat.invalidImage","Immagine non valida"),description:t("communityChat.imageRules","Scegli JPEG, PNG, WebP o GIF fino a 5 MB.")});return}x&&URL.revokeObjectURL(x),r(Je),S(URL.createObjectURL(Je))}},Te=$n({mutationFn:async()=>{let Je;if(f){const At=await fetch("/api/objects/upload",{method:"POST",credentials:"include"});if(!At.ok)throw new Error("upload");const{uploadURL:qt}=await At.json();if(!(await fetch(qt,{method:"PUT",headers:{"Content-Type":f.type},body:f})).ok)throw new Error("upload");Je=qt.split("?")[0]}return(await xn("POST","/api/community-chat/messages",{content:o.trim()||void 0,imageUrl:Je})).json()},onSuccess:()=>{c(""),r(null),S(null),n.invalidateQueries({queryKey:["/api/community-chat/messages","latest"]}),e({title:t("communityChat.sent","Messaggio pubblicato"),description:t("communityChat.sentDescription","
800La tua voce è ora nella piazza della comunità .")})},onError:()=>e({variant:"destructive",title:t("communityChat.error","Invio non riuscito"),description:t("communityChat.sendError","Controlla la connessione e riprova.")})}),we=$n({mutationFn:Je=>xn("DELETE",`/api/admin/community-chat/messages/${Je}`),onSuccess:(Je,dt)=>{n.invalidateQueries({queryKey:["/api/community-chat/messages","latest"]}),I(At=>At.filter(qt=>qt.id!==dt)),e({title:t("communityChat.deleted","Messaggio eliminato")})},onError:()=>e({variant:"destructive",title:t("communityChat.error","Operazione non riuscita")})}),Ne=!!(o.trim()||f)&&o.length<=nI&&!Te.isPending,pe=Je=>new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(Je)),Pe=Je=>new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short"}).format(new Date(Je)),De=K.useMemo(()=>C,[C]);return d.jsxs("section",{className:"max-w-5xl mx-auto px-4 md:px-6 py-12","aria-labelledby":"community-chat-title",children:[d.jsxs(Ti,{className:"overflow-hidden border-primary/15 bg-card/95 shadow-lg shadow-primary/5",children:[d.jsx("div",{className:"border-b bg-primary/[0.045] px-5 py-5 md:px-7",children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex gap-3",children:[d.jsx("div",{className:"mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-primary text-primary-foreground shadow-sm",children:d.jsx(Cb,{className:"h-5 w-5"})}),d.jsxs("div",{children:[d.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-primary",children:t("communityChat.eyebrow","Piazza CEI")}),d.jsx("h2",{id:"community-chat-title",className:"mt-1 text-2xl font-semibold tracking-tight",children:t("communityChat.title","La comunità parla qui")}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("communityChat.subtitle","Aggiornamenti brevi, idee locali e occasioni per conoscersi.")})]})]}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>te.refetch(),"aria-label":t("communityChat.refresh","Aggiorna"),className:"shrink-0",children:d.jsx(uxe,{className:`h-4 w-4 ${te.isFetching?"animate-spin":""}`})})]})}),d.jsx("div",{className:"max-h-[560px] min-h-[260px] overflow-y-auto px-4 py-5 md:px-7",children:te.isLoading?d.jsx("div",{className:"space-y-5","aria-label":t("communityChat.loading","Caricamento messaggi"),children:[1,2,3].map(Je=>d.jsxs("div",{className:"flex gap-3 animate-pulse",children:[d.jsx("div",{className:"h-9 w-9 rounded-full bg-muted"}),d.jsx("div",{className:"h-16 w-2/3 rounded-2xl bg-muted"})]},Je))}):te.isError?d.jsxs("div",{className:"py-12 text-center",children:[d.jsx("p",{className:"font-medium",children:t("communityChat.error","Chat non disponibile")}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("communityChat.retryDescription","Riprova tra poco.")}),d.jsx(tt,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>te.refetch(),children:t("common.retry","Riprova")})]}):De.length===0?d.jsxs("div",{className:"py-12 text-center",children:[d.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10 text-primary",children:d.jsx(Cb,{className:"h-5 w-5"})}),d.jsx("p",{className:"mt-4 font-medium",children:t("communityChat.empty","La piazza è pronta per il primo messaggio.")}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("communityChat.emptyDescription","Condividi un pensiero con le persone della comunità .")})]}):d.jsxs("div",{className:"space-y-5",children:[De.map(Je=>{const dt=[Je.author.firstName,Je.author.lastName].filter(Boolean).join(" ")||t("communityChat.member","Membro CEI");return d.jsxs("article",{className:"group flex gap-3","data-testid":`community-message-${Je.id}`,children:[d.jsxs(Nc,{className:"h-9 w-9 shrink-0 ring-2 ring-background",children:[d.jsx(Rd,{src:Je.author.profileImageUrl||void 0,alt:dt}),d.jsx(Mc,{className:"bg-accent text-accent-foreground text-xs font-semibold",children:q2e(Je.author)})]}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-baseline gap-2",children:[d.jsx("span",{className:"font-semibold text-sm",children:dt}),d.jsxs("time",{className:"text-xs text-muted-foreground",children:[Pe(Je.createdAt)," · ",pe(Je.createdAt)]})]}),d.jsxs("div",{className:"relative mt-1 rounded-2xl rounded-tl-md bg-muted/60 px-4 py-3 text-sm leading-relaxed",children:[Je.content&&d.jsx("p",{className:"whitespace-pre-wrap break-words",children:Je.content}),Je.imageUrl&&d.jsx("button",{type:"button",className:"mt-2 block max-w-full cursor-zoom-in overflow-hidden rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",onClick:()=>D(Je.imageUrl||null),"aria-label":t("communityChat.expandImage","Ingrandisci immagine"),children:d.jsx("img",{src:Je.imageUrl,alt:t("communityChat.attachedImage","Immagine condivisa"),className:"max-h-64 max-w-full object-cover transition-transform duration-200 hover:scale-[1.02]"})}),i&&d.jsx(tt,{variant:"ghost",size:"icon",className:"absolute -right-2 -top-2 h-7 w-7 bg-card o
800pacity-100 shadow-sm transition-opacity md:opacity-0 md:group-hover:opacity-100",onClick:()=>we.mutate(Je.id),"aria-label":t("communityChat.delete","Elimina messaggio"),children:d.jsx(Ld,{className:"h-3.5 w-3.5 text-destructive"})})]})]})]},Je.id)}),W&&V&&d.jsx(tt,{variant:"outline",size:"sm",onClick:ce,className:"mx-auto flex",children:t("communityChat.loadOlder","Carica messaggi precedenti")})]})}),d.jsxs("div",{className:"border-t bg-background px-4 py-4 md:px-7",children:[x&&d.jsxs("div",{className:"relative mb-3 inline-block",children:[d.jsx("img",{src:x,alt:t("communityChat.preview","Anteprima immagine"),className:"h-20 w-20 rounded-xl object-cover ring-1 ring-border"}),d.jsx(tt,{type:"button",variant:"secondary",size:"icon",className:"absolute -right-2 -top-2 h-7 w-7 rounded-full",onClick:()=>{r(null),S(null)},"aria-label":t("communityChat.removeImage","Rimuovi immagine"),children:d.jsx(Fa,{className:"h-3.5 w-3.5"})})]}),d.jsxs("form",{onSubmit:Je=>{Je.preventDefault(),Ne&&Te.mutate()},className:"flex items-end gap-2",children:[d.jsx("input",{ref:G,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",className:"hidden",onChange:Je=>{var dt;return _e((dt=Je.target.files)==null?void 0:dt[0])}}),d.jsx(tt,{type:"button",variant:"outline",size:"icon",onClick:()=>{var Je;return(Je=G.current)==null?void 0:Je.click()},"aria-label":t("communityChat.addImage","Aggiungi immagine"),children:d.jsx(K3,{className:"h-4 w-4"})}),d.jsxs("div",{className:"relative flex-1",children:[d.jsx(Uc,{value:o,maxLength:nI,onChange:Je=>c(Je.target.value),placeholder:t("communityChat.placeholder","Condividi un aggiornamento con la comunità ..."),className:"min-h-11 resize-none pr-16",rows:1}),d.jsxs("span",{className:`absolute bottom-2 right-3 text-[11px] ${o.length>nI-80?"text-destructive":"text-muted-foreground"}`,children:[o.length,"/",nI]})]}),d.jsx(tt,{type:"submit",size:"icon",disabled:!Ne,"aria-label":t("communityChat.send","Invia messaggio"),children:Te.isPending?d.jsx(lv,{className:"h-4 w-4 animate-spin"}):d.jsx(JT,{className:"h-4 w-4"})})]}),d.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[d.jsx(JN,{className:"h-3 w-3"}),t("communityChat.guidance","Testo fino a 1000 caratteri · una immagine fino a 5 MB")]})]})]}),d.jsx(ll,{open:!!N,onOpenChange:Je=>!Je&&D(null),children:d.jsxs(Va,{className:"flex max-h-[95vh] max-w-[95vw] items-center justify-center border-0 bg-black/90 p-3 sm:max-w-6xl",children:[d.jsx($a,{className:"sr-only",children:t("communityChat.expandedImage","Immagine ingrandita")}),N&&d.jsx("img",{src:N,alt:t("communityChat.expandedImage","Immagine ingrandita"),className:"max-h-[88vh] max-w-full object-contain"})]})})]})}function Eq(){const e=new URLSearchParams(window.location.search).get("ref");return e?`/api/login?ref=${encodeURIComponent(e)}`:"/api/login"}function G2e(){const{t}=pr(),{toast:e}=ks(),{isAuthenticated:i}=Ka(),{unreadCount:n}=Sne(),{unreadCount:o}=XTe(),[,c]=$o(),[f,r]=K.useState(""),[x,S]=K.useState("all"),[C,I]=K.useState(""),[N,D]=K.useState(!1),[V,B]=K.useState(!1),[W,$]=K.useState(!1),[G,te]=K.useState("city"),[ce,_e]=K.useState(25),[Te,we]=K.useState(null),[Ne,pe]=K.useState(!1),[Pe,De]=K.useState("all");K.useEffect(()=>{const ei=new URLSearchParams(window.location.search);ei.get("upgrade")==="success"?(e({title:t("marketplace.upgradeSuccessful"),description:t("marketplace.upgradeSuccessfulDesc")}),window.history.replaceState({},"","/marketplace")):ei.get("upgrade")==="cancelled"?(e({title:t("messages.upgradeCancelled"),description:t("messages.upgradeCancelledDesc"),variant:"destructive"}),window.history.replaceState({},"","/marketplace")):ei.get("donation")==="success"?(e({title:t("messages.thankYou"),description:t("messages.donationSuccess")}),window.history.replaceState({},"","/marketplace")):ei.get("donation")==="cancelled"&&(e({title:t("messages.donationCancelled"),description:t("messages.donationCancelledDesc"),variant:"destructive"}),window.history.replaceState({},"","/marketplace"))},[e]);const{data:Je=[]}=Xn({queryKey:["/api/categories"],staleTime:0,refetchOnMount:"always"}),dt=()=>{if(!i){D(!0);return}if(pe(!0),!navigator.geolocation){e({title:t("marketplace.locationNotSupported"),description:t("marketplace.locationNotSupportedDesc"),variant:"destructive"}),pe(!1);return}navigator.geolocation.getCurrentPosition(ei=>{we({lat:ei.coords.latitude,lon:ei.coords.longitude}),pe(!1),e({title:t("marketplace.locationFound"),description:t("marketplace.locationFoundDesc")})},ei=>{pe(!1);let si=t("marketplace.locationError");
800ei.code===ei.PERMISSION_DENIED?si=t("marketplace.locationPermissionDenied"):ei.code===ei.POSITION_UNAVAILABLE&&(si=t("marketplace.locationUnavailable")),e({title:t("marketplace.locationErrorTitle"),description:si,variant:"destructive"})})},qt=(()=>{const ei=new URLSearchParams;return!W&&!f&&x==="all"&&!C&&!Te?ei.append("onlyCeiCredits","true"):(f&&ei.append("search",f),x&&x!=="all"&&ei.append("categoryId",x),G==="city"&&C&&ei.append("city",C),G==="radius"&&Te&&(ei.append("userLat",Te.lat.toString()),ei.append("userLon",Te.lon.toString()),ei.append("radiusKm",ce.toString())),Pe==="professional"?ei.append("professionalOnly","true"):Pe==="private"&&ei.append("privateOnly","true")),ei.toString()})(),Vt=(()=>{if(!f||!W)return"";const ei=new URLSearchParams;return ei.append("q",f),x&&x!=="all"&&ei.append("categoryId",x),G==="city"&&C&&ei.append("city",C),Pe==="professional"?ei.append("professionalOnly","true"):Pe==="private"&&ei.append("privateOnly","true"),ei.toString()})(),{data:Fe,isLoading:lt}=Xn({queryKey:["/api/search",Vt],queryFn:({queryKey:ei})=>{const[,si]=ei;return si?fetch(`/api/search?${si}`).then(Oi=>Oi.json()):{listings:[],users:[]}},enabled:!!Vt}),{data:pt=[],isLoading:Ge}=Xn({queryKey:["/api/listings",qt],queryFn:({queryKey:ei})=>{const[,si]=ei,Oi=si?`/api/listings?${si}`:"/api/listings";return fetch(Oi).then(Ei=>Ei.json())},enabled:!Vt}),Rt=Vt?(Fe==null?void 0:Fe.listings)||[]:pt,Ot=Vt?(Fe==null?void 0:Fe.users)||[]:[],Ci=Vt?lt:Ge,Hi=()=>{if(G==="radius"&&!Te){e({title:t("marketplace.locationErrorTitle"),description:t("marketplace.locationRequiredForRadius"),variant:"destructive"});return}$(!0)};return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsxs("div",{className:"relative bg-gradient-to-br from-primary/20 via-background to-accent/20 border-b",style:{minHeight:"85vh"},children:[d.jsx("div",{className:"absolute inset-0 bg-cover bg-center opacity-20",style:{backgroundImage:`url(${wSe})`}}),d.jsx("header",{className:"relative z-10 border-b bg-background/80 backdrop-blur-sm",children:d.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-12 h-12","data-testid":"img-logo"}),d.jsx("span",{className:"text-xl font-bold",children:"CEI Marketplace"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(TE,{}),d.jsx(yr,{href:"/documents",children:d.jsxs(tt,{variant:"outline",size:"default","data-testid":"button-documents-marketplace",children:[d.jsx(Yp,{className:"w-4 h-4 mr-2"}),t("documents.title","Documenti")]})}),i?d.jsxs(d.Fragment,{children:[d.jsx(tt,{variant:"ghost",size:"icon","data-testid":"button-volunteer-header",onClick:()=>c("/volunteer"),className:"touch-manipulation",children:d.jsx(pT,{className:"w-4 h-4"})}),d.jsxs(tt,{variant:"ghost",size:"icon","data-testid":"button-messages-marketplace",className:"relative touch-manipulation",onClick:()=>c("/messages"),children:[d.jsx(sf,{className:"w-4 h-4"}),n>0&&d.jsx(En,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 min-w-5 px-1 flex items-center justify-center text-xs","data-testid":"badge-marketplace-unread",children:n})]}),d.jsx(Aq,{}),d.jsx(tt,{"data-testid":"button-dashboard",onClick:()=>c("/dashboard"),className:"touch-manipulation",children:t("common.dashboard")})]}):d.jsx(tt,{asChild:!0,"data-testid":"button-login",children:d.jsx("a",{href:Eq(),children:t("common.enter")})})]})]})}),d.jsx("div",{className:"relative z-10 max-w-5xl mx-auto px-6 py-20 md:py-32",children:d.jsxs("div",{className:"text-center space-y-8",children:[d.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[d.jsx(yr,{href:"/chi-siamo","data-testid":"link-about-banner",children:d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-primary/10 hover-elevate border border-primary/20 rounded-full text-sm text-primary cursor-pointer transition-all",children:[d.jsx(wJ,{className:"w-4 h-4","data-testid":"icon-about-banner"}),d.jsx("span",{className:"font-medium","data-testid":"text-about-banner",children:t("about.bannerText")}),d.jsxs("span",{className:"text-xs opacity-75","data-testid":"text-about-banner-cta",children:["â ",t("about.learnMore")]})]})}),i&&d.jsx(yr,{href:"/faq","data-testid":"link-faq-banner",children:d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-accent/10 hover-elevate border border-accent/20 rounded-full text-sm text-accent-foreground cursor-pointer transition-all",children:[d.jsx(xJ,{className:"w-4 h-4","data-testid":"icon-faq-banner"}),d.jsx("span",{className:"font-medium","data-testid":"text-faq-banner",children:t("faq.bannerText")})]})}),!i&&d.jsx(yr,{href:"/guida-registrazione","data-testid":"link-registration-guide-banner",children:d.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-green-500/10 hover-elevate border border-green-500/20 rounded-full text-sm text-green-700 dark:text-green-400 cursor-pointer transition-all",children:[d.jsx(qve,{className:"w-4 h-4","data-testid":"icon-registration-guide-banner"}),d.jsx("span",{className:"font-medium","data-testid":"text-registration-guide-banner",children:t("registrationGuide.bannerText")}),d.jsxs("span",{className:"text-xs opacity-75",children:["â ",t("registrationGuide.bannerCta")]})]})})]}),d.jsx("div",{className:"text-4xl md:text-5xl lg:text-6xl font-semibold tracking-widest uppercase text-primary/80 mb-4","data-testid":"text-community-name",children:t("marketplace.communityName")}),d.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight","data-testid":"text-hero-title",children:t("marketplace.heroTitle")}),d.jsx("p",{className:"text-xl md:text-2xl text-muted-foreground max-w-3xl mx-auto","data-testid":"text-hero-subtitle",children:t("marketplace.heroSubtitle")}),d.jsxs("div",{className:"bg-background/90 backdrop-blur-md rounded-lg p-4 shadow-lg max-w-3xl mx-auto
800space-y-4",children:[d.jsxs("div",{className:"flex gap-2 justify-center flex-wrap",children:[d.jsxs(tt,{variant:Pe==="all"?"default":"outline",size:"sm",onClick:()=>De("all"),"data-testid":"button-seller-type-all",children:[d.jsx(Bc,{className:"w-4 h-4 mr-2"}),t("marketplace.allSellers")]}),d.jsxs(tt,{variant:Pe==="professional"?"default":"outline",size:"sm",onClick:()=>De("professional"),"data-testid":"button-seller-type-pro",children:[d.jsx(W3,{className:"w-4 h-4 mr-2"}),t("marketplace.professionalOnly")]}),d.jsxs(tt,{variant:Pe==="private"?"default":"outline",size:"sm",onClick:()=>De("private"),"data-testid":"button-seller-type-private",children:[d.jsx(ju,{className:"w-4 h-4 mr-2"}),t("marketplace.privateOnly")]})]}),d.jsxs("div",{className:"flex gap-2 justify-center",children:[d.jsxs(tt,{variant:G==="city"?"default":"outline",size:"sm",onClick:()=>{i?(te("city"),we(null)):D(!0)},"data-testid":"button-search-mode-city",children:[d.jsx(fo,{className:"w-4 h-4 mr-2"}),t("marketplace.searchByCity")]}),d.jsxs(tt,{variant:G==="radius"?"default":"outline",size:"sm",onClick:()=>{i?(te("radius"),I("")):D(!0)},"data-testid":"button-search-mode-radius",children:[d.jsx(oxe,{className:"w-4 h-4 mr-2"}),t("marketplace.searchByRadius")]})]}),d.jsxs("div",{className:"grid md:grid-cols-[1fr_auto_auto] gap-3",children:[d.jsxs("div",{className:"relative",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),d.jsx(an,{placeholder:t("marketplace.searchPlaceholder"),className:"pl-10 h-12",value:f,onChange:ei=>r(ei.target.value),onFocus:ei=>{i||(ei.target.blur(),D(!0))},"data-testid":"input-search"})]}),G==="city"?d.jsxs("div",{className:"relative",children:[d.jsx(fo,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground z-10 pointer-events-none"}),d.jsx(an,{placeholder:t("marketplace.cityPlaceholder"),className:"pl-10 h-12",value:C,onChange:ei=>I(ei.target.value),onFocus:ei=>{i||(ei.target.blur(),D(!0))},"data-testid":"input-city"})]}):d.jsxs("div",{className:"flex flex-col gap-3 md:col-span-2",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(tt,{variant:Te?"default":"outline",onClick:dt,disabled:Ne,"data-testid":"button-get-location",className:"whitespace-nowrap",children:Ne?d.jsxs(d.Fragment,{children:[d.jsx(Aj,{className:"w-4 h-4 mr-2 animate-pulse"}),t("marketplace.locating")]}):Te?d.jsxs(d.Fragment,{children:[d.jsx(Aj,{className:"w-4 h-4 mr-2"}),t("marketplace.locationSet")]}):d.jsxs(d.Fragment,{children:[d.jsx(Aj,{className:"w-4 h-4 mr-2"}),t("marketplace.useMyLocation")]})})}),d.jsxs("div",{className:"flex items-center gap-4 px-4 py-4 bg-blue-50 dark:bg-blue-950 rounded-lg border-2 border-blue-300 dark:border-blue-700",children:[d.jsxs("label",{className:"text-sm font-bold whitespace-nowrap min-w-[80px] text-blue-900 dark:text-blue-100",children:[t("marketplace.radiusLabel"),":"]}),d.jsx("input",{type:"range",min:5,max:250,step:5,value:ce,onChange:ei=>_e(parseInt(ei.target.value)),disabled:!i,className:`flex-1 h-3 bg-gray-300 dark:bg-gray-600 rounded-full appearance-none cursor-pointer 801 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-6 [&::-webkit-slider-thumb]:h-6 802 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-blue-600 [&::-webkit-slider-thumb]:cursor-grab 803 [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-blue-800 804 [&::-webkit-slider-thumb]:shadow-lg [&::-webkit-slider-thumb]:hover:scale-110 805 [&::-moz-range-thumb]:w-6 [&::-moz-range-thumb]:h-6 [&::-moz-range-thumb]:rounded-full 806 [&::-moz-range-thumb]:bg-blue-600 [&::-moz-range-thumb]:cursor-grab 807 [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-blue-800 808 [&::-moz-range-thumb]:shadow-lg`,"data-testid":"slider-radius"}),d.jsxs("span",{className:"text-lg font-bold min-w-[70px] text-blue-900 dark:text-blue-100","data-testid":"text-radius",children:[ce," km"]})]})]}),d.jsxs(Jy,{value:x,onValueChange:S,open:V,onOpenChange:ei=>{ei&&!i?(D(!0),B(!1)):i&&B(ei)},children:[d.jsx(Vm,{className:"md:w-[200px] h-12","data-testid":"select-category",children:d.jsx(e_,{placeholder:t("messages.categoryPlaceholder")})}),d.jsxs($m,{children:[d.jsx(ja,{value:"all",children:t("marketplace.selectCategory")}),Je.map(ei=>
808d.jsx(ja,{value:ei.id,children:Tne(ei.name)},ei.id))]})]})]})]}),d.jsxs("div",{className:"flex gap-4 justify-center pt-4 flex-wrap",children:[d.jsxs(tt,{size:"lg",className:"backdrop-blur-md bg-primary/90","data-testid":"button-search",onClick:()=>{i?(Hi(),setTimeout(()=>{var ei;(ei=document.getElementById("listings"))==null||ei.scrollIntoView({behavior:"smooth"})},0)):D(!0)},children:[d.jsx(jh,{className:"w-4 h-4 mr-2"}),t("common.search")]}),d.jsxs(tt,{size:"lg",variant:"outline",className:"backdrop-blur-md bg-background/50 touch-manipulation","data-testid":"button-view-map",onClick:()=>{i?c("/map"):D(!0)},children:[d.jsx(X3,{className:"w-4 h-4 mr-2"}),t("marketplace.viewMap")]}),d.jsxs(tt,{size:"lg",variant:"outline",className:"relative backdrop-blur-md bg-background/50 touch-manipulation","data-testid":"button-view-events",onClick:()=>{i?c("/events"):D(!0)},children:[d.jsx(Hp,{className:"w-4 h-4 mr-2"}),"Eventi",i&&o>0&&d.jsx(En,{variant:"destructive",className:"absolute -right-2 -top-2 h-5 min-w-5 px-1 text-xs",children:o})]}),i?d.jsx(Aq,{variant:"hero"}):d.jsxs(tt,{size:"lg",variant:"outline",className:"backdrop-blur-md bg-background/50","data-testid":"button-support-project",onClick:()=>D(!0),children:[d.jsx(ig,{className:"w-4 h-4 mr-2"}),t("marketplace.supportProject")]})]})]})})]}),d.jsx(O2e,{}),i&&d.jsx(H2e,{}),Ot.length>0&&d.jsxs("section",{className:"max-w-7xl mx-auto px-6 py-8",children:[d.jsxs("div",{className:"mb-6",children:[d.jsx("h2",{className:"text-2xl font-bold","data-testid":"text-users-title",children:t("marketplace.foundUsers")}),d.jsxs("p",{className:"text-muted-foreground mt-1","data-testid":"text-users-count",children:[Ot.length," ",Ot.length===1?t("marketplace.userFound"):t("marketplace.usersFound")]})]}),d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-4","data-testid":"grid-users",children:Ot.map(ei=>d.jsx(yr,{href:`/store/${ei.id}`,className:"p-4 border rounded-lg hover-elevate cursor-pointer block","data-testid":`link-user-${ei.id}`,children:d.jsxs("div",{className:"flex items-center gap-3",children:[ei.profileImageUrl?d.jsx("img",{src:ei.profileImageUrl,alt:`${ei.firstName} ${ei.lastName}`,className:"w-12 h-12 rounded-full object-cover"}):d.jsx("div",{className:"w-12 h-12 rounded-full bg-muted flex items-center justify-center",children:d.jsx(ju,{className:"w-6 h-6 text-muted-foreground"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("p",{className:"font-medium truncate","data-testid":`text-user-name-${ei.id}`,children:[ei.firstName," ",ei.lastName]}),ei.profession&&d.jsx("p",{className:"text-sm text-muted-foreground truncate","data-testid":`text-user-profession-${ei.id}`,children:ei.profession})]})]})},ei.id))})]}),d.jsxs("section",{id:"listings",className:"max-w-7xl mx-auto px-6 py-16",children:[d.jsx("div",{className:"flex items-center justify-between mb-8",children:d.jsxs("div",{children:[d.jsx("h2",{className:"text-3xl font-bold","data-testid":"text-listings-title",children:!W&&!f&&x==="all"&&!C?t("marketplace.featuredListings"):t("marketplace.allListings")||"Tutti gli annunci"}),d.jsxs("p",{className:"text-muted-foreground mt-1","data-testid":"text-listings-count",children:[Rt.length," ",Rt.length===1?"listing":"listings"," available"]})]})}),Ci?d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[1,2,3,4,5,6].map(ei=>d.jsx("div",{className:"bg-muted animate-pulse rounded-lg h-[400px]"},ei))}):Rt.length===0?d.jsxs("div",{className:"text-center py-16","data-testid":"text-no-listings",children:[d.jsx("p",{className:"text-xl text-muted-foreground",children:t("marketplace.noListingsTitle")}),d.jsx("p",{className:"text-muted-foreground mt-2",children:t("marketplace.noListingsDesc")})]}):d.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8","data-testid":"grid-listings",children:Rt.map(ei=>d.jsx(_ie,{listing:ei},ei.id))})]}),d.jsx("footer",{className:"border-t mt-20",children:d.jsx("div",{className:"max-w-7xl mx-auto px-6 py-8",children:d.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-center gap-4 text-sm text-muted-foreground",children:[d.jsx("p",{children:"© 2024 Comunità Economica Indipendente"}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("a",{href:"/privacy",className:"hover:text-foreground transition-colors","data-testid":"link-privacy-policy",children:"Privacy Policy"}),d.jsx("a",{href:"/chi-siamo",className:"hover:text-foreground transition-colors","data-testid":"link-about-footer",children:"Chi Siamo"}),d.jsx("a",{href:"/faq",className:"hover:text-foreground transition-colors","data-testid":"link-faq-footer",children:"FAQ"})]})]})})}),d.jsx(q_,{open:N,onOpenChange:D,children:d.jsxs(gg,{children:[d.jsxs(yg,{children:[d.jsx(vg,{children:t("marketplace.authRequired")}),d.jsx(xg,{children:t("marketplace.authRequiredDesc")})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-auth",children:t("common.cancel")}),d.jsx(H_,{asChild:!0,"data-testid":"button-confirm-auth",children:d.jsx("a",{href:Eq(),children:t("common.signIn")})})]})]})})]})}function Aq({variant:t="header"}){const{t:e}=pr(),{toast:i}=ks(),n="IT69V0760113700001079832869",o="DONAZIONE",c=(f,r)=>{navigator.clipboard.writeText(f).then(()=>{i({title:e("common.copied","Copiato!"),description:`${r} ${e("common.copiedToClipboard","copiato negli appunti")}`})})};return d.jsxs(ll,{children:[d.jsx(vie,{asChild:!0,children:t==="hero"?d.jsxs(tt,{size:"lg",variant:"outline",className:"backdrop-blur-md bg-background/50","data-testid":"button-support-project",children:[d.jsx(ig,{className:"w-4 h-4 mr-2"}
808),e("marketplace.supportProject")]}):d.jsx(tt,{variant:"ghost",size:"icon","data-testid":"button-donate-header",className:"touch-manipulation",children:d.jsx(ig,{className:"w-4 h-4"})})}),d.jsxs(Va,{className:"max-w-md max-h-[90vh] overflow-y-auto","data-testid":"dialog-donation",children:[d.jsxs(cl,{children:[d.jsxs($a,{className:"flex items-center gap-2 text-base sm:text-lg",children:[d.jsx(ig,{className:"w-4 h-4 sm:w-5 sm:h-5 text-destructive shrink-0"}),e("marketplace.donationTitle","Sostieni il progetto CEI")]}),d.jsx(Oc,{className:"text-xs sm:text-sm",children:e("marketplace.donationBankDesc","Per sostenere il progetto CEI puoi effettuare un versamento alle seguenti coordinate.")})]}),d.jsxs("div",{className:"space-y-3 sm:space-y-5 py-2 sm:py-4",children:[d.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankName","Banca")}),d.jsx("p",{className:"text-sm font-semibold","data-testid":"text-donation-bank-name",children:"BancoPosta"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankRecipient","Intestatario")}),d.jsx("p",{className:"text-xs sm:text-sm font-semibold","data-testid":"text-donation-bank-recipient",children:"Associazione Comunità Economica Indipendente"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"IBAN"}),d.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[d.jsx("code",{className:"text-xs sm:text-sm font-mono bg-muted px-2 py-1 rounded flex-1 break-all leading-relaxed","data-testid":"text-donation-iban",children:n}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>c(n,"IBAN"),"data-testid":"button-copy-donation-iban",children:d.jsx(QT,{className:"w-4 h-4"})})]})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankCausale","Causale")}),d.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[d.jsx("p",{className:"text-xs sm:text-sm font-semibold bg-muted px-2 py-1 rounded flex-1 break-words leading-relaxed","data-testid":"text-donation-causale",children:o}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>c(o,e("marketplace.bankCausale","Causale")),"data-testid":"button-copy-donation-causale",children:d.jsx(QT,{className:"w-4 h-4"})})]})]})]}),d.jsx("p",{className:"text-sm font-semibold text-center text-primary",children:e("marketplace.donationThanks","GRAZIE!")})]})]})]})}var Rne={exports:{}};(function(t,e){(function(i,n){t.exports=n()})(LS,function(){var i,n,o;function c(r,x){if(!i)i=x;else if(!n)n=x;else{var S="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 = {}; ("+i+")(sharedChunk); ("+n+")(sharedChunk); self.onerror = null;",C={};i(C),o=x(C),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(o.workerUrl=window.URL.createObjectURL(new Blob([S],{type:"text/javascript"})))}}c(["exports"],function(r){var x=1e-6,S=typeof Float32Array<"u"?Float32Array:Array;function C(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=l*_-m*p;return v?(u[0]=_*(v=1/v),u[1]=-p*v,u[2]=-m*v,u[3]=l*v,u):null}function I(){var u=new S(9);return S!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[5]=0,u[6]=0,u[7]=0),u[0]=1,u[4]=1,u[8]=1,u}function N(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=s[4],w=s[5],A=s[6],k=s[7],R=s[8];return u[0]=v*R-w*k,u[1]=m*k-p*R,u[2]=p*w-m*v,u[3]=w*A-_*R,u[4]=l*R-m*A,u[5]=m*_-l*w,u[6]=_*k-v*A,u[7]=p*A-l*k,u[8]=l*v-p*_,u}function D(u,s,l){var p=s[0],m=s[1],_=s[2],v=s[3],w=s[4],A=s[5],k=s[6],R=s[7],j=s[8],z=l[0],U=l[1],q=l[2],X=l[3],Q=l[4],ee=l[5],oe=l[6],le=l[7],de=l[8];return u[0]=z*p+U*v+q*k,u[1]=z*m+U*w+q*R,u[2]=z*_+U*A+q*j,u[3]=X*p+Q*v+ee*k,u[4]=X*m+Q*w+ee*R,u[5]=X*_+Q*A+ee*j,u[6]=oe*p+le*v+de*k,u[7]=oe*m+le*w+de*R,u[8]=oe*_+le*A+de*j,u}function V(){var u=new S(16);return S!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u}function B(u){var s=new S(16);return s[0]=u[0],s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5],s[6]=u[6],s[7]=u[7],s[8]=u[8],s[9]=u[9],s[10]=u[10],s[11]=u[11],s[12]=u[12],s[13]=u[13],s[14]=u[14],s[15]=u[15],s}function W(u){return u[0]=1,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}function $(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=s[4],w=s[5],A=s[6],k=s[7],R=s[8],j=s[9],z=s[10],U=s[11],q=s[12],X=s[13],Q=s[14],ee=s[15],oe=l*w-p*v,le=l*A-m*v,de=l*k-_*v,Ae=p*A-m*w,xe=p*k-_*w,Me=m*k-_*A,Le=R*X-j*q,Be=R*Q-z*q,ut=R*ee-U*q,Xe=j*Q-z*X,ht=j*ee-U*X,_t=z*ee-U*Q,bt=oe*_t-le*ht+de*Xe+Ae*ut-xe*Be+Me*Le;return bt?(u[0]=(w*_t-A*ht+k*Xe)*(bt=1/bt),u[1]=(m*ht-p*_t-_*Xe)*bt,u[2]=(X*Me-Q*xe+ee*Ae)*bt,u[3]=(z*xe-j*Me-U*Ae)*bt,u[4]=(A*ut-v*_t-k*Be)*bt,u[5]=(l*_t-m*ut+_*Be)*bt,u[6]=(Q*de-q*Me-ee*le)*bt,u[7]=(R*Me-z*de+U*le)*bt,u[8]=(v*ht-w*ut+k*Le)*bt,u[9]=(p*ut-l*ht-_*Le)*bt,u[10]=(q*xe-X*de+ee*oe)*bt,u[11
vendor: 2,757 bytes, line 808
808]=(j*de-R*xe-U*oe)*bt,u[12]=(w*Be-v*Xe-A*Le)*bt,u[13]=(l*Xe-p*Be+m*Le)*bt,u[14]=(X*le-q*Ae-Q*oe)*bt,u[15]=(R*Ae-j*le+z*oe)*bt,u):null}function G(u,s,l){var p=s[0],m=s[1],_=s[2],v=s[3],w=s[4],A=s[5],k=s[6],R=s[7],j=s[8],z=s[9],U=s[10],q=s[11],X=s[12],Q=s[13],ee=s[14],oe=s[15],le=l[0],de=l[1],Ae=l[2],xe=l[3];return u[0]=le*p+de*w+Ae*j+xe*X,u[1]=le*m+de*A+Ae*z+xe*Q,u[2]=le*_+de*k+Ae*U+xe*ee,u[3]=le*v+de*R+Ae*q+xe*oe,u[4]=(le=l[4])*p+(de=l[5])*w+(Ae=l[6])*j+(xe=l[7])*X,u[5]=le*m+de*A+Ae*z+xe*Q,u[6]=le*_+de*k+Ae*U+xe*ee,u[7]=le*v+de*R+Ae*q+xe*oe,u[8]=(le=l[8])*p+(de=l[9])*w+(Ae=l[10])*j+(xe=l[11])*X,u[9]=le*m+de*A+Ae*z+xe*Q,u[10]=le*_+de*k+Ae*U+xe*ee,u[11]=le*v+de*R+Ae*q+xe*oe,u[12]=(le=l[12])*p+(de=l[13])*w+(Ae=l[14])*j+(xe=l[15])*X,u[13]=le*m+de*A+Ae*z+xe*Q,u[14]=le*_+de*k+Ae*U+xe*ee,u[15]=le*v+de*R+Ae*q+xe*oe,u}function te(u,s,l){var p,m,_,v,w,A,k,R,j,z,U,q,X=l[0],Q=l[1],ee=l[2];return s===u?(u[12]=s[0]*X+s[4]*Q+s[8]*ee+s[12],u[13]=s[1]*X+s[5]*Q+s[9]*ee+s[13],u[14]=s[2]*X+s[6]*Q+s[10]*ee+s[14],u[15]=s[3]*X+s[7]*Q+s[11]*ee+s[15]):(m=s[1],_=s[2],v=s[3],w=s[4],A=s[5],k=s[6],R=s[7],j=s[8],z=s[9],U=s[10],q=s[11],u[0]=p=s[0],u[1]=m,u[2]=_,u[3]=v,u[4]=w,u[5]=A,u[6]=k,u[7]=R,u[8]=j,u[9]=z,u[10]=U,u[11]=q,u[12]=p*X+w*Q+j*ee+s[12],u[13]=m*X+A*Q+z*ee+s[13],u[14]=_*X+k*Q+U*ee+s[14],u[15]=v*X+R*Q+q*ee+s[15]),u}function ce(u,s,l){var p=l[0],m=l[1],_=l[2];return u[0]=s[0]*p,u[1]=s[1]*p,u[2]=s[2]*p,u[3]=s[3]*p,u[4]=s[4]*m,u[5]=s[5]*m,u[6]=s[6]*m,u[7]=s[7]*m,u[8]=s[8]*_,u[9]=s[9]*_,u[10]=s[10]*_,u[11]=s[11]*_,u[12]=s[12],u[13]=s[13],u[14]=s[14],u[15]=s[15],u}function _e(u,s,l){var p=Math.sin(l),m=Math.cos(l),_=s[4],v=s[5],w=s[6],A=s[7],k=s[8],R=s[9],j=s[10],z=s[11];return s!==u&&(u[0]=s[0],u[1]=s[1],u[2]=s[2],u[3]=s[3],u[12]=s[12],u[13]=s[13],u[14]=s[14],u[15]=s[15]),u[4]=_*m+k*p,u[5]=v*m+R*p,u[6]=w*m+j*p,u[7]=A*m+z*p,u[8]=k*m-_*p,u[9]=R*m-v*p,u[10]=j*m-w*p,u[11]=z*m-A*p,u}function Te(u,s,l){var p=Math.sin(l),m=Math.cos(l),_=s[0],v=s[1],w=s[2],A=s[3],k=s[8],R=s[9],j=s[10],z=s[11];return s!==u&&(u[4]=s[4],u[5]=s[5],u[6]=s[6],u[7]=s[7],u[12]=s[12],u[13]=s[13],u[14]=s[14],u[15]=s[15]),u[0]=_*m-k*p,u[1]=v*m-R*p,u[2]=w*m-j*p,u[3]=A*m-z*p,u[8]=_*p+k*m,u[9]=v*p+R*m,u[10]=w*p+j*m,u[11]=A*p+z*m,u}function we(u,s,l){var p=Math.sin(l),m=Math.cos(l),_=s[0],v=s[1],w=s[2],A=s[3],k=s[4],R=s[5],j=s[6],z=s[7];return s!==u&&(u[8]=s[8],u[9]=s[9],u[10]=s[10],u[11]=s[11],u[12]=s[12],u[13]=s[13],u[14]=s[14],u[15]=s[15]),u[0]=_*m+k*p,u[1]=v*m+R*p,u[2]=w*m+j*p,u[3]=A*m+z*p,u[4]=k*m-_*p,u[5]=R*m-v*p,u[6]=j*m-w*p,u[7]=z*m-A*p,u}function Ne(u,s){return u[0]=s[0],u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=s[1],u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=s[2],u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}function pe(u,s,l){var p,m,_,v=l[0],w=l[1],A=l[2],k=Math.sqrt(v*v+w*w+A*A);
vendor: 4,821 bytes, line 808
808return k<x?null:(v*=k=1/k,w*=k,A*=k,p=Math.sin(s),m=Math.cos(s),u[0]=v*v*(_=1-m)+m,u[1]=w*v*_+A*p,u[2]=A*v*_-w*p,u[3]=0,u[4]=v*w*_-A*p,u[5]=w*w*_+m,u[6]=A*w*_+v*p,u[7]=0,u[8]=v*A*_+w*p,u[9]=w*A*_-v*p,u[10]=A*A*_+m,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u)}function Pe(u,s){var l=s[0],p=s[1],m=s[2],_=s[4],v=s[5],w=s[6],A=s[8],k=s[9],R=s[10];return u[0]=Math.sqrt(l*l+p*p+m*m),u[1]=Math.sqrt(_*_+v*v+w*w),u[2]=Math.sqrt(A*A+k*k+R*R),u}function De(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=l+l,w=p+p,A=m+m,k=l*v,R=p*v,j=p*w,z=m*v,U=m*w,q=m*A,X=_*v,Q=_*w,ee=_*A;return u[0]=1-j-q,u[1]=R+ee,u[2]=z-Q,u[3]=0,u[4]=R-ee,u[5]=1-k-q,u[6]=U+X,u[7]=0,u[8]=z+Q,u[9]=U-X,u[10]=1-k-j,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}var Je=G;function dt(){var u=new S(3);return S!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0),u}function At(u){var s=new S(3);return s[0]=u[0],s[1]=u[1],s[2]=u[2],s}function qt(u){var s=u[0],l=u[1],p=u[2];return Math.sqrt(s*s+l*l+p*p)}function kt(u,s,l){var p=new S(3);return p[0]=u,p[1]=s,p[2]=l,p}function Vt(u,s,l,p){return u[0]=s,u[1]=l,u[2]=p,u}function Fe(u,s,l){return u[0]=s[0]+l[0],u[1]=s[1]+l[1],u[2]=s[2]+l[2],u}function lt(u,s,l){return u[0]=s[0]-l[0],u[1]=s[1]-l[1],u[2]=s[2]-l[2],u}function pt(u,s,l){return u[0]=s[0]*l[0],u[1]=s[1]*l[1],u[2]=s[2]*l[2],u}function Ge(u,s,l){return u[0]=Math.min(s[0],l[0]),u[1]=Math.min(s[1],l[1]),u[2]=Math.min(s[2],l[2]),u}function Rt(u,s,l){return u[0]=Math.max(s[0],l[0]),u[1]=Math.max(s[1],l[1]),u[2]=Math.max(s[2],l[2]),u}function Ot(u,s,l){return u[0]=s[0]*l,u[1]=s[1]*l,u[2]=s[2]*l,u}function Ci(u,s,l,p){return u[0]=s[0]+l[0]*p,u[1]=s[1]+l[1]*p,u[2]=s[2]+l[2]*p,u}function Hi(u,s){var l=s[0]-u[0],p=s[1]-u[1],m=s[2]-u[2];return Math.sqrt(l*l+p*p+m*m)}function ei(u,s){var l=s[0]-u[0],p=s[1]-u[1],m=s[2]-u[2];return l*l+p*p+m*m}function si(u){var s=u[0],l=u[1],p=u[2];return s*s+l*l+p*p}function Oi(u,s){return u[0]=-s[0],u[1]=-s[1],u[2]=-s[2],u}function Ei(u,s){var l=s[0],p=s[1],m=s[2],_=l*l+p*p+m*m;return _>0&&(_=1/Math.sqrt(_)),u[0]=s[0]*_,u[1]=s[1]*_,u[2]=s[2]*_,u}function Ai(u,s){return u[0]*s[0]+u[1]*s[1]+u[2]*s[2]}function Xi(u,s,l){var p=s[0],m=s[1],_=s[2],v=l[0],w=l[1],A=l[2];return u[0]=m*A-_*w,u[1]=_*v-p*A,u[2]=p*w-m*v,u}function Nn(u,s,l,p){var m=s[0],_=s[1],v=s[2];return u[0]=m+p*(l[0]-m),u[1]=_+p*(l[1]-_),u[2]=v+p*(l[2]-v),u}function zi(u,s,l){var p=s[0],m=s[1],_=s[2],v=l[3]*p+l[7]*m+l[11]*_+l[15];return u[0]=(l[0]*p+l[4]*m+l[8]*_+l[12])/(v=v||1),u[1]=(l[1]*p+l[5]*m+l[9]*_+l[13])/v,u[2]=(l[2]*p+l[6]*m+l[10]*_+l[14])/v,u}function Gi(u,s,l){var p=s[0],m=s[1],_=s[2];return u[0]=p*l[0]+m*l[3]+_*l[6],u[1]=p*l[1]+m*l[4]+_*l[7],u[2]=p*l[2]+m*l[5]+_*l[8],u}function Sr(u,s,l){var p=l[0],m=l[1],_=l[2],v=l[3],w=s[0],A=s[1],k=s[2],R=m*k-_*A,j=_*w-p*k,z=p*A-m*w;return u[0]=w+v*(R+=R)+m*(z+=z)-_*(j+=j),u[1]=A+v*j+_*R-p*z,u[2]=k+v*z+p*j-m*R,u}function Kr(u){return u[0]=0,u[1]=0,u[2]=0,u}function rs(u,s){return u[0]===s[0]&&u[1]===s[1]&&u[2]===s[2]}var Yn=lt,Ys=pt,Ia=qt;function Qs(){var u=new S(4);return S!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0,u[3]=0),u}function ot(u,s,l){return u[0]=s[0]*l,u[1]=s[1]*l,u[2]=s[2]*l,u[3]=s[3]*l,u}function Pt(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=l*l+p*p+m*m+_*_;return v>0&&(v=1/Math.sqrt(v)),u[0]=l*v,u[1]=p*v,u[2]=m*v,u[3]=_*v,u}function $t(u,s,l){var p=s[0],m=s[1],_=s[2],v=s[3];return u[0]=l[0]*p+l[4]*m+l[8]*_+l[12]*v,u[1]=l[1]*p+l[5]*m+l[9]*_+l[13]*v,u[2]=l[2]*p+l[6]*m+l[10]*_+l[14]*v,u[3]=l[3]*p+l[7]*m+l[11]*_+l[15]*v,u}function Li(){var u=new S(4);return S!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0),u[3]=1,u}function wi(u){return u[0]=0,u[1]=0,u[2]=0,u[3]=1,u}function pi(u,s,l){l*=.5;var p=s[0],m=s[1],_=s[2],v=s[3],w=Math.sin(l),A=Math.cos(l);return u[0]=p*A+v*w,u[1]=m*A+_*w,u[2]=_*A-m*w,u[3]=v*A-p*w,u}function en(u,s,l){l*=.5;var p=s[0],m=s[1],_=s[2],v=s[3],w=Math.sin(l),A=Math.cos(l);return u[0]=p*A-_*w,u[1]=m*A+v*w,u[2]=_*A+p*w,u[3]=v*A-m*w,u}dt(),Qs();var jn,ss,es,dl=Pt,ta=(jn=dt(),ss=kt(1,0,0),es=kt(0,1,0),function(u,s,l){var p=Ai(s,l);return p<-.999999?(Xi(jn,ss,s),Ia(jn)<1e-6&&Xi(jn,es,s),Ei(jn,jn),function(m,_,v){v*=.5;var w=Math.sin(v);m[0]=w*_[0],m[1]=w*_[1],m[2]=w*_[2],m[3]=Math.cos(v)}(u,jn,Math.PI),u):p>.999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(Xi(jn,s,l),u[0]=jn[0],u[1]=jn[1],u[2]=jn[2],u[3]=1+p,dl(u,u))});function Fr(){var u=new S(2);return S!=Float32Array&&(u[0]=0,u[1]=0),u}function co(u,s){var l=new S(2);return l[0]=u,l[1]=s,l}function qo(u,s,l){return u[0]=s,u[1]=l,u}function ia(u,s,l){return u[0]=s[0]+l[0],u[1]=s[1]+l[1],u}function Qe(u,s,l){return u[0]=s[0]-l[0],u[1]=s[1]-l[1],u}function Di(u,s,l){return u[0]=s[0]*l,u[1]=s[1]*l,u}function bn(u){var s=u[0],l=u[1];return Math.sqrt(s*s+l*l)}function Br(u,s){var l=s[0],p=s[1],m=l*l+p*p;return m>0&&(m=1/Math.sqrt(m)),u[0]=s[0]*m,u[1]=s[1]*m,u}function na(u,s){return u[0]*s[0]+u[1]*s[1]}Li(),Li(),I();var yo,Mo,hu=Qe;
808function qs(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}Fr();var pu=function(){if(Mo)return yo;function u(s,l,p,m){this.cx=3*s,this.bx=3*(p-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*l,this.by=3*(m-l)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=l,this.p2x=p,this.p2y=m}return Mo=1,yo=u,u.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,l){if(l===void 0&&(l=1e-6),s<0)return 0;if(s>1)return 1;for(var p=s,m=0;m<8;m++){var _=this.sampleCurveX(p)-s;if(Math.abs(_)<l)return p;var v=this.sampleCurveDerivativeX(p);if(Math.abs(v)<1e-6)break;p-=_/v}var w=0,A=1;for(p=s,m=0;m<20&&(_=this.sampleCurveX(p),!(Math.abs(_-s)<l));m++)s>_?w=p:A=p,p=.5*(A-w)+w;return p},solve:function(s,l){return this.sampleCurveY(this.solveCurveX(s,l))}},yo}(),Hd=qs(pu);function Tt(u,s){this.x=u,this.y=s}function Nl(u,s){if(Array.isArray(u)){if(!Array.isArray(s)||u.length!==s.length)return!1;for(let l=0;l<u.length;l++)if(!Nl(u[l],s[l]))return!1;return!0}if(typeof u=="object"&&u!==null&&s!==null){if(typeof s!="object"||Object.keys(u).length!==Object.keys(s).length)return!1;for(const l in u)if(!Nl(u[l],s[l]))return!1;return!0}return u===s}Tt.prototype={clone(){return new Tt(this.x,this.y)},add(u){return this.clone()._add(u)},sub(u){return this.clone()._sub(u)},multByPoint(u){return this.clone()._multByPoint(u)},divByPoint(u){return this.clone()._divByPoint(u)},mult(u){return this.clone()._mult(u)},div(u){return this.clone()._div(u)},rotate(u){return this.clone()._rotate(u)},rotateAround(u,s){return this.clone()._rotateAround(u,s)},matMult(u){return this.clone()._matMult(u)},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(u){return this.x===u.x&&this.y===u.y},dist(u){return Math.sqrt(this.distSqr(u))},distSqr(u){const s=u.x-this.x,l=u.y-this.y;return s*s+l*l},angle(){return Math.atan2(this.y,this.x)},angleTo(u){return Math.atan2(this.y-u.y,this.x-u.x)},angleWith(u){return this.angleWithSep(u.x,u.y)},angleWithSep(u,s){return Math.atan2(this.x*s-this.y*u,this.x*u+this.y*s)},_matMult(u){const s=u[2]*this.x+u[3]*this.y;return this.x=u[0]*this.x+u[1]*this.y,this.y=s,this},_add(u){return this.x+=u.x,this.y+=u.y,this},_sub(u){return this.x-=u.x,this.y-=u.y,this},_mult(u){return this.x*=u,this.y*=u,this},_div(u){return this.x/=u,this.y/=u,this},_multByPoint(u){return this.x*=u.x,this.y*=u.y,this},_divByPoint(u){return this.x/=u.x,this.y/=u.y,this},_unit(){return this._div(this.mag()),this},_perp(){const u=this.y;return this.y=this.x,this.x=-u,this},_rotate(u){const s=Math.cos(u),l=Math.sin(u),p=l*this.x+s*this.y;return this.x=s*this.x-l*this.y,this.y=p,this},_rotateAround(u,s){const l=Math.cos(u),p=Math.sin(u),m=s.y+p*(this.x-s.x)+l*(this.y-s.y);return this.x=s.x+l*(this.x-s.x)-p*(this.y-s.y),this.y=m,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Tt},Tt.convert=function(u){if(u instanceof Tt)return u;if(Array.isArray(u))return new Tt(+u[0],+u[1]);if(u.x!==void 0&&u.y!==void 0)return new Tt(+u.x,+u.y);throw new Error("Expected [x, y] or {x, y} point format")};const Gd=Math.PI/180,Wd=180/Math.PI;function Pn(u){return u*Gd}function Ms(u){return u*Wd}const Vc=[[0,0],[1,0],[1,1],[0,1]];function Kd(u){if(u<=0)return 0;if(u>=1)return 1;const s=u*u,l=s*u;return 4*(u<.5?l:3*(u-s)+l-.75)}function We(u,s,l,p){const m=new Hd(u,s,l,p);return function(_){return m.solve(_)}}const ie=We(.25,.1,.25,1);function re(u,s,l){return Math.min(l,Math.max(s,u))}function ge(u,s,l){return(l=re((l-u)/(s-u),0,1))*l*(3-2*l)}function ze(u,s,l){const p=l-s,m=((u-s)%p+p)%p+s;return m===s?l:m}function Re(u,s,l){if(!u.length)return l(null,[]);let p=u.length;const m=new Array(u.length);let _=null;u.forEach((v,w)=>{s(v,(A,k)=>{A&&(_=A),m[w]=k,--p==0&&l(_,m)})})}let Ue=1;function rt(){return Ue++}function He(u){return u<=1?1:Math.pow(2,Math.ceil(Math.log2(u)))}function Ve(u,s){u.forEach(l=>{s[l]&&(s[l]=s[l].bind(s))})}function Ee(u,s,l){const p={};for(const m in u)p[m]=s.call(this,u[m],m,u);return p}function Ye(u,s,l){const p={};for(const m in u)s.call(this,u[m],m,u)&&(p[m]=u[m]);return p}function It(u){return Array.isArray(u)?u.map(It):typeof u=="object"&&u?Ee(u,It):u}function vi(u,s){for(let l=0;l<u.length;l++)if(s.indexOf(u[l])>=0)return!0;return!1}const bi={};function di(u){bi[u]||(typeof console<"u"&&console.warn(u),bi[u]=!0)}function Wi(u,s,l){return(l.y-u.y)*(s.x-u.x)>(s.y-u.y)*(l.x-u.x)}function ln(u){let s=0;for(let l,p,m=0,_=u.length,v=_-1;m<_;v=m++)l=u[m],p=u[v],s+=(p.x-l.x)*(l.y+p.y);return s}function Hn([u,s,l]){const p=Pn(s+90),m=Pn(l);return{x:u*Math.cos(p)*Math.sin(m),y:u*Math.sin(p)*Math.sin(m),z:u*Math.cos(m),azimuthal:s,polar:l}}function Zr(u){return(typeof self<"u"||u!==void 0)&&typeof WorkerGlobalScope<"u"&&(u!==void 0?u:self)instanceof WorkerGlobalScope}function _r(u){const s={};if(u.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(l,p,m,_)=>{const v=m||_;return s[p]=!v||v.toLowerCase(),""}),s["max-age"]){const l=parseInt(s["max-age"],10);isNaN(l)?delete s["max-age"]:s["max-age"]=l}return s}let xs=null;
808function ps(u,s){return[u[4*s],u[4*s+1],u[4*s+2],u[4*s+3]]}function fr(u,s,l,p){for(;s<l;){const m=s+l>>1;u[m]<p?s=m+1:l=m}return s}function Mn(u,s,l,p){for(;s<l;){const m=s+l>>1;u[m]<=p?s=m+1:l=m}return s}function Ur(u){return u>0?1/(1.001-u):1+u}function fs(u){return u>0?1-1/(1.001-u):-u}function Tr(u,s,l){return(u-s.min)*(l.max-l.min)/(s.max-s.min)+l.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 u=new URL(Vr.API_URL);return u.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":u.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.3.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function io(u){return Vr.API_URL_REGEX.test(u)}function ga(u){return Vr.API_SPRITE_REGEX.test(u)}let fc,Jh,uo,mc,ka,$c;function hl(){return fc==null&&(fc=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),fc}const pl={now:()=>mc!==void 0?mc:performance.now(),setNow(u){mc=u},restoreNow(){mc=void 0},frame(u){const s=requestAnimationFrame(u);return{cancel:()=>cancelAnimationFrame(s)}},getImageData(u,s=0){const{width:l,height:p}=u;ka||(ka=document.createElement("canvas"));const m=ka.getContext("2d",{willReadFrequently:!0});if(!m)throw new Error("failed to create canvas 2d context");return(l>ka.width||p>ka.height)&&(ka.width=l,ka.height=p),m.clearRect(-s,-s,l+2*s,p+2*s),m.drawImage(u,0,0,l,p),m.getImageData(-s,-s,l+2*s,p+2*s)},resolveURL:u=>(Jh||(Jh=document.createElement("a")),Jh.href=u,Jh.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(uo==null&&(uo=window.matchMedia("(prefers-reduced-motion: reduce)")),uo.matches)},hasCanvasFingerprintNoise(){if($c!==void 0)return $c;if(!hl())return $c=!1,!1;const u=new OffscreenCanvas(85,1),s=u.getContext("2d",{willReadFrequently:!0});let l=0;for(let m=0;m<u.width;++m)s.fillStyle=`rgba(${l++},${l++},${l++}, 255)`,s.fillRect(m,0,1,1);const p=s.getImageData(0,0,u.width,u.height);l=0;for(let m=0;m<p.data.length;++m)if(m%4!=3&&l++!==p.data[m])return $c=!0,!0;return $c=!1,!1}};function fv(u,s){const l=u.indexOf("?");if(l<0)return`${u}?${new URLSearchParams(s).toString()}`;const p=new URLSearchParams(u.slice(l));for(const m in s)p.set(m,s[m]);return`${u.slice(0,l)}?${p.toString()}`}
808function qg(u,s={persistentParams:[]}){const l=u.indexOf("?");if(l<0)return u;const p=new URLSearchParams,m=new URLSearchParams(u.slice(l));for(const v of s.persistentParams){const w=m.get(v);w&&p.set(v,w)}const _=p.toString();return`${u.slice(0,l)}${_.length>0?`?${_}`:""}`}const Hg="mapbox-tiles";let Gg=500,Xa=50;const qc=["language","worldview","jobid"];let Pa,Ml;function Hu(){try{return caches}catch{}}function ep(){const u=Hu();u&&Pa==null&&(Pa=u.open(Hg))}let mv=1/0;const gv={supported:!1,testSupport:function(u){!u1&&Zd&&(FE?d1(u):fu=u)}};let fu,Zd,u1=!1,FE=!1;const gc=typeof self<"u"?self:{};function d1(u){const s=u.createTexture();u.bindTexture(u.TEXTURE_2D,s);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Zd),u.isContextLost())return;gv.supported=!0}catch{}u.deleteTexture(s),u1=!0}gc.document&&(Zd=gc.document.createElement("img"),Zd.onload=function(){fu&&d1(fu),fu=null,FE=!0},Zd.onerror=function(){u1=!0,fu=null},Zd.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const tp={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(tp);class ip extends Error{constructor(s,l,p){l===401&&io(p)&&(s+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(s),this.status=l,this.url=p}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const h1=Zr()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Wg=function(u,s){if(!(/^file:/.test(l=u.url)||/^file:/.test(h1())&&!/^\w+:/.test(l))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(p,m){const _=new AbortController,v=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,referrer:h1(),referrerPolicy:p.referrerPolicy,signal:_.signal});let w=!1,A=!1;const k=(R=v.url).indexOf("sku=")>0&&io(R);var R;p.type==="json"&&v.headers.set("Accept","application/json");const j=(U,q,X)=>{if(A)return;if(U&&U.message!=="SecurityError"&&di(U.toString()),q&&X)return z(q);const Q=Date.now();fetch(v).then(ee=>{if(ee.ok){const oe=k?ee.clone():null;return z(ee,oe,Q)}return m(new ip(ee.statusText,ee.status,p.url))}).catch(ee=>{ee.name!=="AbortError"&&m(new Error(`${ee.message} ${p.url}`))})},z=(U,q,X)=>{(p.type==="arrayBuffer"?U.arrayBuffer():p.type==="json"?U.json():U.text()).then(Q=>{A||(q&&X&&function(ee,oe,le){if(ep(),Pa==null)return;const de=_r(oe.headers.get("Cache-Control")||"");if(de["no-store"])return;const Ae={status:oe.status,statusText:oe.statusText,headers:new Headers};oe.headers.forEach((Le,Be)=>Ae.headers.set(Be,Le)),de["max-age"]&&Ae.headers.set("Expires",new Date(le+1e3*de["max-age"]).toUTCString());const xe=Ae.headers.get("Expires");if(!xe||new Date(xe).getTime()-le<42e4)return;
808let Me=qg(ee.url,{persistentParams:qc});if(oe.status===206){const Le=ee.headers.get("Range");if(!Le)return;Ae.status=200,Me=fv(Me,{range:Le})}(function(Le,Be){if(Ml===void 0)try{new Response(new ReadableStream),Ml=!0}catch{Ml=!1}Ml?Be(Le.body):Le.blob().then(Be).catch(ut=>di(ut.message))})(oe,Le=>{const Be=new Response((ut=oe.status)!==200&&ut!==404&&[101,103,204,205,304].includes(ut)?null:Le,Ae);var ut;ep(),Pa!=null&&Pa.then(Xe=>Xe.put(Me,Be)).catch(Xe=>di(Xe.message))})}(v,q,X),w=!0,m(null,Q,U.headers))}).catch(Q=>{A||m(new Error(Q.message))})};return k?function(U,q){if(ep(),Pa==null)return q(null);Pa.then(X=>{let Q=qg(U.url,{persistentParams:qc});const ee=U.headers.get("Range");ee&&(Q=fv(Q,{range:ee})),X.match(Q).then(oe=>{const le=function(de){if(!de)return!1;const Ae=new Date(de.headers.get("Expires")||0),xe=_r(de.headers.get("Cache-Control")||"");return Number(Ae)>Date.now()&&!xe["no-cache"]}(oe);X.delete(Q).catch(q),le&&X.put(Q,oe.clone()).catch(q),q(null,oe,le)}).catch(q)}).catch(q)}(v,j):j(null,null),{cancel:()=>{A=!0,w||_.abort()}}}(u,s);if(Zr(self)&&self.worker.actor)return self.worker.actor.send("getResource",u,s,void 0,!0)}var l;return function(p,m){const _=new XMLHttpRequest;_.open(p.method||"GET",p.url,!0),p.type==="arrayBuffer"&&(_.responseType="arraybuffer");for(const v in p.headers)_.setRequestHeader(v,p.headers[v]);return p.type==="json"&&(_.responseType="text",_.setRequestHeader("Accept","application/json")),_.withCredentials=p.credentials==="include",_.onerror=()=>{m(new Error(_.statusText))},_.onload=()=>{if((_.status>=200&&_.status<300||_.status===0)&&_.response!==null){let v=_.response;if(p.type==="json")try{v=JSON.parse(_.response)}catch(A){return m(A)}const w=new Headers;_.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(A=>{const k=A.split(": "),R=k.shift(),j=k.join(": ");w.append(R,j)}),m(null,v,w)}else m(new ip(_.statusText,_.status,p.url))},_.send(p.body),{cancel:()=>_.abort()}}(u,s)},yf=function(u,s){return Wg(Object.assign(u,{type:"arrayBuffer"}),s)};function ir(u){const s=document.createElement("a");return s.href=u,s.protocol===location.protocol&&s.host===location.host}const p1="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Kg,Zg;Kg=[],Zg=0;const f1=function(u,s){if(gv.supported&&(u.headers||(u.headers={}),u.headers.accept="image/webp,*/*"),Zg>=Vr.MAX_PARALLEL_IMAGE_REQUESTS){const _={requestParameters:u,callback:s,cancelled:!1,cancel(){this.cancelled=!0}};return Kg.push(_),_}Zg++;let l=!1;const p=()=>{if(!l)for(l=!0,Zg--;Kg.length&&Zg<Vr.MAX_PARALLEL_IMAGE_REQUESTS;){const _=Kg.shift(),{requestParameters:v,callback:w,cancelled:A}=_;A||(_.cancel=f1(v,w).cancel)}},m=yf(u,(_,v,w)=>{p(),_?s(_):v&&(self.createImageBitmap?function(A,k){const R=new Blob([new Uint8Array(A)],{type:"image/png"});createImageBitmap(R).then(j=>{k(null,j)}).catch(j=>{k(new Error(`Could not load image because of ${j.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(v,(A,k)=>s(A,k,w)):function(A,k){const R=new Image;R.onload=()=>{k(null,R),URL.revokeObjectURL(R.src),R.onload=null,requestAnimationFrame(()=>{R.src=p1})},R.onerror=()=>k(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 j=new Blob([new Uint8Array(A)],{type:"image/png"});R.src=A.byteLength?URL.createObjectURL(j):p1}(v,(A,k)=>s(A,k,w)))});return{cancel:()=>{m.cancel(),p()}}};var Xg,Yg,Qg,np={exports:{}},BE={exports:{}},yv={exports:{}},GM=function(){if(Qg)return np.exports;Qg=1;var u=(Xg||(Xg=1,BE.exports=function(l,p){var m,_,v,w,A,k,R,j;for(_=l.length-(m=3&l.length),v=p,A=3432918353,k=461845907,j=0;j<_;)R=255&l.charCodeAt(j)|(255&l.charCodeAt(++j))<<8|(255&l.charCodeAt(++j))<<16|(255&l.charCodeAt(++j))<<24,++j,v=27492+(65535&(w=5*(65535&(v=(v^=R=(65535&(R=(R=(65535&R)*A+(((R>>>16)*A&65535)<<16)&4294967295)<<15|R>>>17))*k+(((R>>>16)*k&65535)<<16)&4294967295)<<13|v>>>19))+((5*(v>>>16)&65535)<<16)&4294967295))+((58964+(w>>>16)&65535)<<16);switch(R=0,m){case 3:R^=(255&l.charCodeAt(j+2))<<16;case 2:R^=(255&l.charCodeAt(j+1))<<8;case 1:v^=R=(65535&(R=(R=(65535&(R^=255&l.charCodeAt(j)))*A+(((R>>>16)*A&65535)<<16)&4294967295)<<15|R>>>17))*k+(((R>>>16)*k&65535)<<16)&4294967295}
808return v^=l.length,v=2246822507*(65535&(v^=v>>>16))+((2246822507*(v>>>16)&65535)<<16)&4294967295,v=3266489909*(65535&(v^=v>>>13))+((3266489909*(v>>>16)&65535)<<16)&4294967295,(v^=v>>>16)>>>0}),BE.exports),s=(Yg||(Yg=1,yv.exports=function(l,p){for(var m,_=l.length,v=p^_,w=0;_>=4;)m=1540483477*(65535&(m=255&l.charCodeAt(w)|(255&l.charCodeAt(++w))<<8|(255&l.charCodeAt(++w))<<16|(255&l.charCodeAt(++w))<<24))+((1540483477*(m>>>16)&65535)<<16),v=1540483477*(65535&v)+((1540483477*(v>>>16)&65535)<<16)^(m=1540483477*(65535&(m^=m>>>24))+((1540483477*(m>>>16)&65535)<<16)),_-=4,++w;switch(_){case 3:v^=(255&l.charCodeAt(w+2))<<16;case 2:v^=(255&l.charCodeAt(w+1))<<8;case 1:v=1540483477*(65535&(v^=255&l.charCodeAt(w)))+((1540483477*(v>>>16)&65535)<<16)}return v=1540483477*(65535&(v^=v>>>13))+((1540483477*(v>>>16)&65535)<<16),(v^=v>>>15)>>>0}),yv.exports);return np.exports=u,np.exports.murmur3=u,np.exports.murmur2=s,np.exports}(),Jg=qs(GM);class Dl{constructor(s,...l){Object.assign(this,l[0]||{}),this.type=s}}class ey extends Dl{constructor(s,l={}){super("error",Object.assign({error:s},l))}}function _f(u,s,l){l[u]&&l[u].indexOf(s)!==-1||(l[u]=l[u]||[],l[u].push(s))}function ty(u,s,l){if(l&&l[u]){const p=l[u].indexOf(s);p!==-1&&l[u].splice(p,1)}}class Gu{on(s,l){return this._listeners=this._listeners||{},_f(s,l,this._listeners),this}off(s,l){return ty(s,l,this._listeners),ty(s,l,this._oneTimeListeners),this}once(s,l){return l?(this._oneTimeListeners=this._oneTimeListeners||{},_f(s,l,this._oneTimeListeners),this):new Promise(p=>{this.once(s,p)})}fire(s,l){const p=typeof s=="string"?new Dl(s,l):s,m=p.type;if(this.listens(m)){p.target=this;const _=this._listeners&&this._listeners[m]?this._listeners[m].slice():[];for(const A of _)A.call(this,p);const v=this._oneTimeListeners&&this._oneTimeListeners[m]?this._oneTimeListeners[m].slice():[];for(const A of v)ty(m,A,this._oneTimeListeners),A.call(this,p);const w=this._eventedParent;if(w){const A=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(p,A),w.fire(p)}}else p instanceof ey&&console.error(p.error);return this}listens(s){return!!(this._listeners&&this._listeners[s]&&this._listeners[s].length>0||this._oneTimeListeners&&this._oneTimeListeners[s]&&this._oneTimeListeners[s].length>0||this._eventedParent&&this._eventedParent.listens(s))}setEventedParent(s,l){return this._eventedParent=s,this._eventedParentData=l,this}}class no{constructor(s){typeof s=="string"?this.name=s:(this.name=s.name,this.iconsetId=s.iconsetId)}static from(s){return new no(s)}static toString(s){return s.iconsetId?`${s.name}�${s.iconsetId}`:s.name}static parse(s){const[l,p]=s.split("�");return new no({name:l,iconsetId:p})}static isEqual(s,l){return s.name===l.name&&s.iconsetId===l.iconsetId}toString(){return no.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var m1,g1={},y1=function(){if(m1)return g1;m1=1;var u={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 s(_){return(_=Math.round(_))<0?0:_>255?255:_}function l(_){return s(_[_.length-1]==="%"?parseFloat(_)/100*255:parseInt(_))}function p(_){return(v=_[_.length-1]==="%"?parseFloat(_)/100:parseFloat(_))<0?0:v>1?1:v;var v}function m(_,v,w){return w<0?w+=1:w>
vendor: 24,700 bytes, line 808
8081&&(w-=1),6*w<1?_+(v-_)*w*6:2*w<1?v:3*w<2?_+(v-_)*(2/3-w)*6:_}try{g1.parseCSSColor=function(_){var v,w=_.replace(/ /g,"").toLowerCase();if(w in u)return u[w].slice();if(w[0]==="#")return w.length===4?(v=parseInt(w.substr(1),16))>=0&&v<=4095?[(3840&v)>>4|(3840&v)>>8,240&v|(240&v)>>4,15&v|(15&v)<<4,1]:null:w.length===7&&(v=parseInt(w.substr(1),16))>=0&&v<=16777215?[(16711680&v)>>16,(65280&v)>>8,255&v,1]:null;var A=w.indexOf("("),k=w.indexOf(")");if(A!==-1&&k+1===w.length){var R=w.substr(0,A),j=w.substr(A+1,k-(A+1)).split(","),z=1;switch(R){case"rgba":if(j.length!==4)return null;z=p(j.pop());case"rgb":return j.length!==3?null:[l(j[0]),l(j[1]),l(j[2]),z];case"hsla":if(j.length!==4)return null;z=p(j.pop());case"hsl":if(j.length!==3)return null;var U=(parseFloat(j[0])%360+360)%360/360,q=p(j[1]),X=p(j[2]),Q=X<=.5?X*(q+1):X+q-X*q,ee=2*X-Q;return[s(255*m(ee,Q,U+1/3)),s(255*m(ee,Q,U)),s(255*m(ee,Q,U-1/3)),z];default:return null}}return null}}catch{}return g1}();class lr{constructor(s,l,p,m=1){this.r=s,this.g=l,this.b=p,this.a=m}static parse(s){if(!s)return;if(s instanceof lr)return s;if(typeof s!="string")return;const l=y1.parseCSSColor(s);return l?new lr(l[0]/255,l[1]/255,l[2]/255,l[3]):void 0}toString(){const[s,l,p,m]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*s)},${Math.round(255*l)},${Math.round(255*p)},${m})`}toNonPremultipliedRenderColor(s){const{r:l,g:p,b:m,a:_}=this;return new UE(s,l,p,m,_)}toPremultipliedRenderColor(s){const{r:l,g:p,b:m,a:_}=this;return new VE(s,l*_,p*_,m*_,_)}clone(){return new lr(this.r,this.g,this.b,this.a)}}class _1{constructor(s,l,p,m,_,v=!1){if(this.premultiplied=!1,this.premultiplied=v,s){const w=s.image.height,A=w*w;this.premultiplied?(l=_===0?0:l/_*(w-1),p=_===0?0:p/_*(w-1),m=_===0?0:m/_*(w-1)):(l*=w-1,p*=w-1,m*=w-1);const k=Math.floor(l),R=Math.floor(p),j=Math.floor(m),z=Math.ceil(l),U=Math.ceil(p),q=Math.ceil(m),X=l-k,Q=p-R,ee=m-j,oe=s.image.data,le=4*(k+R*A+j*w),de=4*(k+R*A+q*w),Ae=4*(k+U*A+j*w),xe=4*(k+U*A+q*w),Me=4*(z+R*A+j*w),Le=4*(z+R*A+q*w),Be=4*(z+U*A+j*w),ut=4*(z+U*A+q*w);if(le<0||ut>=oe.length)throw new Error("out of range");this.r=Vi(Vi(Vi(oe[le],oe[de],ee),Vi(oe[Ae],oe[xe],ee),Q),Vi(Vi(oe[Me],oe[Le],ee),Vi(oe[Be],oe[ut],ee),Q),X)/255*(this.premultiplied?_:1),this.g=Vi(Vi(Vi(oe[le+1],oe[de+1],ee),Vi(oe[Ae+1],oe[xe+1],ee),Q),Vi(Vi(oe[Me+1],oe[Le+1],ee),Vi(oe[Be+1],oe[ut+1],ee),Q),X)/255*(this.premultiplied?_:1),this.b=Vi(Vi(Vi(oe[le+2],oe[de+2],ee),Vi(oe[Ae+2],oe[xe+2],ee),Q),Vi(Vi(oe[Me+2],oe[Le+2],ee),Vi(oe[Be+2],oe[ut+2],ee),Q),X)/255*(this.premultiplied?_:1),this.a=_}else this.r=l,this.g=p,this.b=m,this.a=_}toArray(){const{r:s,g:l,b:p,a:m}=this;return[255*s,255*l,255*p,m]}toHslaArray(){let{r:s,g:l,b:p,a:m}=this;if(this.premultiplied){if(m===0)return[0,0,0,0];const q=1/m;s*=q,l*=q,p*=q}const _=Math.min(Math.max(s,0),1),v=Math.min(Math.max(l,0),1),w=Math.min(Math.max(p,0),1),A=Math.min(_,v,w),k=Math.max(_,v,w),R=k-A,j=.5*(A+k);if(R===0)return[0,0,100*j,m];const z=j>.5?R/(2-k-A):R/(k+A);let U;switch(k){case _:U=60*((v-w)/R+(v<w?6:0));break;case v:U=60*((w-_)/R+2);break;default:U=60*((_-v)/R+4)}return[U,100*z,100*j,m]}toArray01(){const{r:s,g:l,b:p,a:m}=this;return[s,l,p,m]}toArray01Scaled(s){const{r:l,g:p,b:m}=this;return[l*s,p*s,m*s]}toArray01Linear(){const{r:s,g:l,b:p,a:m}=this;return[Math.pow(s,2.2),Math.pow(l,2.2),Math.pow(p,2.2),m]}}class UE extends _1{constructor(s,l,p,m,_){super(s,l,p,m,_,!1)}}class VE extends _1{constructor(s,l,p,m,_){super(s,l,p,m,_,!0)}}function Vi(u,s,l){return u*(1-l)+s*l}function iy(u,s,l){return u.map((p,m)=>Vi(p,s[m],l))}lr.black=new lr(0,0,0,1),lr.white=new lr(1,1,1,1),lr.transparent=new lr(0,0,0,0),lr.red=new lr(1,0,0,1),lr.blue=new lr(0,0,1,1);var Wu=Object.freeze({__proto__:null,array:iy,color:function(u,s,l){return new lr(Vi(u.r,s.r,l),Vi(u.g,s.g,l),Vi(u.b,s.b,l),Vi(u.a,s.a,l))},number:Vi});class yc extends Error{constructor(s,l){super(l),this.message=l,this.key=s}}class _c{constructor(s,l=[]){this.parent=s,this.bindings={};for(const[p,m]of l)this.bindings[p]=m}concat(s){return new _c(this,s)}get(s){if(this.bindings[s])return this.bindings[s];if(this.parent)return this.parent.get(s);throw new Error(`${s} not found in scope.`)}has(s){return!!this.bindings[s]||!!this.parent&&this.parent.has(s)}}const vf={kind:"null"},xi={kind:"number"},Gn={kind:"string"},sr={kind:"boolean"},fl={kind:"color"},xf={kind:"object"},dr={kind:"value"},ny={kind:"collator"},rp={kind:"formatted"},ry={kind:"resolvedImage"};function Do(u,s){return{kind:"array",itemType:u,N:s}}function Js(u){if(u.kind==="array"){const s=Js(u.itemType);return typeof u.N=="number"?`array<${s}, ${u.N}>`:u.itemType.kind==="value"?"array":`array<${s}>`}return u.kind}const WM=[vf,xi,Gn,sr,fl,rp,xf,Do(dr),ry];function sy(u,s){if(s.kind==="error")return null;if(u.kind==="array"){if(s.kind==="array"&&(s.N===0&&s.itemType.kind==="value"||!sy(u.itemType,s.itemType))&&(typeof u.N!="number"||u.N===s.N))return null}else{if(u.kind===s.kind)return null;if(u.kind==="value"){for(const l of WM)if(!sy(l,s))return null}}return`Expected ${Js(u)} but found ${Js(s)} instead.`}function v1(u,s){return s.some(l=>l.kind===u.kind)}function oy(u,s){return s.some(l=>l==="null"?u===null:l==="array"?Array.isArray(u):l==="object"?u&&!Array.isArray(u)&&typeof u=="object":l===typeof u)}function _v(u,s){return u.kind==="array"&&s.kind==="array"?u.N===s.N&&_v(u.itemType,s.itemType):u.kind===s.kind}class x1{constructor(s,l,p){this.sensitivity=s?l?"variant":"case":l?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(s,l){return this.collator.compare(s,l)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ay{constructor(s,l,p,m,_){this.text=s.normalize?s.normalize():s,this.image=l,this.scale=p,this.fontStack=m,this.textColor=_}}class _o{constructor(s){this.sections=s}static fromString(s){return new _o([new ay(s,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(s=>s.text.length!==0||!!s.image&&s.image.hasPrimary())}static factory(s){return s instanceof _o?s:_o.fromString(s)}toString(){return this.sections.length===0?"":this.sections.map(s=>s.text).join("")}serialize(){const s=["format"];for(const l of this.sections){if(l.image){const m=l.image.getPrimary().id.toString();s.push(["image",m]);continue}s.push(l.text);const p={};l.fontStack&&(p["text-font"]=["literal",l.fontStack.split(",")]),l.scale&&(p["font-scale"]=l.scale),l.textColor&&(p["text-color"]=["rgba"].concat(l.textColor.toNonPremultipliedRenderColor(null).toArray())),s.push(p)}return s}}class Ku{constructor(s,l={}){if(this.id=no.from(s),this.options=Object.assign({},l),l.transform){const{a:p,b:m,c:_,d:v,e:w,f:A}=l.transform;this.options.transform=new DOMMatrix([p,m,_,v,w,A])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:s,b:l,c:p,d:m,e:_,f:v}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:s,b:l,c:p,d:m,e:_,f:v}})}static parse(s){let l,p,m,_;try{({name:l,iconsetId:p,params:m,transform:_}=JSON.parse(s)||{})}catch{return null}if(!l)return null;const{a:v,b:w,c:A,d:k,e:R,f:j}=_||{};return new Ku({name:l,iconsetId:p},{params:m,transform:new DOMMatrix([v,w,A,k,R,j])})}scaleSelf(s,l){return this.options.transform.scaleSelf(s,l),this}}class Ya{constructor(s,l,p,m,_=!1){this.primaryId=no.from(s),this.primaryOptions=l,p&&(this.secondaryId=no.from(p)),this.secondaryOptions=m,this.available=_}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Ku(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ku(this.secondaryId,this.secondaryOptions):null}static from(s){return typeof s=="string"?Ya.build({name:s}):s}static build(s,l,p,m){return!s||typeof s=="object"&&!("name"in s)?null:new Ya(s,p,l,m)}}function vv(u,s,l,p){return typeof u=="number"&&u>=0&&u<=255&&typeof s=="number"&&s>=0&&s<=255&&typeof l=="number"&&l>=0&&l<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[u,s,l,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[u,s,l,p]:[u,s,l]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bf(u){if(u===null||typeof u=="string"||typeof u=="boolean"||typeof u=="number"||u instanceof lr||u instanceof x1||u instanceof _o||u instanceof Ya)return!0;if(Array.isArray(u)){for(const s of u)if(!bf(s))return!1;return!0}if(typeof u=="object"){for(const s in u)if(!bf(u[s]))return!1;return!0}return!1}function ho(u){if(u===null)return vf;if(typeof u=="string")return Gn;if(typeof u=="boolean")return sr;if(typeof u=="number")return xi;if(u instanceof lr)return fl;if(u instanceof x1)return ny;if(u instanceof _o)return rp;if(u instanceof Ya)return ry;if(Array.isArray(u)){const s=u.length;let l;for(const p of u){const m=ho(p);if(l){if(l===m)continue;l=dr;break}l=m}return Do(l||dr,s)}return xf}function mu(u){const s=typeof u;return u===null?"":s==="string"||s==="number"||s==="boolean"?String(u):u instanceof _o||u instanceof Ya||u instanceof lr?u.toString():JSON.stringify(u)}class Zu{constructor(s,l){this.type=s,this.value=l}static parse(s,l){if(s.length!==2)return l.error(`'literal' expression requires exactly one argument, but found ${s.length-1} instead.`);if(!bf(s[1]))return l.error("invalid value");const p=s[1];let m=ho(p);const _=l.expectedType;return m.kind!=="array"||m.N!==0||!_||_.kind!=="array"||typeof _.N=="number"&&_.N!==0||(m=_),new Zu(m,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof lr?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof _o?this.value.serialize():this.value}}class Ds{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}}const mn={string:Gn,number:xi,boolean:sr,object:xf};class hi{constructor(s,l){this.type=s,this.args=l}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");let p,m=1;const _=s[0];if(_==="array"){let w,A;if(s.length>2){const k=s[1];if(typeof k!="string"||!(k in mn)||k==="object")return l.error('The item type argument of "array" must be one of string, number, boolean',1);w=mn[k],m++}else w=dr;if(s.length>3){if(s[2]!==null&&(typeof s[2]!="number"||s[2]<0||s[2]!==Math.floor(s[2])))return l.error('The length argument to "array" must be a positive integer literal',2);A=s[2],m++}p=Do(w,A)}else p=mn[_];const v=[];for(;m<s.length;m++){const w=l.parse(s[m],m,dr);if(!w)return null;v.push(w)}return new hi(p,v)}evaluate(s){for(let l=0;l<this.args.length;l++){const p=this.args[l].evaluate(s);if(!sy(this.type,ho(p)))return p;if(l===this.args.length-1)throw new Ds(`The expression ${JSON.stringify(this.args[l].serialize())} evaluated to ${Js(ho(p))} but was expected to be of type ${Js(this.type)}.`)}return null}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}serialize(){const s=this.type,l=[s.kind];if(s.kind==="array"){const p=s.itemType;if(p.kind==="string"||p.kind==="number"||p.kind==="boolean"){l.push(p.kind);const m=s.N;(typeof m=="number"||this.args.length>1)&&l.push(m)}}return l.concat(this.args.map(p=>p.serialize()))}}class sp{constructor(s){this.type=rp,this.sections=s}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");const p=s[1];if(!Array.isArray(p)&&typeof p=="object")return l.error("First argument must be an image or text section.");const m=[];let _=!1;for(let v=1;v<=s.length-1;++v){const w=s[v];if(_&&typeof w=="object"&&!Array.isArray(w)){_=!1;let A=null;if(w["font-scale"]&&(A=l.parseObjectValue(w["font-scale"],v,"font-scale",xi),!A))return null;let k=null;if(w["text-font"]&&(k=l.parseObjectValue(w["text-font"],v,"text-font",Do(Gn)),!k))return null;let R=null;if(w["text-color"]&&(R=l.parseObjectValue(w["text-color"],v,"text-color",fl),!R))return null;const j=m[m.length-1];j.scale=A,j.font=k,j.textColor=R}else{const A=l.parse(s[v],v,dr);if(!A)return null;const k=A.type.kind;if(k!=="string"&&k!=="value"&&k!=="null"&&k!=="resolvedImage")return l.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");_=!0,m.push({content:A,scale:null,font:null,textColor:null})}}return new sp(m)}evaluate(s){return new _o(this.sections.map(l=>{const p=l.content.evaluate(s);return _v(ho(p),ry)?new ay("",p,null,null,null):new ay(mu(p),null,l.scale?l.scale.evaluate(s):null,l.font?l.font.evaluate(s).join(","):null,l.textColor?l.textColor.evaluate(s):null)}))}eachChild(s){for(const l of this.sections)s(l.content),l.scale&&s(l.scale),l.font&&s(l.font),l.textColor&&s(l.textColor)}outputDefined(){return!1}serialize(){const s=["format"];for(const l of this.sections){s.push(l.content.serialize());const p={};l.scale&&(p["font-scale"]=l.scale.serialize()),l.font&&(p["text-font"]=l.font.serialize()),l.textColor&&(p["text-color"]=l.textColor.serialize()),s.push(p)}return s}}class Yi{constructor(s,l,p,m){this._imageWarnHistory={},this.type=ry,this.namePrimary=s,this.nameSecondary=l,p&&(this.paramsPrimary=p.params,this.iconsetIdPrimary=p.iconset?p.iconset.id:void 0),m&&(this.paramsSecondary=m.params,this.iconsetIdSecondary=m.iconset?m.iconset.id:void 0)}static parse(s,l){if(s.length<2)return l.error("Expected two or more arguments.");let p=1;const m=[];function _(){if(p<s.length){const w=l.parse(s[p],p++,Gn);return w?(m.push({image:w,options:{}}),!0):(l.error(m.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function v(){if(p<s.length){const A=s[p];if((w=A)===null||typeof w!="object"||Array.isArray(w))return!0;const k=A.params,R=A.iconset,j=l.concat(p);if(!k&&!R)return p++,!0;if(k){if(typeof k!="object"||k.constructor!==Object)return j.error('Image options "params" should be an object'),!1;const z={},U=j.concat(void 0,"params");for(const q in k){if(!q)return U.error("Image parameter name should be non-empty"),!1;const X=U.concat(void 0,q).parse(k[q],void 0,fl,void 0,{typeAnnotation:"coerce"});if(!X)return!1;z[q]=X}m[m.length-1].options.params=z}if(R){if(typeof R!="object"||R.constructor!==Object)return j.error('Image options "iconset" should be an object'),!1;if(!R.id)return j.error('Image options "iconset" should have an "id" property'),!1;m[m.length-1].options.iconset=R}return p++,!0}var w;return!0}for(let w=0;w<2;w++)if(!_()||!v())return;return new Yi(m[0].image,m[1]?m[1].image:void 0,m[0].options,m[1]?m[1].options:void 0)}evaluateParams(s,l){const p={};if(l){for(const m in l)if(l[m])try{p[m]=l[m].evaluate(s)}catch{continue}if(Object.keys(p).length!==0)return{params:p}}}evaluate(s){const l={name:this.namePrimary.evaluate(s),iconsetId:this.iconsetIdPrimary},p=this.nameSecondary?{name:this.nameSecondary.evaluate(s),iconsetId:this.iconsetIdSecondary}:void 0,m=Ya.build(l,p,this.paramsPrimary?this.evaluateParams(s,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(s,this.paramsSecondary):void 0);if(m&&s.availableImages){const _=m.getPrimary().id;if(m.available=s.availableImages.some(v=>no.isEqual(v,_)),m.available){const v=m.getSecondary()?m.getSecondary().id:null;v&&(m.available=s.availableImages.some(w=>no.isEqual(w,v)))}}return m}eachChild(s){if(s(this.namePrimary),this.paramsPrimary)for(const l in this.paramsPrimary)this.paramsPrimary[l]&&s(this.paramsPrimary[l]);if(this.nameSecondary&&(s(this.nameSecondary),this.paramsSecondary))for(const l in this.paramsSecondary)this.paramsSecondary[l]&&s(this.paramsSecondary[l])}outputDefined(){return!1}serializeOptions(s,l){const p={};if(l&&(p.iconset={id:l}),s){p.params={};for(const m in s)s[m]&&(p.params[m]=s[m].serialize())}return Object.keys(p).length>0?p:void 0}serialize(){const s=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const l=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);l&&s.push(l)}if(this.nameSecondary&&(s.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const l=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);l&&s.push(l)}return s}}function wf(u){return $i(u)?"string":ly(u)?"number":bv(u)?"boolean":Array.isArray(u)?"array":u===null?"null":xv(u)?"object":typeof u}function xv(u){return u!=null&&!Array.isArray(u)&&typeof u!="function"&&!(u instanceof String||u instanceof Number||u instanceof Boolean)&&typeof u=="object"}function $i(u){return typeof u=="string"||u instanceof String}function ly(u){return typeof u=="number"||u instanceof Number}function bv(u){return typeof u=="boolean"||u instanceof Boolean}const $E={"to-boolean":sr,"to-color":fl,"to-number":xi,"to-string":Gn};class gu{constructor(s,l){this.type=s,this.args=l}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");const p=s[0],m=[];let _=vf;if(p==="to-array"){if(!Array.isArray(s[1]))return null;const v=s[1].length;if(l.expectedType){if(l.expectedType.kind!=="array")return l.error(`Expected ${l.expectedType.kind} but found array.`);_=Do(l.expectedType.itemType,v)}else{if(!(v>0&&bf(s[1][0])))return null;_=Do(ho(s[1][0]),v)}for(let w=0;w<v;w++){const A=s[1][w];let k;if(Array.isArray(A))k=l.parse(A,void 0,_.itemType);else{const R=wf(A);if(R!==_.itemType.kind)return l.error(`Expected ${_.itemType.kind} but found ${R}.`);k=l.registry.literal.parse(["literal",A===void 0?null:A],l)}if(!k)return null;m.push(k)}}else{if((p==="to-boolean"||p==="to-string")&&s.length!==2)return l.error("Expected one argument.");_=$E[p];for(let v=1;v<s.length;v++){const w=l.parse(s[v],v,dr);if(!w)return null;m.push(w)}}return new gu(_,m)}evaluate(s){if(this.type.kind==="boolean")return!!this.args[0].evaluate(s);if(this.type.kind==="color"){let l,p;for(const m of this.args){if(l=m.evaluate(s),p=null,l instanceof lr)return l;if(typeof l=="string"){const _=s.parseColor(l);if(_)return _}else if(Array.isArray(l)&&(p=l.length<3||l.length>4?`Invalid rbga value ${JSON.stringify(l)}: expected an array containing either three or four numeric values.`:vv(l[0],l[1],l[2],l[3]),!p))return new lr(l[0]/255,l[1]/255,l[2]/255,l[3])}throw new Ds(p||`Could not parse color from value '${typeof l=="string"?l:String(JSON.stringify(l))}'`)}if(this.type.kind==="number"){let l=null;for(const p of this.args){if(l=p.evaluate(s),l===null)return 0;const m=Number(l);if(!isNaN(m))return m}throw new Ds(`Could not convert ${JSON.stringify(l)} to number.`)}return this.type.kind==="formatted"?_o.fromString(mu(this.args[0].evaluate(s))):this.type.kind==="resolvedImage"?Ya.build(mu(this.args[0].evaluate(s))):this.type.kind==="array"?this.args.map(l=>l.evaluate(s)):mu(this.args[0].evaluate(s))}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}serialize(){if(this.type.kind==="formatted")return new sp([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Yi(this.args[0]).serialize();const s=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(l=>{s.push(l.serialize())}),s}}const wv=["Unknown","Point","LineString","Polygon"];class Ro{constructor(s,l,p){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=s,this.options=l,this.iconImageUseTheme=p}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?wv[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(s){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const s=this.featureDistanceData.center,l=this.featureDistanceData.scale,{x:p,y:m}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(p*l-s[0])+this.featureDistanceData.bearing[1]*(m*l-s[1])}return 0}parseColor(s){let l=this._parseColorCache[s];return l||(l=this._parseColorCache[s]=lr.parse(s)),l}getConfig(s){return this.options?this.options.get(s):null}}class ya{constructor(s,l,p,m,_){this.name=s,this.type=l,this._evaluate=p,this.args=m,this._overloadIndex=_}evaluate(s){if(!this._evaluate){const l=ya.definitions[this.name];this._evaluate=Array.isArray(l)?l[2]:l.overloads[this._overloadIndex][1]}return this._evaluate(s,this.args)}eachChild(s){this.args.forEach(s)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(s=>s.serialize()))}static parse(s,l){const p=s[0],m=ya.definitions[p];if(!m)return l.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const _=Array.isArray(m)?m[0]:m.type,v=Array.isArray(m)?[[m[1],m[2]]]:m.overloads,w=[];let A=null,k=-1;for(const[R,j]of v){if(Array.isArray(R)&&R.length!==s.length-1)continue;w.push(R),k++,A=new Mv(l.registry,l.path,null,l.scope,void 0,l._scope,l.options,l.iconImageUseTheme);const z=[];let U=!1;for(let q=1;q<s.length;q++){const X=s[q],Q=Array.isArray(R)?R[q-1]:R.type,ee=A.parse(X,1+z.length,Q);if(!ee){U=!0;break}z.push(ee)}if(!U)if(Array.isArray(R)&&R.length!==z.length)A.error(`Expected ${R.length} arguments, but found ${z.length} instead.`);else{for(let q=0;q<z.length;q++){const X=Array.isArray(R)?R[q]:R.type,Q=z[q];A.concat(q+1).checkSubtype(X,Q.type)}if(A.errors.length===0)return new ya(p,_,j,z,k)}}if(w.length===1)l.errors.push(...A.errors);else{const R=(w.length?w:v.map(([z])=>z)).map(op).join(" | "),j=[];for(let z=1;z<s.length;z++){const U=l.parse(s[z],1+j.length);if(!U)return null;j.push(Js(U.type))}l.error(`Expected arguments of type ${R}, but found (${j.join(", ")}) instead.`)}return null}static register(s,l){ya.definitions=l;for(const p in l)s[p]=ya}}function op(u){return Array.isArray(u)?`(${u.map(Js).join(", ")})`:`(${Js(u.type)}...)`}class Sf{constructor(s,l,p){this.type=ny,this.locale=p,this.caseSensitive=s,this.diacriticSensitive=l}static parse(s,l){if(s.length!==2)return l.error("Expected one argument.");const p=s[1];if(typeof p!="object"||Array.isArray(p))return l.error("Collator options argument must be an object.");const m=p["case-sensitive"]===void 0?l.parse(!1,1,sr):l.parseObjectValue(p["case-sensitive"],1,"case-sensitive",sr);if(!m)return null;const _=p["diacritic-sensitive"]===void 0?l.parse(!1,1,sr):l.parseObjectValue(p["diacritic-sensitive"],1,"diacritic-sensitive",sr);if(!_)return null;let v=null;return p.locale&&(v=l.parseObjectValue(p.locale,1,"locale",Gn),!v)?null:new Sf(m,_,v)}evaluate(s){return new x1(this.caseSensitive.evaluate(s),this.diacriticSensitive.evaluate(s),this.locale?this.locale.evaluate(s):null)}eachChild(s){s(this.caseSensitive),s(this.diacriticSensitive),this.locale&&s(this.locale)}outputDefined(){return!1}serialize(){const s={};return s["case-sensitive"]=this.caseSensitive.serialize(),s["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(s.locale=this.locale.serialize()),["collator",s]}}function Xu(u,s,l=0,p=u.length-1,m=KM){for(;p>l;){if(p-l>600){const A=p-l+1,k=s-l+1,R=Math.log(A),j=.5*Math.exp(2*R/3),z=.5*Math.sqrt(R*j*(A-j)/A)*(k-A/2<0?-1:1);Xu(u,s,Math.max(l,Math.floor(s-k*j/A+z)),Math.min(p,Math.floor(s+(A-k)*j/A+z)),m)}const _=u[s];let v=l,w=p;for(jo(u,l,s),m(u[p],_)>0&&jo(u,l,p);v<w;){for(jo(u,v,w),v++,w--;m(u[v],_)<0;)v++;for(;m(u[w],_)>0;)w--}m(u[l],_)===0?jo(u,l,w):(w++,jo(u,w,p)),w<=s&&(l=w+1),s<=w&&(p=w-1)}}function jo(u,s,l){const p=u[s];u[s]=u[l],u[l]=p}function KM(u,s){return u<s?-1:u>s?1:0}function ZM(u){let s=0;for(let l,p,m=0,_=u.length,v=_-1;m<_;v=m++)l=u[m],p=u[v],s+=(p.x-l.x)*(l.y+p.y);return s}function cy(u,s){u[0]=Math.min(u[0],s[0]),u[1]=Math.min(u[1],s[1]),u[2]=Math.max(u[2],s[0]),u[3]=Math.max(u[3],s[1])}function Xd(u,s){return!(u[0]<=s[0]||u[2]>=s[2]||u[1]<=s[1]||u[3]>=s[3])}function qE(u,s,l){const p=u[0]-s[0],m=u[1]-s[1],_=u[0]-l[0],v=u[1]-l[1];return p*v-_*m==0&&p*_<=0&&m*v<=0}function vc(u,s,l=!1){let p=!1;for(let w=0,A=s.length;w<A;w++){const k=s[w];for(let R=0,j=k.length,z=j-1;R<j;z=R++){const U=k[z],q=k[R];if(qE(u,U,q))return l;(_=U)[1]>(m=u)[1]!=(v=q)[1]>m[1]&&m[0]<(v[0]-_[0])*(m[1]-_[1])/(v[1]-_[1])+_[0]&&(p=!p)}}var m,_,v;return p}function HE(u,s,l,p){const m=p[0]-l[0],_=p[1]-l[1],v=(u[0]-l[0])*_
808-m*(u[1]-l[1]),w=(s[0]-l[0])*_-m*(s[1]-l[1]);return v>0&&w<0||v<0&&w>0}function Sv(u,s,l,p){return(m=[p[0]-l[0],p[1]-l[1]])[0]*(_=[s[0]-u[0],s[1]-u[1]])[1]-m[1]*_[0]!=0&&!(!HE(u,s,l,p)||!HE(l,p,u,s));var m,_}function uy(u){const s=new Tt(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=new Tt(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const p of u[0])s.x>p.x&&(s.x=p.x),s.y>p.y&&(s.y=p.y),l.x<p.x&&(l.x=p.x),l.y<p.y&&(l.y=p.y);return{min:s,max:l}}const Yd=8192;function XM(u,s){const l=(180+u[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u[1]*Math.PI/360)))/360,m=Math.pow(2,s.z);return[Math.round(l*m*Yd),Math.round(p*m*Yd)]}function GE(u,s){for(let l=0;l<s.length;l++)if(vc(u,s[l]))return!0;return!1}function YM(u,s,l){for(const p of l)for(let m=0,_=p.length,v=_-1;m<_;v=m++)if(Sv(u,s,p[v],p[m]))return!0;return!1}function Qd(u,s){for(let l=0;l<u.length;++l)if(!vc(u[l],s))return!1;for(let l=0;l<u.length-1;++l)if(YM(u[l],u[l+1],s))return!1;return!0}function QM(u,s){for(let l=0;l<s.length;l++)if(Qd(u,s[l]))return!0;return!1}function b1(u,s,l){const p=[];for(let m=0;m<u.length;m++){const _=[];for(let v=0;v<u[m].length;v++){const w=XM(u[m][v],l);cy(s,w),_.push(w)}p.push(_)}return p}function Tv(u,s,l){const p=[];for(let m=0;m<u.length;m++){const _=b1(u[m],s,l);p.push(_)}return p}function w1(u,s,l,p){if(u[0]<l[0]||u[0]>l[2]){const m=.5*p;let _=u[0]-l[0]>m?-p:l[0]-u[0]>m?p:0;_===0&&(_=u[0]-l[2]>m?-p:l[2]-u[0]>m?p:0),u[0]+=_}cy(s,u)}function S1(u,s,l,p){const m=Math.pow(2,p.z)*Yd,_=[p.x*Yd,p.y*Yd],v=[];if(!u)return v;for(const w of u)for(const A of w){const k=[A.x+_[0],A.y+_[1]];w1(k,s,l,m),v.push(k)}return v}function xc(u,s,l,p){const m=Math.pow(2,p.z)*Yd,_=[p.x*Yd,p.y*Yd],v=[];if(!u)return v;for(const A of u){const k=[];for(const R of A){const j=[R.x+_[0],R.y+_[1]];cy(s,j),k.push(j)}v.push(k)}if(s[2]-s[0]<=m/2){(w=s)[0]=w[1]=1/0,w[2]=w[3]=-1/0;for(const A of v)for(const k of A)w1(k,s,l,m)}var w;return v}class ap{constructor(s,l){this.type=sr,this.geojson=s,this.geometries=l}static parse(s,l){if(s.length!==2)return l.error(`'within' expression requires exactly one argument, but found ${s.length-1} instead.`);if(bf(s[1])){const p=s[1];if(p.type==="FeatureCollection")for(let m=0;m<p.features.length;++m){const _=p.features[m].geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new ap(p,p.features[m].geometry)}else if(p.type==="Feature"){const m=p.geometry.type;if(m==="Polygon"||m==="MultiPolygon")return new ap(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new ap(p,p)}return l.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return function(l,p){const m=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],v=l.canonicalID();if(!v)return!1;if(p.type==="Polygon"){const w=b1(p.coordinates,_,v),A=S1(l.geometry(),m,_,v);if(!Xd(m,_))return!1;for(const k of A)if(!vc(k,w))return!1}if(p.type==="MultiPolygon"){const w=Tv(p.coordinates,_,v),A=S1(l.geometry(),m,_,v);if(!Xd(m,_))return!1;for(const k of A)if(!GE(k,w))return!1}return!0}(s,this.geometries);if(s.geometryType()==="LineString")return function(l,p){const m=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],v=l.canonicalID();if(!v)return!1;if(p.type==="Polygon"){const w=b1(p.coordinates,_,v),A=xc(l.geometry(),m,_,v);if(!Xd(m,_))return!1;for(const k of A)if(!Qd(k,w))return!1}if(p.type==="MultiPolygon"){const w=Tv(p.coordinates,_,v),A=xc(l.geometry(),m,_,v);if(!Xd(m,_))return!1;for(const k of A)if(!QM(k,w))return!1}return!0}(s,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const dy={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},T1=1/298.257223563,C1=T1*(2-T1),Tf=Math.PI/180;class Cf{static fromTile(s,l,p){const m=Math.PI*(1-2*(s+.5)/Math.pow(2,l)),_=Math.atan(.5*(Math.exp(m)-Math.exp(-m)))/Tf;return new Cf(_,p)}static get units(){return dy}constructor(s,l){if(s===void 0)throw new Error("No latitude given.");if(l&&!dy[l])throw new Error(`Unknown unit ${l}. Use one of: ${Object.keys(dy).join(", ")}`);const p=6378.137*Tf*(l?dy[l]:1),m=Math.cos(s*Tf),_=1/(1-C1*(1-m*m)),v=Math.sqrt(_);this.kx=p*v*m,this.ky=p*v*_*(1-C1)}distance(s,l){const p=Rl(s[0]-l[0])*this.kx,m=(s[1]-l[1])*this.ky;return Math.sqrt(p*p+m*m)}bearing(s,l){const p=Rl(l[0]-s[0])*this.kx;return Math.atan2(p,(l[1]-s[1])*this.ky)/Tf}destination(s,l,p){const m=p*Tf;
808return this.offset(s,Math.sin(m)*l,Math.cos(m)*l)}offset(s,l,p){return[s[0]+l/this.kx,s[1]+p/this.ky]}lineDistance(s){let l=0;for(let p=0;p<s.length-1;p++)l+=this.distance(s[p],s[p+1]);return l}area(s){let l=0;for(let p=0;p<s.length;p++){const m=s[p];for(let _=0,v=m.length,w=v-1;_<v;w=_++)l+=Rl(m[_][0]-m[w][0])*(m[_][1]+m[w][1])*(p?-1:1)}return Math.abs(l)/2*this.kx*this.ky}along(s,l){let p=0;if(l<=0)return s[0];for(let m=0;m<s.length-1;m++){const _=s[m],v=s[m+1],w=this.distance(_,v);if(p+=w,p>l)return Cv(_,v,(l-(p-w))/w)}return s[s.length-1]}pointToSegmentDistance(s,l,p){let[m,_]=l,v=Rl(p[0]-m)*this.kx,w=(p[1]-_)*this.ky;if(v!==0||w!==0){const A=(Rl(s[0]-m)*this.kx*v+(s[1]-_)*this.ky*w)/(v*v+w*w);A>1?(m=p[0],_=p[1]):A>0&&(m+=v/this.kx*A,_+=w/this.ky*A)}return v=Rl(s[0]-m)*this.kx,w=(s[1]-_)*this.ky,Math.sqrt(v*v+w*w)}pointOnLine(s,l){let p=1/0,m=s[0][0],_=s[0][1],v=0,w=0;for(let A=0;A<s.length-1;A++){let k=s[A][0],R=s[A][1],j=Rl(s[A+1][0]-k)*this.kx,z=(s[A+1][1]-R)*this.ky,U=0;j===0&&z===0||(U=(Rl(l[0]-k)*this.kx*j+(l[1]-R)*this.ky*z)/(j*j+z*z),U>1?(k=s[A+1][0],R=s[A+1][1]):U>0&&(k+=j/this.kx*U,R+=z/this.ky*U)),j=Rl(l[0]-k)*this.kx,z=(l[1]-R)*this.ky;const q=j*j+z*z;q<p&&(p=q,m=k,_=R,v=A,w=U)}return{point:[m,_],index:v,t:Math.max(0,Math.min(1,w))}}lineSlice(s,l,p){let m=this.pointOnLine(p,s),_=this.pointOnLine(p,l);if(m.index>_.index||m.index===_.index&&m.t>_.t){const k=m;m=_,_=k}const v=[m.point],w=m.index+1,A=_.index;!E1(p[w],v[0])&&w<=A&&v.push(p[w]);for(let k=w+1;k<=A;k++)v.push(p[k]);return E1(p[A],_.point)||v.push(_.point),v}lineSliceAlong(s,l,p){let m=0;const _=[];for(let v=0;v<p.length-1;v++){const w=p[v],A=p[v+1],k=this.distance(w,A);if(m+=k,m>s&&_.length===0&&_.push(Cv(w,A,(s-(m-k))/k)),m>=l)return _.push(Cv(w,A,(l-(m-k))/k)),_;m>s&&_.push(A)}return _}bufferPoint(s,l){const p=l/this.ky,m=l/this.kx;return[s[0]-m,s[1]-p,s[0]+m,s[1]+p]}bufferBBox(s,l){const p=l/this.ky,m=l/this.kx;return[s[0]-m,s[1]-p,s[2]+m,s[3]+p]}insideBBox(s,l){return Rl(s[0]-l[0])>=0&&Rl(s[0]-l[2])<=0&&s[1]>=l[1]&&s[1]<=l[3]}}function E1(u,s){return u[0]===s[0]&&u[1]===s[1]}function Cv(u,s,l){const p=Rl(s[0]-u[0]);return[u[0]+p*l,u[1]+(s[1]-u[1])*l]}function Rl(u){for(;u<-180;)u+=360;for(;u>180;)u-=360;return u}class Ev{constructor(s=[],l=(p,m)=>p<m?-1:p>m?1:0){if(this.data=s,this.length=this.data.length,this.compare=l,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],l=this.data.pop();return--this.length>0&&(this.data[0]=l,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:l,compare:p}=this,m=l[s];for(;s>0;){const _=s-1>>1,v=l[_];if(p(m,v)>=0)break;l[s]=v,s=_}l[s]=m}_down(s){const{data:l,compare:p}=this,m=this.length>>1,_=l[s];for(;s<m;){let v=1+(s<<1);const w=v+1;if(w<this.length&&p(l[w],l[v])<0&&(v=w),p(l[v],_)>=0)break;l[s]=l[v],s=v}l[s]=_}}var Ft=8192;function A1(u,s){return s.dist-u.dist}const Ef=100,Af=50;function hy(u){const s=[1/0,1/0,-1/0,-1/0];if(s.length!==u.length)return!1;for(let l=0;l<s.length;l++)if(s[l]!==u[l])return!1;return!0}function py(u){return u[1]-u[0]+1}function yu(u,s){const l=u[1]>=u[0]&&u[1]<s;return l||console.warn("Distance Expression: Index is out of range"),l}function Av(u,s){if(u[0]>u[1])return[null,null];const l=py(u);if(s){if(l===2)return[u,null];const p=Math.floor(l/2);return[[u[0],u[0]+p],[u[0]+p,u[1]]]}{if(l===1)return[u,null];const p=Math.floor(l/2)-1;return[[u[0],u[0]+p],[u[0]+p+1,u[1]]]}}function bc(u,s){const l=[1/0,1/0,-1/0,-1/0];if(!yu(s,u.length))return l;for(let p=s[0];p<=s[1];++p)cy(l,u[p]);return l}function An(u){const s=[1/0,1/0,-1/0,-1/0];for(let l=0;l<u.length;++l)for(let p=0;p<u[l].length;++p)cy(s,u[l][p]);return s}function If(u,s,l){if(hy(u)||hy(s))return NaN;let p=0,m=0;return u[2]<s[0]&&(p=s[0]-u[2]),u[0]>s[2]&&(p=u[0]-s[2]),u[1]>s[3]&&(m=u[1]-s[3]),u[3]<s[1]&&(m=s[1]-u[3]),l.distance([0,0],[p,m])}function JM(u){return 360*u-180}function eD(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180))-90}function Iv(u,s){const l=Math.pow(2,s.z),p=(u.y/Ft+s.y)/l;return[JM((u.x/Ft+s.x)/l),eD(p)]}
808function tD(u,s){const l=[];for(let p=0;p<u.length;++p)l.push(Iv(u[p],s));return l}function as(u,s,l){const p=l.pointOnLine(s,u).point;return l.distance(u,p)}function WE(u,s,l,p,m){const _=l.slice(p[0],p[1]+1);let v=1/0;for(let w=s[0];w<=s[1];++w)if((v=Math.min(v,as(u[w],_,m)))===0)return 0;return v}function I1(u,s,l,p,m){const _=Math.min(m.pointToSegmentDistance(u,l,p),m.pointToSegmentDistance(s,l,p)),v=Math.min(m.pointToSegmentDistance(l,u,s),m.pointToSegmentDistance(p,u,s));return Math.min(_,v)}function iD(u,s,l,p,m){if(!yu(s,u.length)||!yu(p,l.length))return NaN;let _=1/0;for(let v=s[0];v<s[1];++v)for(let w=p[0];w<p[1];++w){if(Sv(u[v],u[v+1],l[w],l[w+1]))return 0;_=Math.min(_,I1(u[v],u[v+1],l[w],l[w+1],m))}return _}function nD(u,s,l,p,m){if(!yu(s,u.length)||!yu(p,l.length))return NaN;let _=1/0;for(let v=s[0];v<=s[1];++v)for(let w=p[0];w<=p[1];++w)if((_=Math.min(_,m.distance(u[v],l[w])))===0)return _;return _}function rD(u,s,l){if(vc(u,s,!0))return 0;let p=1/0;for(const m of s){const _=m.length;if(_<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(m[0]!==m[_-1]&&(p=Math.min(p,l.pointToSegmentDistance(u,m[_-1],m[0])))===0||(p=Math.min(p,as(u,m,l)))===0)return p}return p}function sD(u,s,l,p){if(!yu(s,u.length))return NaN;for(let _=s[0];_<=s[1];++_)if(vc(u[_],l,!0))return 0;let m=1/0;for(let _=s[0];_<s[1];++_)for(const v of l)for(let w=0,A=v.length,k=A-1;w<A;k=w++){if(Sv(u[_],u[_+1],v[k],v[w]))return 0;m=Math.min(m,I1(u[_],u[_+1],v[k],v[w],p))}return m}function KE(u,s){for(const l of u)for(let p=0;p<=l.length-1;++p)if(vc(l[p],s,!0))return!0;return!1}function oD(u,s,l,p=1/0){const m=An(u),_=An(s);if(p!==1/0&&If(m,_,l)>=p)return p;if(Xd(m,_)){if(KE(u,s))return 0}else if(KE(s,u))return 0;let v=p;for(const w of u)for(let A=0,k=w.length,R=k-1;A<k;R=A++)for(const j of s)for(let z=0,U=j.length,q=U-1;z<U;q=z++){if(Sv(w[R],w[A],j[q],j[z]))return 0;v=Math.min(v,I1(w[R],w[A],j[q],j[z],l))}return v}function kv(u,s,l,p,m,_,v){if(_===null||v===null)return;const w=If(bc(p,_),bc(m,v),l);w<s&&u.push({dist:w,range1:_,range2:v})}function aD(u,s,l,p,m=1/0){let _=Math.min(p.distance(u[0],l[0][0]),m);if(_===0)return _;const v=new Ev([{dist:0,range1:[0,u.length-1],range2:[0,0]}],A1),w=s?Af:Ef,A=An(l);for(;v.length;){const k=v.pop();if(k.dist>=_)continue;const R=k.range1;if(py(R)<=w){if(!yu(R,u.length))return NaN;if(s){const j=sD(u,R,l,p);if((_=Math.min(_,j))===0)return _}else for(let j=R[0];j<=R[1];++j){const z=rD(u[j],l,p);if((_=Math.min(_,z))===0)return _}}else{const j=Av(R,s);if(j[0]!==null){const z=If(bc(u,j[0]),A,p);z<_&&v.push({dist:z,range1:j[0],range2:[0,0]})}if(j[1]!==null){const z=If(bc(u,j[1]),A,p);z<_&&v.push({dist:z,range1:j[1],range2:[0,0]})}}}return _}function ZE(u,s,l,p,m,_=1/0){let v=Math.min(_,m.distance(u[0],l[0]));if(v===0)return v;const w=new Ev([{dist:0,range1:[0,u.length-1],range2:[0,l.length-1]}],A1),A=s?Af:Ef,k=p?Af:Ef;for(;w.length;){const R=w.pop();if(R.dist>=v)continue;const j=R.range1,z=R.range2;if(py(j)<=A&&py(z)<=k){if(!yu(j,u.length)||!yu(z,l.length))return NaN;if(s&&p?v=Math.min(v,iD(u,j,l,z,m)):s||p?s&&!p?v=Math.min(v,WE(l,z,u,j,m)):!s&&p&&(v=Math.min(v,WE(u,j,l,z,m))):v=Math.min(v,nD(u,j,l,z,m)),v===0)return v}else{const U=Av(j,s),q=Av(z,p);kv(w,v,m,u,l,U[0],q[0]),kv(w,v,m,u,l,U[0],q[1]),kv(w,v,m,u,l,U[1],q[0]),kv(w,v,m,u,l,U[1],q[1])}}return v}function k1(u,s,l,p,m=1/0){let _=m;const v=bc(u,[0,u.length-1]);for(const w of l)if(!(_!==1/0&&If(v,bc(w,[0,w.length-1]),p)>=_)&&(_=Math.min(_,ZE(u,s,w,!0,p,_)),_===0))return _;return _}function Pv(u,s,l,p,m=1/0){let _=m;const v=bc(u,[0,u.length-1]);for(const w of l){if(_!==1/0&&If(v,An(w),p)>=_)continue;const A=aD(u,s,w,p,_);if(isNaN(A))return A;if((_=Math.min(_,A))===0)return _}return _}function P1(u){return u==="Point"||u==="MultiPoint"||u==="LineString"||u==="MultiLineString"||u==="Polygon"||u==="MultiPolygon"}class lp{constructor(s,l){this.type=xi,this.geojson=s,this.geometries=l}static parse(s,l){if(s.length!==2)return l.error(`'distance' expression requires either one argument, but found ' ${s.length-1} instead.`);if(bf(s[1])){const p=s[1];if(p.type==="FeatureCollection"){for(let m=0;m<p.features.length;++m)if(P1(p.features[m].geometry.type))return new lp(p,p.features[m].geometry)}
808else if(p.type==="Feature"){if(P1(p.geometry.type))return new lp(p,p.geometry)}else if(P1(p.type))return new lp(p,p)}return l.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(s){const l=s.geometry(),p=s.canonicalID();if(l!=null&&p!=null){if(s.geometryType()==="Point")return function(m,_,v){const w=[];for(const k of m)for(const R of k)w.push(Iv(R,_));const A=new Cf(w[0][1],"meters");return v.type==="Point"||v.type==="MultiPoint"||v.type==="LineString"?ZE(w,!1,v.type==="Point"?[v.coordinates]:v.coordinates,v.type==="LineString",A):v.type==="MultiLineString"?k1(w,!1,v.coordinates,A):v.type==="Polygon"||v.type==="MultiPolygon"?Pv(w,!1,v.type==="Polygon"?[v.coordinates]:v.coordinates,A):null}(l,p,this.geometries);if(s.geometryType()==="LineString")return function(m,_,v){const w=[];for(const k of m){const R=[];for(const j of k)R.push(Iv(j,_));w.push(R)}const A=new Cf(w[0][0][1],"meters");if(v.type==="Point"||v.type==="MultiPoint"||v.type==="LineString")return k1(v.type==="Point"?[v.coordinates]:v.coordinates,v.type==="LineString",w,A);if(v.type==="MultiLineString"){let k=1/0;for(let R=0;R<v.coordinates.length;R++){const j=k1(v.coordinates[R],!0,w,A,k);if(isNaN(j))return j;if((k=Math.min(k,j))===0)return k}return k}if(v.type==="Polygon"||v.type==="MultiPolygon"){let k=1/0;for(let R=0;R<w.length;R++){const j=Pv(w[R],!0,v.type==="Polygon"?[v.coordinates]:v.coordinates,A,k);if(isNaN(j))return j;if((k=Math.min(k,j))===0)return k}return k}return null}(l,p,this.geometries);if(s.geometryType()==="Polygon")return function(m,_,v){const w=[];for(const k of function(R,j){const z=R.length;if(z<=1)return[R];const U=[];let q,X;for(let Q=0;Q<z;Q++){const ee=ZM(R[Q]);ee!==0&&(R[Q].area=Math.abs(ee),X===void 0&&(X=ee<0),X===ee<0?(q&&U.push(q),q=[R[Q]]):q.push(R[Q]))}return q&&U.push(q),U}(m)){const R=[];for(let j=0;j<k.length;++j)R.push(tD(k[j],_));w.push(R)}const A=new Cf(w[0][0][0][1],"meters");if(v.type==="Point"||v.type==="MultiPoint"||v.type==="LineString")return Pv(v.type==="Point"?[v.coordinates]:v.coordinates,v.type==="LineString",w,A);if(v.type==="MultiLineString"){let k=1/0;for(let R=0;R<v.coordinates.length;R++){const j=Pv(v.coordinates[R],!0,w,A,k);if(isNaN(j))return j;if((k=Math.min(k,j))===0)return k}return k}return v.type==="Polygon"||v.type==="MultiPolygon"?function(k,R,j){let z=1/0;for(const U of k)for(const q of R){const X=oD(U,q,j,z);if(isNaN(X))return X;if((z=Math.min(z,X))===0)return z}return z}(v.type==="Polygon"?[v.coordinates]:v.coordinates,w,A):null}(l,p,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 kf(u){if(u instanceof ya&&(u.name==="get"&&u.args.length===1||u.name==="feature-state"||u.name==="has"&&u.args.length===1||u.name==="properties"||u.name==="geometry-type"||u.name==="id"||/^filter-/.test(u.name))||u instanceof ap||u instanceof lp)return!1;if(u instanceof Nf)return u.featureConstant;let s=!0;return u.eachChild(l=>{s&&!kf(l)&&(s=!1)}),s}function fy(u){if(u instanceof ya&&u.name==="feature-state")return!1;let s=!0;return u.eachChild(l=>{s&&!fy(l)&&(s=!1)}),s}function Pf(u,s){if(u instanceof ya&&s.indexOf(u.name)>=0)return!1;let l=!0;return u.eachChild(p=>{l&&!Pf(p,s)&&(l=!1)}),l}function XE(u,s,l){return[u,s,l].filter(Boolean).join("�")}function N1(u,s){switch(u){case"string":return mu(s);case"number":return+s;case"boolean":return!!s;case"color":return lr.parse(s);case"formatted":return _o.fromString(mu(s));case"resolvedImage":return Ya.build(mu(s))}return s}function YE(u,s,l,p){return p!==void 0&&(u=p*Math.round(u/p)),s!==void 0&&u<s&&(u=s),l!==void 0&&u>l&&(u=l),u}class Nf{constructor(s,l,p,m=!1){this.type=s,this.key=l,this.scope=p,this.featureConstant=m}static parse(s,l){let p=l.expectedType;if(p==null&&(p=dr),s.length<2||s.length>3)return l.error("Invalid number of arguments for 'config' expression.");const m=l.parse(s[1],1);if(!(m instanceof Zu))return l.error("Key name of 'config' expression must be a string literal.");let _,v=!0;const w=mu(m.value);if(s.length>=3){const A=l.parse(s[2],2);if(!(A instanceof Zu))return l.error("Scope of 'config' expression must be a string literal.");_=mu(A.value)}if(l.options){const A=XE(w,_,l._scope),k=l.options.get(A);k&&(v=kf(k.value||k.default))}return new Nf(p,w,_,v)}evaluate(s){const l=XE(this.key,this.scope,s.scope),p=s.getConfig(l);
vendor: 10,772 bytes, line 808
808if(!p)return null;const{type:m,value:_,values:v,minValue:w,maxValue:A,stepValue:k}=p,R=p.default.evaluate(s);let j=R;if(_){const z=s.scope;s.scope=(z||"").split("�").slice(1).join("�"),j=_.evaluate(s),s.scope=z}return m&&(j=N1(m,j)),j===void 0||w===void 0&&A===void 0&&k===void 0||(typeof j=="number"?j=YE(j,w,A,k):Array.isArray(j)&&(j=j.map(z=>typeof z=="number"?YE(z,w,A,k):z))),_!==void 0&&j!==void 0&&v&&!v.includes(j)&&(j=R,m&&(j=N1(m,j))),(m&&m!==this.type||j!==void 0&&!_v(ho(j),this.type))&&(j=N1(this.type.kind,j)),j}eachChild(){}outputDefined(){return!1}serialize(){const s=["config",this.key];return this.scope&&s.concat(this.scope),s}}class Nv{constructor(s,l){this.type=l.type,this.name=s,this.boundExpression=l}static parse(s,l){if(s.length!==2||typeof s[1]!="string")return l.error("'var' expression requires exactly one string literal argument.");const p=s[1];return l.scope.has(p)?new Nv(p,l.scope.get(p)):l.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(s){return this.boundExpression.evaluate(s)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Mv{constructor(s,l=[],p,m=new _c,_=[],v,w,A){this.registry=s,this.path=l,this.key=l.map(k=>typeof k=="string"?`['${k}']`:`[${k}]`).join(""),this.scope=m,this.errors=_,this.expectedType=p,this._scope=v,this.options=w,this.iconImageUseTheme=A}parse(s,l,p,m,_={}){return l||p?this.concat(l,null,p,m)._parse(s,_):this._parse(s,_)}parseObjectValue(s,l,p,m,_,v={}){return this.concat(l,p,m,_)._parse(s,v)}_parse(s,l){function p(m,_,v){return v==="assert"?new hi(_,[m]):v==="coerce"?new gu(_,[m]):m}if(s!==null&&typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"||(s=["literal",s]),Array.isArray(s)){if(s.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const m=typeof s[0]=="string"?this.registry[s[0]]:void 0;if(m){let _=m.parse(s,this);if(!_)return null;if(this.expectedType){const v=this.expectedType,w=_.type;if(v.kind!=="string"&&v.kind!=="number"&&v.kind!=="boolean"&&v.kind!=="object"&&v.kind!=="array"||w.kind!=="value")if(v.kind!=="color"&&v.kind!=="formatted"&&v.kind!=="resolvedImage"||w.kind!=="value"&&w.kind!=="string"){if(this.checkSubtype(v,w))return null}else _=p(_,v,l.typeAnnotation||"coerce");else _=p(_,v,l.typeAnnotation||"assert")}if(!(_ instanceof Zu)&&_.type.kind!=="resolvedImage"&&M1(_)){const v=new Ro(this._scope,this.options,this.iconImageUseTheme);try{_=new Zu(_.type,_.evaluate(v))}catch(w){return this.error(w.message),null}}return _}return gu.parse(["to-array",s],this)}return this.error(s===void 0?"'undefined' value invalid. Use null instead.":typeof s=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof s} instead.`)}concat(s,l,p,m){let _=typeof s=="number"?this.path.concat(s):this.path;_=typeof l=="string"?_.concat(l):_;const v=m?this.scope.concat(m):this.scope;return new Mv(this.registry,_,p||null,v,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(s,...l){const p=`${this.key}${l.map(m=>`[${m}]`).join("")}`;this.errors.push(new yc(p,s))}checkSubtype(s,l){const p=sy(s,l);return p&&this.error(p),p}}function M1(u){if(u instanceof Nv)return M1(u.boundExpression);if(u instanceof ya&&u.name==="error"||u instanceof Sf||u instanceof ap||u instanceof lp||u instanceof Nf)return!1;const s=u instanceof gu||u instanceof hi;let l=!0;return u.eachChild(p=>{l=s?l&&M1(p):l&&p instanceof Zu}),!!l&&kf(u)&&Pf(u,["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 Dv(u,s){const l=u.length-1;let p,m,_=0,v=l,w=0;for(;_<=v;)if(w=Math.floor((_+v)/2),p=u[w],m=u[w+1],p<=s){if(w===l||s<m)return w;_=w+1}else{if(!(p>s))throw new Ds("Input is not a number.");v=w-1}return 0}class my{constructor(s,l,p){this.type=s,this.input=l,this.labels=[],this.outputs=[];for(const[m,_]of p)this.labels.push(m),this.outputs.push(_)}static parse(s,l){if(s.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return l.error("Expected an even number of arguments.");const p=l.parse(s[1],1,xi);if(!p)return null;const m=[];let _=null;l.expectedType&&l.expectedType.kind!=="value"&&(_=l.expectedType);for(let v=1;v<s.length;v+=2){const w=v===1?-1/0:s[v],A=s[v+1],k=v,R=v+1;if(typeof w!="number")return l.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(m.length&&m[m.length-1][0]>=w)return l.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',k);const j=l.parse(A,R,_);if(!j)return null;_=_||j.type,m.push([w,j])}return new my(_,p,m)}evaluate(s){const l=this.labels,p=this.outputs;if(l.length===1)return p[0].evaluate(s);const m=this.input.evaluate(s);if(m<=l[0])return p[0].evaluate(s);const _=l.length;return m>=l[_-1]?p[_-1].evaluate(s):p[Dv(l,m)].evaluate(s)}eachChild(s){s(this.input);for(const l of this.outputs)s(l)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}serialize(){const s=["step",this.input.serialize()];for(let l=0;l<this.labels.length;l++)l>0&&s.push(this.labels[l]),s.push(this.outputs[l].serialize());return s}}const QE=.95047,JE=1.08883,e2=4/29,Mf=6/29,Rv=3*Mf*Mf,lD=Mf*Mf*Mf,t2=Math.PI/180,cD=180/Math.PI;function D1(u){return u>lD?Math.pow(u,1/3):u/Rv+e2}function R1(u){return u>Mf?u*u*u:Rv*(u-e2)}function jv(u){return 255*(u<=.0031308?12.92*u:1.055*Math.pow(u,1/2.4)-.055)}function zv(u){return(u/=255)<=.04045?u/12.92:Math.pow((u+.055)/1.055,2.4)}function cp(u){const s=zv(u.r),l=zv(u.g),p=zv(u.b),m=D1((.4124564*s+.3575761*l+.1804375*p)/QE),_=D1((.2126729*s+.7151522*l+.072175*p)/1);return{l:116*_-16,a:500*(m-_),b:200*(_-D1((.0193339*s+.119192*l+.9503041*p)/JE)),alpha:u.a}}function j1(u){let s=(u.l+16)/116,l=isNaN(u.a)?s:s+u.a/500,p=isNaN(u.b)?s:s-u.b/200;return s=1*R1(s),l=QE*R1(l),p=JE*R1(p),new lr(jv(3.2404542*l-1.5371385*s-.4985314*p),jv(-.969266*l+1.8760108*s+.041556*p),jv(.0556434*l-.2040259*s+1.0572252*p),u.alpha)}function i2(u,s,l){const p=s-u;return u+l*(p>180||p<-180?p-360*Math.round(p/360):p)}const gy={forward:cp,reverse:j1,interpolate:function(u,s,l){return{l:Vi(u.l,s.l,l),a:Vi(u.a,s.a,l),b:Vi(u.b,s.b,l),alpha:Vi(u.alpha,s.alpha,l)}}},up={forward:function(u){const{l:s,a:l,b:p}=cp(u),m=Math.atan2(p,l)*cD;return{h:m<0?m+360:m,c:Math.sqrt(l*l+p*p),l:s,alpha:u.a}},reverse:function(u){const s=u.h*t2,l=u.c;return j1({l:u.l,a:Math.cos(s)*l,b:Math.sin(s)*l,alpha:u.alpha})},interpolate:function(u,s,l){return{h:i2(u.h,s.h,l),c:Vi(u.c,s.c,l),l:Vi(u.l,s.l,l),alpha:Vi(u.alpha,s.alpha,l)}}};var Lv=Object.freeze({__proto__:null,hcl:up,lab:gy});class jl{constructor(s,l,p,m,_){this.type=s,this.operator=l,this.interpolation=p,this.input=m,this.labels=[],this.outputs=[];for(const[v,w]of _)this.labels.push(v),this.outputs.push(w)}static interpolationFactor(s,l,p,m){let _=0;if(s.name==="exponential")_=z1(l,s.base,p,m);else if(s.name==="linear")_=z1(l,1,p,m);else if(s.name==="cubic-bezier"){const v=s.controlPoints;_=new Hd(v[0],v[1],v[2],v[3]).solve(z1(l,1,p,m))}return _}static parse(s,l){let[p,m,_,...v]=s;if(!Array.isArray(m)||m.length===0)return l.error("Expected an interpolation type expression.",1);if(m[0]==="linear")m={name:"linear"};else if(m[0]==="exponential"){const k=m[1];if(typeof k!="number")return l.error("Exponential interpolation requires a numeric base.",1,1);m={name:"exponential",base:k}}else{if(m[0]!=="cubic-bezier")return l.error(`Unknown interpolation type ${String(m[0])}`,1,0);{const k=m.slice(1);if(k.length!==4||k.some(R=>typeof R!="number"||R<0||R>1))return l.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:k}}}if(s.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length-1>3&&(s.length-1)%2!=0)return l.error("Expected an even number of arguments.");if(_=l.parse(_,2,xi),!_)return null;const w=[];let A=null;p==="interpolate-hcl"||p==="interpolate-lab"?A=fl:l.expectedType&&l.expectedType.kind!=="value"&&(A=l.expectedType);for(let k=0;k<v.length;k+=2){const R=v[k],j=v[k+1],z=k+3,U=k+4;if(typeof R!="number")return l.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(w.length&&w[w.length-1][0]>=R)return l.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const q=l.parse(j,U,A);if(!q)return null;A=A||q.type,w.push([R,q])}return A.kind==="number"||A.kind==="color"||A.kind==="array"&&A.itemType.kind==="number"&&typeof A.N=="number"?new jl(A,p,m,_,w):l.error(`Type ${Js(A)} is not interpolatable.`)}evaluate(s){const l=this.labels,p=this.outputs;if(l.length===1)return p[0].evaluate(s);const m=this.input.evaluate(s);if(m<=l[0])return p[0].evaluate(s);const _=l.length;if(m>=l[_-1])return p[_-1].evaluate(s);const v=Dv(l,m),w=jl.interpolationFactor(this.interpolation,m,l[v],l[v+1]),A=p[v].evaluate(s),k=p[v+1].evaluate(s);return this.operator==="interpolate"?Wu[this.type.kind.toLowerCase()](A,k,w):this.operator==="interpolate-hcl"?up.reverse(up.interpolate(up.forward(A),up.forward(k),w)):gy.reverse(gy.interpolate(gy.forward(A),gy.forward(k),w))}eachChild(s){s(this.input);for(const l of this.outputs)s(l)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}serialize(){let s;s=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const l=[this.operator,s,this.input.serialize()];for(let p=0;p<this.labels.length;p++)l.push(this.labels[p],this.outputs[p].serialize());return l}}function z1(u,s,l,p){const m=p-l,_=u-l;return m===0?0:s===1?_/m:(Math.pow(s,_)-1)/(Math.pow(s,m)-1)}class yy{constructor(s,l){this.type=s,this.args=l}static parse(s,l){if(s.length<2)return l.error("Expectected at least one argument.");let p=null;const m=l.expectedType;m&&m.kind!=="value"&&(p=m);const _=[];for(const w of s.slice(1)){const A=l.parse(w,1+_.length,p,void 0,{typeAnnotation:"omit"});if(!A)return null;p=p||A.type,_.push(A)}const v=m&&_.some(w=>sy(m,w.type));return new yy(v?dr:p,_)}evaluate(s){let l,p=null,m=0;for(const _ of this.args){if(m++,p=_.evaluate(s),p&&p instanceof Ya&&!p.available&&(l||(l=p),p=null,m===this.args.length))return l;if(p!==null)break}return p}
808eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}serialize(){const s=["coalesce"];return this.eachChild(l=>{s.push(l.serialize())}),s}}class _y{constructor(s,l){this.type=l.type,this.bindings=[].concat(s),this.result=l}evaluate(s){return this.result.evaluate(s)}eachChild(s){for(const l of this.bindings)s(l[1]);s(this.result)}static parse(s,l){if(s.length<4)return l.error(`Expected at least 3 arguments, but found ${s.length-1} instead.`);const p=[];for(let _=1;_<s.length-1;_+=2){const v=s[_];if(typeof v!="string")return l.error(`Expected string, but found ${typeof v} instead.`,_);if(/[^a-zA-Z0-9_]/.test(v))return l.error("Variable names must contain only alphanumeric characters or '_'.",_);const w=l.parse(s[_+1],_+1);if(!w)return null;p.push([v,w])}const m=l.parse(s[s.length-1],s.length-1,l.expectedType,p);return m?new _y(p,m):null}outputDefined(){return this.result.outputDefined()}serialize(){const s=["let"];for(const[l,p]of this.bindings)s.push(l,p.serialize());return s.push(this.result.serialize()),s}}class L1{constructor(s,l,p){this.type=s,this.index=l,this.input=p}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,xi),m=l.parse(s[2],2,Do(l.expectedType||dr));return p&&m?new L1(m.type.itemType,p,m):null}evaluate(s){const l=this.index.evaluate(s),p=this.input.evaluate(s);if(l<0)throw new Ds("Array index out of bounds: negative index");if(l>=p.length)throw new Ds("Array index out of bounds: index exceeds array size");if(l!==Math.floor(l))throw new Ds("Array index must be an integer. Use at-interpolated for fractional indices");return p[l]}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class O1{constructor(s,l,p){this.type=s,this.index=l,this.input=p}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,xi),m=l.parse(s[2],2,Do(l.expectedType||dr));return p&&m?new O1(m.type.itemType,p,m):null}evaluate(s){const l=this.index.evaluate(s),p=this.input.evaluate(s);if(l<0)throw new Ds(`Array index out of bounds: ${l} < 0.`);if(l>p.length-1)throw new Ds(`Array index out of bounds: ${l} > ${p.length-1}.`);if(l===Math.floor(l))return p[l];const m=Math.floor(l),_=Math.ceil(l),v=p[m],w=p[_];if(typeof v!="number"||typeof w!="number")throw new Ds(`Cannot interpolate between non-number values at index ${l}.`);const A=l-m;return v*(1-A)+w*A}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class F1{constructor(s,l){this.type=sr,this.needle=s,this.haystack=l}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,dr),m=l.parse(s[2],2,dr);return p&&m?v1(p.type,[sr,Gn,xi,vf,dr])?new F1(p,m):l.error(`Expected first argument to be of type boolean, string, number or null, but found ${Js(p.type)} instead`):null}evaluate(s){const l=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(p==null)return!1;if(!oy(l,["boolean","string","number","null"]))throw new Ds(`Expected first argument to be of type boolean, string, number or null, but found ${Js(ho(l))} instead.`);if(!oy(p,["string","array"]))throw new Ds(`Expected second argument to be of type array or string, but found ${Js(ho(p))} instead.`);return p.indexOf(l)>=0}eachChild(s){s(this.needle),s(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class vy{constructor(s,l,p){this.type=xi,this.needle=s,this.haystack=l,this.fromIndex=p}static parse(s,l){if(s.length<=2||s.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,dr),m=l.parse(s[2],2,dr);if(!p||!m)return null;if(!v1(p.type,[sr,Gn,xi,vf,dr]))return l.error(`Expected first argument to be of type boolean, string, number or null, but found ${Js(p.type)} instead`);if(s.length===4){const _=l.parse(s[3],3,xi);return _?new vy(p,m,_):null}return new vy(p,m)}evaluate(s){const l=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(!oy(l,["boolean","string","number","null"]))throw new Ds(`Expected first argument to be of type boolean, string, number or null, but found ${Js(ho(l))} instead.`);if(!oy(p,["string","array"]))throw new Ds(`Expected second argument to be of type array or string, but found ${Js(ho(p))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(s);return p.indexOf(l,m)}return p.indexOf(l)}eachChild(s){s(this.needle),s(this.haystack),this.fromIndex&&s(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const s=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),s]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ov{constructor(s,l,p,m,_,v){this.inputType=s,this.type=l,this.input=p,this.cases=m,this.outputs=_,this.otherwise=v}static parse(s,l){if(s.length<5)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length%2!=1)return l.error("Expected an even number of arguments.");let p,m;l.expectedType&&l.expectedType.kind!=="value"&&(m=l.expectedType);const _={},v=[];for(let k=2;k<s.length-1;k+=2){let R=s[k];const j=s[k+1];
vendor: 4,257 bytes, line 808
808Array.isArray(R)||(R=[R]);const z=l.concat(k);if(R.length===0)return z.error("Expected at least one branch label.");for(const q of R){if(typeof q!="number"&&typeof q!="string")return z.error("Branch labels must be numbers or strings.");if(typeof q=="number"&&Math.abs(q)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof q=="number"&&Math.floor(q)!==q)return z.error("Numeric branch labels must be integer values.");if(p){if(z.checkSubtype(p,ho(q)))return null}else p=ho(q);if(_[String(q)]!==void 0)return z.error("Branch labels must be unique.");_[String(q)]=v.length}const U=l.parse(j,k,m);if(!U)return null;m=m||U.type,v.push(U)}const w=l.parse(s[1],1,dr);if(!w)return null;const A=l.parse(s[s.length-1],s.length-1,m);return A?w.type.kind!=="value"&&l.concat(1).checkSubtype(p,w.type)?null:new Ov(p,m,w,_,v,A):null}evaluate(s){const l=this.input.evaluate(s);return(_v(ho(l),this.inputType)&&this.outputs[this.cases[l]]||this.otherwise).evaluate(s)}eachChild(s){s(this.input),this.outputs.forEach(s),s(this.otherwise)}outputDefined(){return this.outputs.every(s=>s.outputDefined())&&this.otherwise.outputDefined()}serialize(){const s=["match",this.input.serialize()],l=Object.keys(this.cases).sort(),p=[],m={};for(const v of l){const w=m[this.cases[v]];w===void 0?(m[this.cases[v]]=p.length,p.push([this.cases[v],[v]])):p[w][1].push(v)}const _=v=>this.inputType.kind==="number"?Number(v):v;for(const[v,w]of p)s.push(w.length===1?_(w[0]):w.map(_)),s.push(this.outputs[v].serialize());return s.push(this.otherwise.serialize()),s}}class Df{constructor(s,l,p){this.type=s,this.branches=l,this.otherwise=p}static parse(s,l){if(s.length<4)return l.error(`Expected at least 3 arguments, but found only ${s.length-1}.`);if(s.length%2!=0)return l.error("Expected an odd number of arguments.");let p;l.expectedType&&l.expectedType.kind!=="value"&&(p=l.expectedType);const m=[];for(let v=1;v<s.length-1;v+=2){const w=l.parse(s[v],v,sr);if(!w)return null;const A=l.parse(s[v+1],v+1,p);if(!A)return null;m.push([w,A]),p=p||A.type}const _=l.parse(s[s.length-1],s.length-1,p);return _?new Df(p,m,_):null}evaluate(s){for(const[l,p]of this.branches)if(l.evaluate(s))return p.evaluate(s);return this.otherwise.evaluate(s)}eachChild(s){for(const[l,p]of this.branches)s(l),s(p);s(this.otherwise)}outputDefined(){return this.branches.every(([s,l])=>l.outputDefined())&&this.otherwise.outputDefined()}serialize(){const s=["case"];return this.eachChild(l=>{s.push(l.serialize())}),s}}class Fv{constructor(s,l,p,m){this.type=s,this.input=l,this.beginIndex=p,this.endIndex=m}static parse(s,l){if(s.length<=2||s.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,dr),m=l.parse(s[2],2,xi);if(!p||!m)return null;if(!v1(p.type,[Do(dr),Gn,dr]))return l.error(`Expected first argument to be of type array or string, but found ${Js(p.type)} instead`);if(s.length===4){const _=l.parse(s[3],3,xi);return _?new Fv(p.type,p,m,_):null}return new Fv(p.type,p,m)}evaluate(s){const l=this.input.evaluate(s),p=this.beginIndex.evaluate(s);if(!oy(l,["string","array"]))throw new Ds(`Expected first argument to be of type array or string, but found ${Js(ho(l))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(s);return l.slice(p,m)}return l.slice(p)}eachChild(s){s(this.input),s(this.beginIndex),this.endIndex&&s(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const s=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),s]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Bv{constructor(s,l){this.type=Do(Gn),this.str=s,this.delimiter=l}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=l.parse(s[1],1,Gn),m=l.parse(s[2],2,Gn);return p&&m?new Bv(p,m):void 0}evaluate(s){const l=this.str.evaluate(s),p=this.delimiter.evaluate(s);return l.split(p)}eachChild(s){s(this.str),s(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function n2(u,s){return u==="=="||u==="!="?s.kind==="boolean"||s.kind==="str
808ing"||s.kind==="number"||s.kind==="null"||s.kind==="value":s.kind==="string"||s.kind==="number"||s.kind==="value"}function r2(u,s,l,p){return p.compare(s,l)===0}function Rf(u,s,l){const p=u!=="=="&&u!=="!=";return class jne{constructor(_,v,w){this.type=sr,this.lhs=_,this.rhs=v,this.collator=w,this.hasUntypedArgument=_.type.kind==="value"||v.type.kind==="value"}static parse(_,v){if(_.length!==3&&_.length!==4)return v.error("Expected two or three arguments.");const w=_[0];let A=v.parse(_[1],1,dr);if(!A)return null;if(!n2(w,A.type))return v.concat(1).error(`"${w}" comparisons are not supported for type '${Js(A.type)}'.`);let k=v.parse(_[2],2,dr);if(!k)return null;if(!n2(w,k.type))return v.concat(2).error(`"${w}" comparisons are not supported for type '${Js(k.type)}'.`);if(A.type.kind!==k.type.kind&&A.type.kind!=="value"&&k.type.kind!=="value")return v.error(`Cannot compare types '${Js(A.type)}' and '${Js(k.type)}'.`);p&&(A.type.kind==="value"&&k.type.kind!=="value"?A=new hi(k.type,[A]):A.type.kind!=="value"&&k.type.kind==="value"&&(k=new hi(A.type,[k])));let R=null;if(_.length===4){if(A.type.kind!=="string"&&k.type.kind!=="string"&&A.type.kind!=="value"&&k.type.kind!=="value")return v.error("Cannot use collator to compare non-string types.");if(R=v.parse(_[3],3,ny),!R)return null}return new jne(A,k,R)}evaluate(_){const v=this.lhs.evaluate(_),w=this.rhs.evaluate(_);if(p&&this.hasUntypedArgument){const A=ho(v),k=ho(w);if(A.kind!==k.kind||A.kind!=="string"&&A.kind!=="number")throw new Ds(`Expected arguments for "${u}" to be (string, string) or (number, number), but found (${A.kind}, ${k.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const A=ho(v),k=ho(w);if(A.kind!=="string"||k.kind!=="string")return s(_,v,w)}return this.collator?l(_,v,w,this.collator.evaluate(_)):s(_,v,w)}eachChild(_){_(this.lhs),_(this.rhs),this.collator&&_(this.collator)}outputDefined(){return!0}serialize(){const _=[u];return this.eachChild(v=>{_.push(v.serialize())}),_}}}const s2=Rf("==",function(u,s,l){return s===l},r2),o2=Rf("!=",function(u,s,l){return s!==l},function(u,s,l,p){return!r2(0,s,l,p)}),uD=Rf("<",function(u,s,l){return s<l},function(u,s,l,p){return p.compare(s,l)<0}),dD=Rf(">",function(u,s,l){return s>l},function(u,s,l,p){return p.compare(s,l)>0}),hD=Rf("<=",function(u,s,l){return s<=l},function(u,s,l,p){return p.compare(s,l)<=0}),Uv=Rf(">=",function(u,s,l){return s>=l},function(u,s,l,p){return p.compare(s,l)>=0});class B1{constructor(s,l,p,m,_,v){this.type=Gn,this.number=s,this.locale=l,this.currency=p,this.unit=m,this.minFractionDigits=_,this.maxFractionDigits=v}static parse(s,l){if(s.length!==3)return l.error("Expected two arguments.");const p=l.parse(s[1],1,xi);if(!p)return null;const m=s[2];if(typeof m!="object"||Array.isArray(m))return l.error("NumberFormat options argument must be an object.");let _=null;if(m.locale&&(_=l.parseObjectValue(m.locale,2,"locale",Gn),!_))return null;let v=null;if(m.currency&&(v=l.parseObjectValue(m.currency,2,"currency",Gn),!v))return null;let w=null;if(m.unit&&(w=l.parseObjectValue(m.unit,2,"unit",Gn),!w))return null;let A=null;if(m["min-fraction-digits"]&&(A=l.parseObjectValue(m["min-fraction-digits"],2,"min-fraction-digits",xi),!A))return null;let k=null;return m["max-fraction-digits"]&&(k=l.parseObjectValue(m["max-fraction-digits"],2,"max-fraction-digits",xi),!k)?null:new B1(p,_,v,w,A,k)}evaluate(s){return new Intl.NumberFormat(this.locale?this.locale.evaluate(s):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(s):void 0,unit:this.unit?this.unit.evaluate(s):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(s):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(s):void 0}).format(this.number.evaluate(s))}eachChild(s){s(this.number),this.locale&&s(this.locale),this.currency&&s(this.currency),this.unit&&s(this.unit),this.minFractionDigits&&s(this.minFractionDigits),this.maxFractionDigits&&s(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const s={};return this.locale&&(s.locale=this.locale.serialize()),this.currency&&(s.currency=this.currency.serialize()),this.unit&&(s.unit=this.unit.serialize()),this.minFractionDigits&&(s["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(s["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),s]}}class U1{constructor(s){this.type=xi,this.input=s}static parse(s,l){if(s.length!==2)return l.error(`Expected 1 argument, but found ${s.length-1} instead.`);const p=l.parse(s[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?l.error(`Expected argument of type string or array, but found ${Js(p.type)} instead.`):new U1(p):null}evaluate(s){const l=this.input.evaluate(s);if(typeof l=="string"||Array.isArray(l))return l.length;throw new Ds(`Expected value to be of type string or array, but found ${Js(ho(l))} instead.`)}eachChild(s){s(this.input)}outputDefined(){return!1}serialize(){const s=["length"];return this.eachChild(l=>{s.push(l.serialize())}),s}}function a2(u){return function(){u=1831565813+(u|=0)|0;let s=Math.imul(u^u>>>15,1|u);return s=s+Math.imul(s^s>>>7,61|s)^s,((s^s>>>14)>>>0)/4294967296}}const jf={"==":s2,"!=":o2,">":dD,"<":uD,">=":Uv,"<=":hD,array:hi,at:L1,"at-interpolated":O1,boolean:hi,case:Df,coalesce:yy,collator:Sf,format:sp,image:Yi,in:F1,"index-of":vy,interpolate:jl,"interpolate-hcl":jl,"interpolate-lab":jl,length:U1,let:_y,literal:Zu,match:Ov,number:hi,"number-format":B1,object:hi,slice:Fv,step:my,string:hi,"to-boolean":gu,"to-color":gu,"to-number":gu,"to-string":gu,var:Nv,within:ap,distance:lp,config:Nf,split:Bv};function V1(u,[s,l,p,m]){s=s.evaluate(u),l=l.evaluate(u),p=p.evaluate(u);const _=m?m.evaluate(u):1,v=vv(s,l,p,_);if(v)throw new Ds(v);return new lr(s/255,l/255,p/255,_)}function l2(u,[s,l,p,m]){s=s.evaluate(u),l=l.evaluate(u),p=p.evaluate(u);const _=m?m.evaluate(u):1,v=function(k,R,j,z){return typeof k=="number"&&k>=0&&k<=360?typeof R=="number"&&R>=0&&R<=100&&typeof j=="number"&&j>=0&&j<=100?z===void 0||typeof z=="number"&&z>=0&&z<=1?null:`Invalid hsla value [${[k,R,j,z].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof z=="number"?[k,R,j,z]:[k,R,j]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof z=="number"?[k,R,j,z]:[k,R,j]).join(", ")}]: 'h' must be between 0 and 360.`}(s,l,p,_);if(v)throw new Ds(v);const w=`hsla(${s}, ${l}%, ${p}%, ${_})`,A=lr.parse(w);if(!A)throw new Ds(`Failed to parse HSLA color: ${w}`);return A}function c2(u,s){return u in s}function Vv(u,s){const l=s[u];return l===void 0?null:l}function Yu(u){return{type:u}}function xy(u){if(u instanceof Nf)return new Set([u.key]);let s=new Set;return u.eachChild(l=>{s=new Set([...s,...xy(l)])}),s}function $v(u){if(u instanceof ya&&u.name==="is-active-floor")return!0;let s=!1;return u.eachChild(l=>{!s&&$v(l)&&(s=!0)}),s}function dp(u){return{result:"success",value:u}}function Jd(u){return{result:"error",value:u}}function $1(u,s){return!!u&&!!u.parameters&&u.parameters.indexOf(s)>-1}function qv(u){return u["property-type"]==="data-driven"}function q1(u){return $1(u.expression,"measure-light")}function H1(u){return $1(u.expression,"zoom")}function Hv(u){return!!u.expression&&u.expression.interpolated}function Gv(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function G1(u){return u}function Wv(u,s){const l=s.type==="color",p=u.stops&&typeof u.stops[0][0]=="object",m=p||!(p||u.property!==void 0),_=u.type||(Hv(s)?"exponential":"interval");if(l&&((u=Object.assign({},u)).stops&&(u.stops=u.stops.map(k=>[k[0],lr.parse(k[1])])),u.default=lr.parse(u.default?u.default:s.default)),u.colorSpace&&u.colorSpace!=="rgb"&&!Lv[u.colorSpace])throw new Error(`Unknown color space: ${u.colorSpace}`);let v,w,A;if(_==="exponential")v=u2;else if(_==="interval")v=eh;else if(_==="categorical"){v=pD,w=Object.create(null);for(const k of u.stops)w[k[0]]=k[1];A=typeof u.stops[0][0]}else{if(_!=="identity")throw new Error(`Unknown function type "${_}"`);v=fD}if(p){const k={},R=[];for(let U=0;U<u.stops.length;U++){const q=u.stops[U],X=q[0].zoom;k[X]===void 0&&(k[X]={zoom:X,type:u.type,property:u.property,default:u.default,stops:[]}
vendor: 8,109 bytes, line 808
808,R.push(X)),k[X].stops.push([q[0].value,q[1]])}const j=[];for(const U of R)j.push([k[U].zoom,Wv(k[U],s)]);const z={name:"linear"};return{kind:"composite",interpolationType:z,interpolationFactor:jl.interpolationFactor.bind(void 0,z),zoomStops:j.map(U=>U[0]),evaluate:({zoom:U},q)=>u2({stops:j,base:u.base},s,U).evaluate(U,q)}}if(m){const k=_==="exponential"?{name:"exponential",base:u.base!==void 0?u.base:1}:null;return{kind:"camera",interpolationType:k,interpolationFactor:jl.interpolationFactor.bind(void 0,k),zoomStops:u.stops.map(R=>R[0]),evaluate:({zoom:R})=>v(u,s,R,w,A)}}return{kind:"source",evaluate(k,R){const j=R&&R.properties?R.properties[u.property]:void 0;return j===void 0?zf(u.default,s.default):v(u,s,j,w,A)}}}function zf(u,s,l){return u!==void 0?u:s!==void 0?s:l!==void 0?l:void 0}function pD(u,s,l,p,m){return zf(typeof l===m?p[l]:void 0,u.default,s.default)}function eh(u,s,l){if(!ly(l))return zf(u.default,s.default);const p=u.stops.length;if(p===1||l<=u.stops[0][0])return u.stops[0][1];if(l>=u.stops[p-1][0])return u.stops[p-1][1];const m=Dv(u.stops.map(_=>_[0]),l);return u.stops[m][1]}function u2(u,s,l){const p=u.base!==void 0?u.base:1;if(!ly(l))return zf(u.default,s.default);const m=u.stops.length;if(m===1||l<=u.stops[0][0])return u.stops[0][1];if(l>=u.stops[m-1][0])return u.stops[m-1][1];const _=Dv(u.stops.map(R=>R[0]),l),v=function(R,j,z,U){const q=U-z,X=R-z;return q===0?0:j===1?X/q:(Math.pow(j,X)-1)/(Math.pow(j,q)-1)}(l,p,u.stops[_][0],u.stops[_+1][0]),w=u.stops[_][1],A=u.stops[_+1][1];let k=Wu[s.type]||G1;if(u.colorSpace&&u.colorSpace!=="rgb"){const R=Lv[u.colorSpace];k=(j,z)=>R.reverse(R.interpolate(R.forward(j),R.forward(z),v))}return typeof w.evaluate=="function"?{evaluate(...R){const j=w.evaluate.apply(void 0,R),z=A.evaluate.apply(void 0,R);if(j!==void 0&&z!==void 0)return k(j,z,v)}}:k(w,A,v)}function fD(u,s,l){return s.type==="color"?l=lr.parse(l):s.type==="formatted"?l=_o.fromString(l.toString()):s.type==="resolvedImage"?l=Ya.build(l.toString()):wf(l)===s.type||s.type==="enum"&&s.values[l]||(l=void 0),zf(l,u.default,s.default)}ya.register(jf,{error:[{kind:"error"},[Gn],(u,[s])=>{throw new Ds(s.evaluate(u))}],typeof:[Gn,[dr],(u,[s])=>Js(ho(s.evaluate(u)))],"to-rgba":[Do(xi,4),[fl],(u,[s])=>s.evaluate(u).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Do(xi,4),[fl],(u,[s])=>s.evaluate(u).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[fl,[xi,xi,xi],V1],rgba:[fl,[xi,xi,xi,xi],V1],hsl:[fl,[xi,xi,xi],l2],hsla:[fl,[xi,xi,xi,xi],l2],has:{type:sr,overloads:[[[Gn],(u,[s])=>c2(s.evaluate(u),u.properties())],[[Gn,xf],(u,[s,l])=>c2(s.evaluate(u),l.evaluate(u))]]},get:{type:dr,overloads:[[[Gn],(u,[s])=>Vv(s.evaluate(u),u.properties())],[[Gn,xf],(u,[s,l])=>Vv(s.evaluate(u),l.evaluate(u))]]},"feature-state":[dr,[Gn],(u,[s])=>Vv(s.evaluate(u),u.featureState||{})],properties:[xf,[],u=>u.properties()],"geometry-type":[Gn,[],u=>u.geometryType()],worldview:[Gn,[],u=>u.globals.worldview||""],"is-active-floor":[sr,Yu(Gn),(u,s)=>{if(!(u.globals.activeFloors&&u.globals.activeFloors.size>0))return!1;const l=u.globals.activeFloors;return s.some(p=>{const m=p.evaluate(u);return l.has(m)})}],id:[dr,[],u=>u.id()],zoom:[xi,[],u=>u.globals.zoom],pitch:[xi,[],u=>u.globals.pitch||0],"distance-from-center":[xi,[],u=>u.distanceFromCenter()],"measure-light":[xi,[Gn],(u,[s])=>u.measureLight(s.evaluate(u))],"heatmap-density":[xi,[],u=>u.globals.heatmapDensity||0],"line-progress":[xi,[],u=>u.globals.lineProgress||0],"raster-value":[xi,[],u=>u.globals.rasterValue||0],"raster-particle-speed":[xi,[],u=>u.globals.rasterParticleSpeed||0],"sky-radial-progress":[xi,[],u=>u.globals.skyRadialProgress||0],accumulated:[dr,[],u=>u.globals.accumulated===void 0?null:u.globals.accumulated],"+":[xi,Yu(xi),(u,s)=>{let l=0;for(const p of s)l+=p.evaluate(u);return l}],"*":[xi,Yu(xi),(u,s)=>{let l=1;for(const p of s)l*=p.evaluate(u);return l}],"-":{type:xi,overloads:[[[xi,xi],(u,[s,l])=>s.evaluate(u)-l.evaluate(u)],[[xi],(u,[s])=>-s.evaluate(u)]]},"/":[xi,[xi,xi],(u,[s,l])=>s.evaluate(u)/l.evaluate(u)],"%":[xi,[xi,xi],(u,[s,l])=>s.evaluate(u)%l.evaluate(u)],ln2:[xi,[],()=>Math.LN2],pi:[xi,[],()=>Math.PI],e:[xi,[],()=>Math.E],"^":[xi,[xi,xi],(u,[s,l])=>Math.pow(s.evaluate(u),l.evaluate(u))],sqrt:[xi,[xi],(u,[s])=>Math.sqrt(s.evaluate(u))],log10:[xi,[xi],(u,[s])=>Math.log(s.evaluate(u))/Math.LN10],ln:[xi,[xi],(u,[s])=>Math.log(s.evaluate(u))],log2:[xi,[xi],(u,[s])=>Math.log2(s.evaluate(u))],sin:[xi,[xi],(u,[s])=>Math.sin(s.evaluate(u))],cos:[xi,[xi],(u,[s])=>Math.cos(s.evaluate(u))],tan:[xi,[xi],(u,[s])=>Math.tan(s.evaluate(u))],asin:[xi,[xi],(u,[s])=>Math.asin(s.evaluate(u))],acos:[xi,[xi],(u,[s])=>Math.acos(s.evaluate(u))],atan:[xi,[xi],(u,[s])=>Math.atan(s.evaluate(u))],min:[xi,Yu(xi),(u,s)=>Math.min(...s.map(l=>l.evaluate(u)))],max:[xi,Yu(xi),(u,s)=>Math.max(...s.map(l=>l.evaluate(u)))],abs:[xi,[xi],(u,[s])=>Math.abs(s.evaluate(u))],round:[xi,[xi],(u,[s])=>{const l=s.evaluate(u);return l<0?-Math.round(-l):Math.round(l)}],floor:[xi,[xi],(u,[s])=>Math.floor(s.evaluate(u))],ceil:[xi,[xi],(u,[s])=>Math.ceil(s.evaluate(u))],"filter-==":[sr,[Gn,dr],(u,[s,l])=>u.properties()[s.value]===l.value],"filter-id-==":[sr,[dr],(u,[s])=>u.id()===s.value],"filter-type-==":[sr,[Gn],(u,[s])=>u.geometryType()===s.value],"filter-<":[sr,[Gn,dr],(u,[s,l])=>{const p=u.properties()[s.value],m=l.value;return typeof p==typeof m&&p<m}],"filter-id-<":[sr,[dr],(u,[s])=>{const l=u.id(),p=s.value;return typeof l==typeof p&&l<p}],"filter->":[sr,[Gn,dr],(u,[s,l])=>{const p=u.properties()[s.value],m=l.value;return typeof p==typeof m&&p>m}],"filter-id->":[sr,[dr],(u,[s])=>{const l=u.id(),p=s.value;return typeof l==typeof p&&l>p}],"filter-<=":[sr,[Gn,dr],(u,[s,l])=>{const p=u.properties()[s.value],m=l.value;return typeof p==typeof m&&p<=m}],"filter-id-<=":[sr,[dr],(u,[s])=>{const l=u.id(),p=s.value;return typeof l==typeof p&&l<=p}],"filter->=":[sr,[Gn,dr],(u,[s,l])=>{const p=u.properties()[s.value],m=l.value;return typeof p==typeof m&&p>=m}],"filter-id->=":[sr,[dr],(u,[s])=>{const l=u.id(),p=s.value;return typeof l==typeof p&&l>=p}],"filter-has":[sr,[dr],(u,[s])=>s.value in u.properties()],"filter-has-id":[sr,[],u=>u.id()!==null&&u.id()!==void 0],"filter-type-in":[sr,[Do(Gn)],(u,[s])=>s.value.indexOf(u.geometryType())>=0],"filter-id-in":[sr,[Do(dr)],(u,[s])=>s.value.indexOf(u.id())>=0],"filter-in-small":[sr,[Gn,Do(dr)],(u,[s,l])=>l.value.indexOf(u.properties()[s.value])>=0],"filter-in-large":[sr,[Gn,Do(dr)],(u,[s,l])=>function(p,m,_,v){for(;_<=v;){const w=_+v>>1;if(m[w]===p)return!0;m[w]>p?v=w-1:_=w+1}return!1}(u.properties()[s.value],l.value,0,l.value.length-1)],all:{type:sr,overloads:[[[sr,sr],(u,[s,l])=>s.evaluate(u)&&l.evaluate(u)],[Yu(sr),(u,s)=>{for(const l of s)if(!l.evaluate(u))return!1;return!0}]]},any:{type:sr,overloads:[[[sr,sr],(u,[s,l])=>s.evaluate(u)||l.evaluate(u)],[Yu(sr),(u,s)=>{for(const l of s)if(l.evaluate(u))return!0;return!1}]]},"!":[sr,[sr],(u,[s])=>!s.evaluate(u)],"is-supported-script":[sr,[Gn],(u,[s])=>{const l=u.globals&&u.globals.isSupportedScript;return!l||l(s.evaluate(u))}],upcase:[Gn,[Gn],(u,[s])=>s.evaluate(u).toUpperCase()],downcase:[Gn,[Gn],(u,[s])=>s.evaluate(u).toLowerCase()],concat:[Gn,Yu(dr),(u,s)=>s.map(l=>mu(l.evaluate(u))).join("")],"resolved-locale":[Gn,[ny],(u,[s])=>s.evaluate(u).resolvedLocale()],random:[xi,[xi,xi,dr],(u,s)=>{const[l,p,m]=s.map(v=>v.evaluate(u));if(l>p||l===p)return l;let _;if(typeof m=="string")_=function(v){let w=0;if(v.length===0)return w;for(let A=0;A<v.length;A++)w=(w<<5)-w+v.charCodeAt(A),w|=0;return w}(m);else{if(typeof m!="number")throw new Ds(`Invalid seed input: ${m}`);_=m}return l+a2(_)()*(p-l)}]});class Kv{constructor(s,l,p,m,_){this.expression=s,this._warningHistory={},this._scope=p,this._options=m,this._iconImageUseTheme=_,this._evaluator=new Ro(p,m,_),this._defaultValue=l?function(v){return v.type==="color"&&(Gv(v.default)||Array.isArray(v.default))?new lr(0,0,0,0):v.type==="color"?lr.parse(v.default)||null:v.default===void 0?null:v.default}(l):null,this._enumValues=l&&l.type==="enum"?l.values:null,this.configDependencies=xy(s),this.isIndo
808orDependent=$v(s)}evaluateWithoutErrorHandling(s,l,p,m,_,v,w,A){return this._evaluator.globals=s,this._evaluator.feature=l,this._evaluator.featureState=p,this._evaluator.canonical=m||null,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=v,this._evaluator.featureTileCoord=w||null,this._evaluator.featureDistanceData=A||null,this.expression.evaluate(this._evaluator)}evaluate(s,l,p,m,_,v,w,A,k){this._evaluator||(this._evaluator=new Ro(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=s,this._evaluator.feature=l||null,this._evaluator.featureState=p||null,this._evaluator.canonical=m||null,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=v||null,this._evaluator.featureTileCoord=w||null,this._evaluator.featureDistanceData=A||null,this._evaluator.iconImageUseTheme=k||null;try{const R=this.expression.evaluate(this._evaluator);if(R==null||typeof R=="number"&&R!=R)return this._defaultValue;if(this._enumValues&&!(R in this._enumValues))throw new Ds(`Expected value to be one of ${Object.keys(this._enumValues).map(j=>JSON.stringify(j)).join(", ")}, but found ${JSON.stringify(R)} instead.`);return R}catch(R){return this._warningHistory[R.message]||(this._warningHistory[R.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${R.message}`)),this._defaultValue}}}function Zv(u){return Array.isArray(u)&&u.length>0&&typeof u[0]=="string"&&u[0]in jf}function _u(u,s,l,p,m){const _=new Mv(jf,[],s?function(w){const A={color:fl,string:Gn,number:xi,enum:Gn,boolean:sr,formatted:rp,resolvedImage:ry};return w.type==="array"?Do(A[w.value]||dr,w.length):A[w.type]}(s):void 0,void 0,void 0,l,p,m),v=_.parse(u,void 0,void 0,void 0,s&&s.type==="string"?{typeAnnotation:"coerce"}:void 0);return v?dp(new Kv(v,s,l,p,m)):Jd(_.errors)}class by{constructor(s,l,p,m){this.kind=s,this._styleExpression=l,this.isLightConstant=p,this.isLineProgressConstant=m,this.isStateDependent=s!=="constant"&&!fy(l.expression),this.configDependencies=xy(l.expression),this.isIndoorDependent=$v(l.expression)}evaluateWithoutErrorHandling(s,l,p,m,_,v){return this._styleExpression.evaluateWithoutErrorHandling(s,l,p,m,_,v)}evaluate(s,l,p,m,_,v,w){return this._styleExpression.evaluate(s,l,p,m,_,v,void 0,void 0,w)}}class th{constructor(s,l,p,m,_,v){this.kind=s,this.zoomStops=p,this._styleExpression=l,this.isStateDependent=s!=="camera"&&!fy(l.expression),this.isIndoorDependent=$v(l.expression),this.isLightConstant=_,this.isLineProgressConstant=v,this.configDependencies=xy(l.expression),this.interpolationType=m}evaluateWithoutErrorHandling(s,l,p,m,_,v){return this._styleExpression.evaluateWithoutErrorHandling(s,l,p,m,_,v)}evaluate(s,l,p,m,_,v){return this._styleExpression.evaluate(s,l,p,m,_,v)}interpolationFactor(s,l,p){return this.interpolationType?jl.interpolationFactor(this.interpolationType,s,l,p):0}}function W1(u,s,l,p,m){if((u=_u(u,s,l,p,m)).result==="error")return u;const _=u.value.expression,v=kf(_);if(!v&&!qv(s))return Jd([new yc("","data expressions not supported")]);const w=Pf(_,["zoom","pitch","distance-from-center"]);if(!w&&!H1(s))return Jd([new yc("","zoom expressions not supported")]);const A=Pf(_,["measure-light"]);if(!A&&!q1(s))return Jd([new yc("","measure-light expression not supported")]);const k=Pf(_,["line-progress"]);if(!k&&!function(z){return $1(z.expression,"line-progress")}(s))return Jd([new yc("","line-progress expression not supported")]);const R=s.expression&&s.expression.relaxZoomRestriction,j=Yv(_);return j||w||R?j instanceof yc?Jd([j]):j instanceof jl&&!Hv(s)?Jd([new yc("",'"interpolate" expressions cannot be used with this property')]):dp(j?new th(v&&k?"camera":"composite",u.value,j.labels,j instanceof jl?j.interpolation:void 0,A,k):new by(v&&k?"constant":"source",u.value,A,k)):Jd([new yc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Xv{constructor(s,l){this._parameters=s,this._specification=l,Object.assign(this,Wv(this._parameters,this._specification))}static deserialize(s){return new Xv(s._parameters,s._specification)}static serialize(s){return{_parameters:s._parameters,_specification:s._specification}}}function Yv(u){let s=null;if(u instanceof _y)s=Yv(u.result);else if(u instanceof yy){for(const l of u.args)if(s=Yv(l),s)break}else(u instanceof my||u instanceof jl)&&u.input instanceof ya&&u.input.name==="zoom"&&(s=u);return s instanceof yc||u.eachChild(l=>{const p=Yv(l);p instanceof yc?s=p:s&&p&&s!==p&&(s=new yc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),s}var wy,Qv,d2=function(){if(Qv)return wy;Qv=1,wy=s;var u=3;function s(l,p,m){var _=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;var v=new Int32Array(this.arrayBuffer);l=v[0],this.d=(p=v[1])+2*(m=v[2]);for(var w=0;w<this.d*this.d;w++){var A=v[u+w],k=v[u+w+1];_.push(A===k?null:v.subarray(A,k))}var R=v[u+_.length+1];this.keys=v.subarray(v[u+_.length],R),this.bboxes=v.subarray(R),this.insert=this._insertReadonly}else{this.d=p+2*m;for(var j=0;j<this.d*this.d;j++)_.push([]);this.keys=[],this.bboxes=[]}this.n=p,this.extent=l,this.padding=m,this.scale=p/l,this.uid=0;var z=m/p*l;this.min=-z,this.max=l+z}
808return s.prototype.insert=function(l,p,m,_,v){this._forEachCell(p,m,_,v,this._insertCell,this.uid++),this.keys.push(l),this.bboxes.push(p),this.bboxes.push(m),this.bboxes.push(_),this.bboxes.push(v)},s.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},s.prototype._insertCell=function(l,p,m,_,v,w){this.cells[v].push(w)},s.prototype.query=function(l,p,m,_,v){var w=this.min,A=this.max;if(l<=w&&p<=w&&A<=m&&A<=_&&!v)return Array.prototype.slice.call(this.keys);var k=[];return this._forEachCell(l,p,m,_,this._queryCell,k,{},v),k},s.prototype._queryCell=function(l,p,m,_,v,w,A,k){var R=this.cells[v];if(R!==null)for(var j=this.keys,z=this.bboxes,U=0;U<R.length;U++){var q=R[U];if(A[q]===void 0){var X=4*q;(k?k(z[X+0],z[X+1],z[X+2],z[X+3]):l<=z[X+2]&&p<=z[X+3]&&m>=z[X+0]&&_>=z[X+1])?(A[q]=!0,w.push(j[q])):A[q]=!1}}},s.prototype._forEachCell=function(l,p,m,_,v,w,A,k){for(var R=this._convertToCellCoord(l),j=this._convertToCellCoord(p),z=this._convertToCellCoord(m),U=this._convertToCellCoord(_),q=R;q<=z;q++)for(var X=j;X<=U;X++){var Q=this.d*X+q;if((!k||k(this._convertFromCellCoord(q),this._convertFromCellCoord(X),this._convertFromCellCoord(q+1),this._convertFromCellCoord(X+1)))&&v.call(this,l,p,m,_,Q,w,A,k))return}},s.prototype._convertFromCellCoord=function(l){return(l-this.padding)/this.scale},s.prototype._convertToCellCoord=function(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))},s.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var l=this.cells,p=u+this.cells.length+1+1,m=0,_=0;_<this.cells.length;_++)m+=this.cells[_].length;var v=new Int32Array(p+m+this.keys.length+this.bboxes.length);v[0]=this.extent,v[1]=this.n,v[2]=this.padding;for(var w=p,A=0;A<l.length;A++){var k=l[A];v[u+A]=w,v.set(k,w),w+=k.length}return v[u+l.length]=w,v.set(this.keys,w),v[u+l.length+1]=w+=this.keys.length,v.set(this.bboxes,w),w+=this.bboxes.length,v.buffer},wy}(),hp=qs(d2);const Lf={};function ri(u,s,l={}){Object.defineProperty(u,"_classRegistryKey",{value:s,writable:!1}),Lf[s]={klass:u,omit:l.omit||[]}}ri(Object,"Object"),hp.serialize=function(u,s){const l=u.toArrayBuffer();return s&&s.add(l),{buffer:l}},hp.deserialize=function(u){return new hp(u.buffer)},Object.defineProperty(hp,"name",{value:"Grid"}),ri(hp,"Grid"),delete Tt.prototype.constructor,typeof DOMMatrix<"u"&&ri(DOMMatrix,"DOMMatrix"),ri(lr,"Color"),ri(Error,"Error"),ri(_o,"Formatted"),ri(ay,"FormattedSection"),ri(ip,"AJAXError"),ri(Ya,"ResolvedImage"),ri(Xv,"StylePropertyFunction"),ri(Kv,"StyleExpression",{omit:["_evaluator"]}),ri(no,"ImageId"),ri(Ku,"ImageVariant"),ri(th,"ZoomDependentExpression"),ri(by,"ZoomConstantExpression"),ri(ya,"CompoundExpression",{omit:["_evaluate"]});for(const u in jf)Lf[jf[u]._classRegistryKey]||ri(jf[u],`Expression${u}`);function K1(u){return u&&typeof ArrayBuffer<"u"&&(u instanceof ArrayBuffer||u.constructor&&u.constructor.name==="ArrayBuffer")}function Qu(u){return self.ImageBitmap&&u instanceof ImageBitmap}function ih(u,s){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp)return u;if(K1(u)||Qu(u))return s&&s.add(u),u;if(ArrayBuffer.isView(u))return s&&s.add(u.buffer),u;if(u instanceof ImageData)return s&&s.add(u.data.buffer),u;if(Array.isArray(u)){const l=[];for(const p of u)l.push(ih(p,s));return l}if(u instanceof Map){const l={$name:"Map",entries:[]};for(const[p,m]of u.entries())l.entries.push(ih(p),ih(m,s));return l}if(u instanceof Set){const l={$name:"Set"};let p=0;for(const m of u.values())l[++p]=ih(m);return l}if(u instanceof DOMMatrix){const l={$name:"DOMMatrix"},p=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const m of p)l[m]=u[m];return l}if(typeof u=="bigint")return{$name:"BigInt",value:u.toString()};if(typeof u=="object"){const l=u.constructor,p=l._classRegistryKey;if(!p)throw new Error(`Can't serialize object of unregistered class "${l.name}".`);const m=l.serialize?l.serialize(u,s):{};if(!l.serialize){for(const _ in u)u.hasOwnProperty(_)&&(Lf[p].omit.indexOf(_)>=0||(m[_]=ih(u[_],s)));u instanceof Error&&(m.message=u.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return p!=="Object"&&(m.$name=p),m}throw new Error("can't serialize object of type "+typeof u)}function nh(u){if(u==null||typeof u=="boolean"||typeof u=="number"||typeof u=="string"||u instanceof Boolean||u instanceof Number||u instanceof String||u instanceof Date||u instanceof RegExp||K1(u)||Qu(u)||ArrayBuffer.isView(u)||u instanceof ImageData)return u;if(Array.isArray(u))return u.map(nh);if(typeof u=="object"){const s=u.$name||"Object";if(s==="Map"){const m=u.entries||[],_=new Map;for(let v=0;v<m.length;v+=2)_.set(nh(m[v]),nh(m[v+1]));return _}if(s==="Set"){const m=new Set;for(const _ of Object.keys(u))_!=="$name"&&m.add(nh(u[_]));return m}if(s==="DOMMatrix"){let m;return m=u.is2D?[u.a,u.b,u.c,u.d,u.e,u.f]:[u.m11,u.m12,u.m13,u.m14,u.m21,u.m22,u.m23,u.m24,u.m31,u.m32,u.m33,u.m34,u.m41,u.m42,u.m43,u.m44],new DOMMatrix(m)}if(s==="BigInt")return BigInt(u.value);const{klass:l}=Lf[s];if(!l)throw new Error(`Can't deserialize unregistered class "${s}".`);if(l.deserialize)return l.deserialize(u);const p=Object.create(l.prototype);for(const m of Object.keys(u))m!=="$name"&&(p[m]=nh(u[m]));return p}throw new Error("can't deserialize object of type "+typeof u)}const Ri={"Latin-1 Supplement":u=>u>=128&&u<=255,Arabic:u=>u>=1536&&u<=1791,"Arabic Supplement":u=>u>=1872&&u<=1919,"Arabic Extended-A":u=>u>=2208&&u<=2303,"Hangul Jamo":u=>u>=4352&&u<=4607,"Unified Canadian Aboriginal Syllabics":u=>u>=5120&&u<=5759,Khmer:u=>u>=6016&&u<=6143,"Unified Canadian Aboriginal Syllabics Extended":u=>u>=6320&&u<=6399,"General Punctuation":u=>u>=8192&&u<=8303,"Letterlike Symbols":u=>u>=8448&&u<=8527,"Number Forms":u=>u>=8528&&u<=8591,"Miscellaneous Technical":u=>u>=8960&&u<=9215,"Control Pictures":u=>u>=9216&&u<=9279,"Optical Character Recognition":u=>u>=9280&&u<=9311,"Enclosed Alphanumerics":u=>u>=9312&&u<=9471,"Geometric Shapes":u=>u>=9632&&u<=9727,"Miscellaneous Symbols":u=>u>=9728&&u<=9983,"Miscellaneous Symbols and Arrows":u=>u>=11008&&u<=11263,"CJK Radicals Supplement":u=>u>=11904&&u<=12031,"Kangxi Radicals":u=>u>=12032&&u<=12255,"Ideographic Description Characters":u=>u>=12272&&u<=12287,"CJK Symbols and Punctuation":u=>u>=12288&&u<=12351,Hiragana:u=>u>=12352&&u<=12447,Katakana:u=>u>=12448&&u<=12543,Bopomofo:u=>u>=12544&&u<=12591,"Hangul Compatibility Jamo":u=>u>=12592&&u<=12687,Kanbun:u=>u>=12688&&u<=12703,"Bopomofo Extended":u=>u>=12704&&u<=12735,"CJK Strokes":u=>u>
808=12736&&u<=12783,"Katakana Phonetic Extensions":u=>u>=12784&&u<=12799,"Enclosed CJK Letters and Months":u=>u>=12800&&u<=13055,"CJK Compatibility":u=>u>=13056&&u<=13311,"CJK Unified Ideographs Extension A":u=>u>=13312&&u<=19903,"Yijing Hexagram Symbols":u=>u>=19904&&u<=19967,"CJK Unified Ideographs":u=>u>=19968&&u<=40959,"Yi Syllables":u=>u>=40960&&u<=42127,"Yi Radicals":u=>u>=42128&&u<=42191,"Hangul Jamo Extended-A":u=>u>=43360&&u<=43391,"Hangul Syllables":u=>u>=44032&&u<=55215,"Hangul Jamo Extended-B":u=>u>=55216&&u<=55295,"Private Use Area":u=>u>=57344&&u<=63743,"CJK Compatibility Ideographs":u=>u>=63744&&u<=64255,"Arabic Presentation Forms-A":u=>u>=64336&&u<=65023,"Vertical Forms":u=>u>=65040&&u<=65055,"CJK Compatibility Forms":u=>u>=65072&&u<=65103,"Small Form Variants":u=>u>=65104&&u<=65135,"Arabic Presentation Forms-B":u=>u>=65136&&u<=65279,"Halfwidth and Fullwidth Forms":u=>u>=65280&&u<=65519,Osage:u=>u>=66736&&u<=66815,"CJK Unified Ideographs Extension B":u=>u>=131072&&u<=173791};function Z1(u){for(const s of u)if(ex(s.charCodeAt(0)))return!0;return!1}function h2(u){for(const s of u)if(!Jv(s.charCodeAt(0)))return!1;return!0}function Jv(u){return!(Ri.Arabic(u)||Ri["Arabic Supplement"](u)||Ri["Arabic Extended-A"](u)||Ri["Arabic Presentation Forms-A"](u)||Ri["Arabic Presentation Forms-B"](u))}function ex(u){return!(u!==746&&u!==747&&(u<4352||!(Ri["Bopomofo Extended"](u)||Ri.Bopomofo(u)||Ri["CJK Compatibility Forms"](u)&&!(u>=65097&&u<=65103)||Ri["CJK Compatibility Ideographs"](u)||Ri["CJK Compatibility"](u)||Ri["CJK Radicals Supplement"](u)||Ri["CJK Strokes"](u)||!(!Ri["CJK Symbols and Punctuation"](u)||u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||Ri["CJK Unified Ideographs Extension A"](u)||Ri["CJK Unified Ideographs"](u)||Ri["Enclosed CJK Letters and Months"](u)||Ri["Hangul Compatibility Jamo"](u)||Ri["Hangul Jamo Extended-A"](u)||Ri["Hangul Jamo Extended-B"](u)||Ri["Hangul Jamo"](u)||Ri["Hangul Syllables"](u)||Ri.Hiragana(u)||Ri["Ideographic Description Characters"](u)||Ri.Kanbun(u)||Ri["Kangxi Radicals"](u)||Ri["Katakana Phonetic Extensions"](u)||Ri.Katakana(u)&&u!==12540||!(!Ri["Halfwidth and Fullwidth Forms"](u)||u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||!(!Ri["Small Form Variants"](u)||u>=65112&&u<=65118||u>=65123&&u<=65126)||Ri["Unified Canadian Aboriginal Syllabics"](u)||Ri["Unified Canadian Aboriginal Syllabics Extended"](u)||Ri["Vertical Forms"](u)||Ri["Yijing Hexagram Symbols"](u)||Ri["Yi Syllables"](u)||Ri["Yi Radicals"](u))))}function X1(u){return!(ex(u)||function(s){return!!(Ri["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||Ri["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||Ri["Letterlike Symbols"](s)||Ri["Number Forms"](s)||Ri["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||Ri["Control Pictures"](s)&&s!==9251||Ri["Optical Character Recognition"](s)||Ri["Enclosed Alphanumerics"](s)||Ri["Geometric Shapes"](s)||Ri["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||Ri["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||Ri["CJK Symbols and Punctuation"](s)||Ri.Katakana(s)||Ri["Private Use Area"](s)||Ri["CJK Compatibility Forms"](s)||Ri["Small Form Variants"](s)||Ri["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)}(u))}function Y1(u){return Ri.Arabic(u)||Ri["Arabic Supplement"](u)||Ri["Arabic Extended-A"](u)||Ri["Arabic Presentation Forms-A"](u)||Ri["Arabic Presentation Forms-B"](u)}function p2(u){return u>=1424&&u<=2303||Ri["Arabic Presentation Forms-A"](u)||Ri["Arabic Presentation Forms-B"](u)}function mD(u,s){return!(!s&&p2(u)||u>=2304&&u<=3583||u>=3840&&u<=4255||Ri.Khmer(u))}
vendor: 9,317 bytes, line 808
808function gD(u){for(const s of u)if(p2(s.charCodeAt(0)))return!0;return!1}const ml={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Q1=null,Na=ml.unavailable,rh=null;const f2=function(u){u&&typeof u=="string"&&u.indexOf("NetworkError")>-1&&(Na=ml.error),Q1&&Q1(u)};function J1(){ew.fire(new Dl("pluginStateChange",{pluginStatus:Na,pluginURL:rh}))}const ew=new Gu,tw=function(){return Na},iw=function(){if(Na!==ml.deferred||!rh)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Na=ml.loading,J1(),rh&&yf({url:rh},u=>{u?f2(u):(Na=ml.loaded,J1())})},gl={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Na===ml.loaded||gl.applyArabicShaping!=null,isLoading:()=>Na===ml.loading,setState(u){Na=u.pluginStatus,rh=u.pluginURL},isParsing:()=>Na===ml.parsing,isParsed:()=>Na===ml.parsed,getPluginURL:()=>rh};class Rr{constructor(s,l){this.zoom=s,l?(this.now=l.now,this.fadeDuration=l.fadeDuration,this.transition=l.transition,this.pitch=l.pitch,this.brightness=l.brightness,this.worldview=l.worldview,this.activeFloors=l.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(s){return function(l,p){for(const m of l)if(!mD(m.charCodeAt(0),p))return!1;return!0}(s,gl.isLoaded())}}class Sy{constructor(s,l,p,m,_){this.property=s,this.value=l,this.expression=function(v,w,A,k,R){if(Gv(v))return new Xv(v,w);if(Zv(v)||Array.isArray(v)&&v.length>0){const j=W1(v,w,A,k,R);if(j.result==="error")throw new Error(j.value.map(z=>`${z.key}: ${z.message}`).join(", "));return j.value}{let j=v;return typeof v=="string"&&w.type==="color"&&(j=lr.parse(v)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>j}}}(l===void 0?s.specification.default:l,s.specification,p,m,_)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,l,p,m){return this.property.possiblyEvaluate(this,s,l,p,m)}}class Of{constructor(s,l,p,m){this.property=s,this.value=new Sy(s,void 0,l,p,m)}transitioned(s,l){return new g2(this.property,this.value,l,Object.assign({},s.transition,this.transition),s.now)}untransitioned(){return new g2(this.property,this.value,null,{},0)}}class m2{constructor(s,l,p,m){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues),this._scope=l,this._options=p,this._iconImageUseTheme=m,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(s){return It(this._values[s].value.value)}setValue(s,l){this._values.hasOwnProperty(s)||(this._values[s]=new Of(this._values[s].property,this._scope,this._options,this._iconImageUseTheme)),this._values[s].value=new Sy(this._values[s].property,l===null?void 0:It(l),this._scope,this._options,this._iconImageUseTheme),this._values[s].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[s].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[s].value.isIndoorDependent())}setTransitionOrValue(s,l){l&&(this._options=l);const p=this._properties.properties;if(s)for(const m in s){const _=s[m];if(m.endsWith("-transition")){const v=m.slice(0,-11);p[v]&&this.setTransition(v,_)}else p.hasOwnProperty(m)&&this.setValue(m,_)}}getTransition(s){return It(this._values[s].transition)}setTransition(s,l){this._values.hasOwnProperty(s)||(this._values[s]=new Of(this._values[s].property)),this._values[s].transition=It(l)||void 0}serialize(){const s={};for(const l of Object.keys(this._values)){const p=this.getValue(l);p!==void 0&&(s[l]=p);const m=this.getTransition(l);m!==void 0&&(s[`${l}-transition`]=m)}return s}transitioned(s,l){const p=new Ju(this._properties);for(const m of Object.keys(this._values))p._values[m]=this._values[m].transitioned(s,l._values[m]);return p}untransitioned(){const s=new Ju(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].untransitioned();return s}isIndoorDependent(){return this._isIndoorDependent}}class g2{constructor(s,l,p,m,_){const v=m.delay||0,w=m.duration||0;_=_||0,this.property=s,this.value=l,this.begin=_+v,this.end=this.begin+w,s.specification.transition&&(m.delay||m.duration)&&(this.prior=p)}possiblyEvaluate(s,l,p){const m=s.now||0,_=this.value.possiblyEvaluate(s,l,p),v=this.prior;if(v){if(m>this.end)return this.prior=null,_;if(this.value.isDataDriven())return this.prior=null,_;if(m<this.begin)return v.possiblyEvaluate(s,l,p);{const w=(m-this.begin)/(this.end-this.begin);return this.property.interpolate(v.possiblyEvaluate(s,l,p),_,Kd(w))}}return _}}class Ju{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,l,p){const m=new pp(this._properties);for(const _ of Object.keys(this._values))m._values[_]=this._values[_].possiblyEvaluate(s,l,p);return m}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class nw{constructor(s,l,p,m){this._properties=s,this._values=Object.create(s.defaultPropertyValues),this._scope=l,this._options=p,this._iconImageUseTheme=m,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(s){return It(this._values[s].value)}setValue(s,l){this._values[s]=new Sy(this._values[s].property,l===null?void 0:It(l),this._scope,this._options,this._iconImageUseTheme),this._values[s].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[s].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[s].isIndoorDependent())}serialize(){const s={};for(const l of Object.keys(this._values)){const p=this.getValue(l);p!==void 0&&(s[l]=p)}return s}possiblyEvaluate(s,l,p,m){const _=new pp(this._properties);for(const v of Object.keys(this._values))_._values[v]=this._values[v].possiblyEvaluate(s,l,p,m);return _}isIndoorDependent(){return this._isIndoorDependent}}class wc{constructor(s,l,p,m){this.property=s,this.value=l,this.parameters=p,this.iconImageUseTheme=m}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,l,p,m){return this.property.evaluate(this.value,this.parameters,s,l,p,m,this.iconImageUseTheme)}}class pp{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class Nt{constructor(s){this.specification=s}possiblyEvaluate(s,l){return s.expression.evaluate(l)}interpolate(s,l,p){const m=Wu[this.specification.type];return m?m(s,l,p):s}}class Zt{constructor(s,l){this.specification=s,this.overrides=l}possiblyEvaluate(s,l,p,m,_){return s.expression.kind==="constant"||s.expression.kind==="camera"?new wc(this,{kind:"constant",value:s.expression.evaluate(l,null,{},p,m,void 0,_)},l):new wc(this,s.expression,l,_)}interpolate(s,l,p){if(s.value.kind!=="constant"||l.value.kind!=="constant")return s;if(s.value.value===void 0||l.value.value===void 0)return new wc(this,{kind:"constant",value:void 0},s.parameters);const m=Wu[this.specification.type];return m?new wc(this,{kind:"constant",value:m(s.value.value,l.value.value,p)},s.parameters):s}evaluate(s,l,p,m,_,v,w){return s.kind==="constant"?s.value:s.evaluate(l,p,m,_,v,void 0,w)}}class Ff{constructor(s){this.specification=s}possiblyEvaluate(s,l,p,m){return!!s.expression.evaluate(l,null,{},p,m)}interpolate(){return!1}}class bs{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const l=new Rr(0,{});for(const p in s){const m=s[p];m.specification.overridable&&this.overridableProperties.push(p);const _=this.defaultPropertyValues[p]=new Sy(m,void 0),v=this.defaultTransitionablePropertyValues[p]=new Of(m);this.defaultTransitioningPropertyValues[p]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[p]=_.possiblyEvaluate(l)}}}ri(Zt,"DataDrivenProperty"),ri(Nt,"DataConstantProperty"),ri(Ff,"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"}}
808,"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}
808,"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":{"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"}
808,"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,"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,"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],"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-extr
808usion-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"}
808,"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"]}},"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"]}},"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":{"int
808erpolated":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 rw(u){return u instanceof Number||u instanceof String||u instanceof Boolean?u.valueOf():u}function Bf(u){if(Array.isArray(u))return u.map(Bf);if(u instanceof Object&&!(u instanceof Number||u instanceof String||u instanceof Boolean)){const s={};for(const l in u)s[l]=Bf(u[l]);return s}return rw(u)}function Uf(u){if(u===!0||u===!1)return!0;if(!Array.isArray(u)||u.length===0)return!1;switch(u[0]){case"has":return u.length>=2&&u[1]!=="$id"&&u[1]!=="$type";case"in":return u.length>=3&&(typeof u[1]!="string"||Array.isArray(u[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return u.length!==3||Array.isArray(u[1])||Array.isArray(u[2]);case"any":case"all":for(const s of u.slice(1))if(!Uf(s)&&typeof s!="boolean")return!1;return!0;default:return!0}}function tx(u,s="",l=null,p="fill"){if(u==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Uf(u)||(u=zl(u));const m=u;let _=!0;try{_=function(R){if(!$f(R))return R;let j=Bf(R);return Vf(j),j=ix(j),j}(m)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 809This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 810and paste the contents of this message in the report. 811Thank you! 812Filter Expression: 813${JSON.stringify(m,null,2)} 814 `)}let v=null,w=null;if(p!=="background"&&p!=="sky"&&p!=="slot"){w=Ze[`filter_${p}`];const R=_u(_,w,s,l);if(R.result==="error")throw new Error(R.value.map(j=>`${j.key}: ${j.message}`).join(", "));v=(j,z,U)=>R.value.evaluate(j,z,{},U)}let A=null,k=null;if(_!==m){const R=_u(m,w,s,l);if(R.result==="error")throw new Error(R.value.map(j=>`${j.key}: ${j.message}`).join(", "));A=(j,z,U,q,X)=>R.value.evaluate(j,z,{},U,void 0,void 0,q,X),k=!kf(R.value.expression)}return{filter:v,dynamicFilter:A||void 0,needGeometry:_2(_),needFeature:!!k}}function ix(u){if(!Array.isArray(u))return u;const s=function(l){if(yD.has(l[0])){for(let p=1;p<l.length;p++)if($f(l[p]))return!0}return l}(u);return s===!0?s:s.map(l=>ix(l))}function Vf(u){let s=!1;const l=[];if(u[0]==="case"){for(let p=1;p<u.length-1;p+=2)s=s||$f(u[p]),l.push(u[p+1]);l.push(u[u.length-1])}else if(u[0]==="match"){s=s||$f(u[1]);for(let p=2;p<u.length-1;p+=2)l.push(u[p+1]);l.push(u[u.length-1])}else if(u[0]==="step"){s=s||$f(u[1]);for(let p=1;p<u.length-1;p+=2)l.push(u[p+1])}s&&(u.length=0,u.push("any",...l));for(let p=1;p<u.length;p++)Vf(u[p])}function $f(u){if(!Array.isArray(u))return!1;if((s=u[0])==="pitch"||s==="distance-from-center")return!0;var s;for(let l=1;l<u.length;l++)if($f(u[l]))return!0;return!1}const yD=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function y2(u,s){return u<s?-1:u>s?1:0}function _2(u){if(!Array.isArray(u))return!1;if(u[0]==="within"||u[0]==="distance")return!0;for(let s=1;s<u.length;
814s++)if(_2(u[s]))return!0;return!1}function zl(u){if(!u)return!0;const s=u[0];return u.length<=1?s!=="any":s==="=="?sw(u[1],u[2],"=="):s==="!="?nx(sw(u[1],u[2],"==")):s==="<"||s===">"||s==="<="||s===">="?sw(u[1],u[2],s):s==="any"?(l=u.slice(1),["any"].concat(l.map(zl))):s==="all"?["all"].concat(u.slice(1).map(zl)):s==="none"?["all"].concat(u.slice(1).map(zl).map(nx)):s==="in"?ow(u[1],u.slice(2)):s==="!in"?nx(ow(u[1],u.slice(2))):s==="has"?v2(u[1]):s!=="!has"||nx(v2(u[1]));var l}function sw(u,s,l){switch(u){case"$type":return[`filter-type-${l}`,s];case"$id":return[`filter-id-${l}`,s];default:return[`filter-${l}`,u,s]}}function ow(u,s){if(s.length===0)return!1;switch(u){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some(l=>typeof l!=typeof s[0])?["filter-in-large",u,["literal",s.sort(y2)]]:["filter-in-small",u,["literal",s]]}}function v2(u){switch(u){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",u]}}function nx(u){return["!",u]}const Ty="�";function fp(u,s){return s?`${u}${Ty}${s}`:u}let x2;const b2=()=>x2||(x2=new bs({"icon-size":new Zt(Ze.layout_symbol["icon-size"]),"icon-image":new Zt(Ze.layout_symbol["icon-image"]),"icon-rotate":new Zt(Ze.layout_symbol["icon-rotate"]),"icon-offset":new Zt(Ze.layout_symbol["icon-offset"])}));class _D{constructor(s,l,p,m,_,v){this.cachedIconPrimary=null;const w=_u(s,Ze.appearance.condition);if(w.result==="success"&&(this.condition=w.value),this.name=l,p){this.properties=new pp(b2()),this.unevaluatedLayout=new nw(b2(),m,_,v);for(const A in p)this.unevaluatedLayout.setValue(A,p[A])}}hasCachedIconPrimary(){return this.cachedIconPrimary!==null}setCachedIconPrimary(s){this.cachedIconPrimary=s}getCachedIconPrimary(){return this.cachedIconPrimary}isActive(s){return!(this.condition||!s.isHidden||this.name!=="hidden")||this.condition.evaluate(s.globals,s.feature,s.featureState,s.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(s){return this.properties.get(s)}getUnevaluatedProperties(){return this.unevaluatedLayout}recalculate(s,l,p){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(s,void 0,l,p))}serialize(){const s={};return s.condition=this.condition.expression.serialize(),this.name&&(s.name=this.name),this.unevaluatedLayout&&(s.properties=this.unevaluatedLayout.serialize()),s}}const w2="-transition",vD=new Set(["fill","line","background","hillshade","raster"]);class _a extends Gu{constructor(s,l,p,m,_,v){if(super(),this.id=s.id,this.fqid=fp(this.id,p),this.type=s.type,this.scope=p,this.lut=m,this.options=_,this.iconImageUseTheme=v,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},s.type!=="custom"){if(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type&&s.type!=="background"&&s.type!=="sky"&&s.type!=="slot"){this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter;const w=_u(this.filter,Ze[`filter_${s.type}`]);w.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...w.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||w.value.isIndoorDependent)}if(s.slot&&(this.slot=s.slot),s.appearances&&this.setAppearances(s.appearances),l.layout&&(this._unevaluatedLayout=new nw(l.layout,this.scope,_,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),l.paint){this._transitionablePaint=new m2(l.paint,this.scope,_);for(const w in s.paint)this.setPaintProperty(w,s.paint[w]);for(const w in s.layout)this.setLayoutProperty(w,s.layout[w]);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 pp(l.paint)}}}onAdd(s){}onRemove(s){}isDraped(s){return!this.is3D(!0)&&vD.has(this.type)}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}
vendor: 18,754 bytes, line 814
814setLayoutProperty(s,l){if(this.type==="custom"&&s==="visibility")return void(this.visibility=l);const p=this._unevaluatedLayout;p._properties.properties[s]&&(p.setValue(s,l),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...p.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||p.isIndoorDependent(),s==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(s){this.appearances=[],s.forEach(l=>{this.appearances.push(new _D(l.condition,l.name,l.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(s){return s.endsWith(w2)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}isPaintProperty(s){return!!this._transitionablePaint._properties.properties[s]}setPaintProperty(s,l){const p=this._transitionablePaint,m=p._properties.properties;if(s.endsWith(w2)){const j=s.slice(0,-11);return m[j]&&p.setTransition(j,l||void 0),!1}if(!m[s])return!1;const _=p._values[s],v=_.value.isDataDriven(),w=_.value;p.setValue(s,l),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...p.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||p.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(s);const A=p._values[s].value,k=A.isDataDriven(),R=s.endsWith("pattern")||s==="line-dasharray";return k||v||R||this._handleOverridablePaintPropertyUpdate(s,w,A)}_handleSpecialPaintPropertyUpdate(s){}getProgramIds(){return null}getDefaultProgramParams(s,l,p){return null}_handleOverridablePaintPropertyUpdate(s,l,p){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,l){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,l,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,l)}serialize(){const s={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&&(s.appearances=this.appearances.map(l=>l.serialize())),Ye(s,(l,p)=>!(l===void 0||p==="layout"&&!Object.keys(l).length||p==="paint"&&!Object.keys(l).length))}is3D(s){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 s in this.paint._values){const l=this.paint.get(s);if(l instanceof wc&&qv(l.property.specification)&&(l.value.kind==="source"||l.value.kind==="composite")&&l.value.isStateDependent)return!0}for(const s of this.appearances)if(!fy(s.condition.expression))return!0;return!1}compileFilter(s){this._filterCompiled||(this._featureFilter=tx(this.filter,this.scope,s),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(s){this._stats&&(s.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(s,l,p){return{}}queryRadius(s){}queryIntersectsFeature(s,l,p,m,_,v,w,A,k){}}const xD={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Cy{constructor(s,l){this._structArray=s,this._pos1=l*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class $r{constructor(){this.capacity=-1,this.resize(0)}static serialize(s,l){return s._trim(),l&&l.add(s.arrayBuffer),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const l=Object.create(this.prototype);return l.arrayBuffer=s.arrayBuffer,l.length=s.length,l.capacity=s.arrayBuffer.byteLength/l.bytesPerElement,l._refreshViews(),l}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const l=this.uint8;this._refreshViews(),l&&this.uint8.set(l)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...s){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...s){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 wn(u,s=1){let l=0,p=0;return{members:u.map(m=>{const _=xD[m.type].BYTES_PER_ELEMENT,v=l=aw(l,Math.max(s,_)),w=m.components||1;return p=Math.max(p,_),l+=_*w,{name:m.name,type:m.type,components:w,offset:v}}),size:aw(l,Math.max(p,s)),alignment:s}}function aw(u,s){return Math.ceil(u/s)*s}class Qa extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l){const p=this.length;return this.resize(p+1),this.emplace(p,s,l)}emplace(s,l,p){const m=2*s;return this.int16[m+0]=l,this.int16[m+1]=p,s}}Qa.prototype.bytesPerElement=4,ri(Qa,"StructArrayLayout2i4");class mp extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p){const m=this.length;return this.resize(m+1),this.emplace(m,s,l,p)}emplace(s,l,p,m){const _=3*s;return this.int16[_+0]=l,this.int16[_+1]=p,this.int16[_+2]=m,s}}mp.prototype.bytesPerElement=6,ri(mp,"StructArrayLayout3i6");class qf extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p,m){const _=this.length;return this.resize(_+1),this.emplace(_,s,l,p,m)}emplace(s,l,p,m,_){const v=4*s;return this.int16[v+0]=l,this.int16[v+1]=p,this.int16[v+2]=m,this.int16[v+3]=_,s}}qf.prototype.bytesPerElement=8,ri(qf,"StructArrayLayout4i8");class ed extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.float32[1*s+0]=l,s}}ed.prototype.bytesPerElement=4,ri(ed,"StructArrayLayout1f4");class lw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p){const m=this.length;return this.resize(m+1),this.emplace(m,s,l,p)}emplace(s,l,p,m){const _=4*s,v=2*s;return this.int16[_+0]=l,this.int16[_+1]=p,this.float32[v+1]=m,s}}lw.prototype.bytesPerElement=8,ri(lw,"StructArrayLayout2i1f8");class cw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p){const m=this.length;return this.resize(m+1),this.emplace(m,s,l,p)}emplace(s,l,p,m){const _=4*s;return this.int16[_+0]=l,this.int16[_+1]=p,this.int16[_+2]=m,s}}cw.prototype.bytesPerElement=8,ri(cw,"StructArrayLayout3i8");class rx extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_){const v=this.length;return this.resize(v+1),this.emplace(v,s,l,p,m,_)}emplace(s,l,p,m,_,v){const w=5*s;return this.int16[w+0]=l,this.int16[w+1]=p,this.int16[w+2]=m,this.int16[w+3]=_,this.int16[w+4]=v,s}}rx.prototype.bytesPerElement=10,ri(rx,"StructArrayLayout5i10");class sx extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w){const A=this.length;return this.resize(A+1),this.emplace(A,s,l,p,m,_,v,w)}emplace(s,l,p,m,_,v,w,A){const k=6*s,R=12*s,j=3*s;return this.int16[k+0]=l,this.int16[k+1]=p,this.uint8[R+4]=m,this.uint8[R+5]=_,this.uint8[R+6]=v,this.uint8[R+7]=w,this.float32[j+2]=A,s}}sx.prototype.bytesPerElement=12,ri(sx,"StructArrayLayout2i4ub1f12");class Ll extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p){const m=this.length;return this.resize(m+1),this.emplace(m,s,l,p)}emplace(s,l,p,m){const _=3*s;return this.float32[_+0]=l,this.float32[_+1]=p,this.float32[_+2]=m,s}}Ll.prototype.bytesPerElement=12,ri(Ll,"StructArrayLayout3f12");class sh extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_){const v=this.length;return this.resize(v+1),this.emplace(v,s,l,p,m,_)}emplace(s,l,p,m,_,v){const w=6*s,A=3*s;return this.uint16[w+0]=l,this.uint16[w+1]=p,this.uint16[w+2]=m,this.uint16[w+3]=_,this.float32[A+2]=v,s}}sh.prototype.bytesPerElement=12,ri(sh,"StructArrayLayout4ui1f12");class gp extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,p,m){const _=this.length;return this.resize(_+1),this.emplace(_,s,l,p,m)}emplace(s,l,p,m,_){const v=4*s;return this.uint16[v+0]=l,this.uint16[v+1]=p,this.uint16[v+2]=m,this.uint16[v+3]=_,s}}gp.prototype.bytesPerElement=8,ri(gp,"StructArrayLayout4ui8");class ox extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v){const w=this.length;return this.resize(w+1),this.emplace(w,s,l,p,m,_,v)}emplace(s,l,p,m,_,v,w){const A=6*s;return this.int16[A+0]=l,this.int16[A+1]=p,this.int16[A+2]=m,this.int16[A+3]=_,this.int16[A+4]=v,this.int16[A+5]=w,s}}ox.prototype.bytesPerElement=12,ri(ox,"StructArrayLayout6i12");class ax extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w,A,k,R,j,z){const U=this.length;return this.resize(U+1),this.emplace(U,s,l,p,m,_,v,w,A,k,R,j,z)}emplace(s,l,p,m,_,v,w,A,k,R,j,z,U){const q=12*s;return this.int16[q+0]=l,this.int16[q+1]=p,this.int16[q+2]=m,this.int16[q+3]=_,this.uint16[q+4]=v,this.uint16[q+5]=w,this.uint16[q+6]=A,this.uint16[q+7]=k,this.int16[q+8]=R,this.int16[q+9]=j,this.int16[q+10]=z,this.int16[q+11]=U,s}}ax.prototype.bytesPerElement=24,ri(ax,"StructArrayLayout4i4ui4i24");class Hf extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v){const w=this.length;return this.resize(w+1),this.emplace(w,s,l,p,m,_,v)}emplace(s,l,p,m,_,v,w){const A=10*s,k=5*s;return this.int16[A+0]=l,this.int16[A+1]=p,this.int16[A+2]=m,this.float32[k+2]=_,this.float32[k+3]=v,this.float32[k+4]=w,s}}Hf.prototype.bytesPerElement=20,ri(Hf,"StructArrayLayout3i3f20");class oh extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m){const _=this.length;return this.resize(_+1),this.emplace(_,s,l,p,m)}emplace(s,l,p,m,_){const v=4*s;return this.float32[v+0]=l,this.float32[v+1]=p,this.float32[v+2]=m,this.float32[v+3]=_,s}}oh.prototype.bytesPerElement=16,ri(oh,"StructArrayLayout4f16");class uw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint32[1*s+0]=l,s}}uw.prototype.bytesPerElement=4,ri(uw,"StructArrayLayout1ul4");class Sc extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l){const p=this.length;return this.resize(p+1),this.emplace(p,s,l)}emplace(s,l,p){const m=2*s;return this.uint16[m+0]=l,this.uint16[m+1]=p,s}}Sc.prototype.bytesPerElement=4,ri(Sc,"StructArrayLayout2ui4");class dw extends $r{_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(s,l,p,m,_,v,w,A,k,R,j,z,U){const q=this.length;return this.resize(q+1),this.emplace(q,s,l,p,m,_,v,w,A,k,R,j,z,U)}emplace(s,l,p,m,_,v,w,A,k,R,j,z,U,q){const X=20*s,Q=10*s;return this.int16[X+0]=l,this.int16[X+1]=p,this.int16[X+2]=m,this.int16[X+3]=_,this.int16[X+4]=v,this.float32[Q+3]=w,this.float32[Q+4]=A,this.float32[Q+5]=k,this.float32[Q+6]=R,this.int16[X+14]=j,this.uint32[Q+8]=z,this.uint16[X+18]=U,this.uint16[X+19]=q,s}}dw.prototype.bytesPerElement=40,ri(dw,"StructArrayLayout5i4f1i1ul2ui40");class lx extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w){const A=this.length;return this.resize(A+1),this.emplace(A,s,l,p,m,_,v,w)}emplace(s,l,p,m,_,v,w,A){const k=8*s;return this.int16[k+0]=l,this.int16[k+1]=p,this.int16[k+2]=m,this.int16[k+4]=_,this.int16[k+5]=v,this.int16[k+6]=w,this.int16[k+7]=A,s}}lx.prototype.bytesPerElement=16,ri(lx,"StructArrayLayout3i2i2i16");class Gf extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_){const v=this.length;return this.resize(v+1),this.emplace(v,s,l,p,m,_)}emplace(s,l,p,m,_,v){const w=4*s,A=8*s;return this.float32[w+0]=l,this.float32[w+1]=p,this.float32[w+2]=m,this.int16[A+6]=_,this.int16[A+7]=v,s}}Gf.prototype.bytesPerElement=16,ri(Gf,"StructArrayLayout2f1f2i16");class Wf extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v){const w=this.length;return this.resize(w+1),this.emplace(w,s,l,p,m,_,v)}emplace(s,l,p,m,_,v,w){const A=20*s,k=5*s;return this.uint8[A+0]=l,this.uint8[A+1]=p,this.float32[k+1]=m,this.float32[k+2]=_,this.float32[k+3]=v,this.float32[k+4]=w,s}}Wf.prototype.bytesPerElement=20,ri(Wf,"StructArrayLayout2ub4f20");class Xr extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,p){const m=this.length;return this.resize(m+1),this.emplace(m,s,l,p)}emplace(s,l,p,m){const _=3*s;return this.uint16[_+0]=l,this.uint16[_+1]=p,this.uint16[_+2]=m,s}}Xr.prototype.bytesPerElement=6,ri(Xr,"StructArrayLayout3ui6");class Kf extends $r{_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(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae){const xe=this.length;return this.resize(xe+1),this.emplace(xe,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae)}emplace(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae,xe){const Me=30*s,Le=15*s,Be=60*s;return this.int16[Me+0]=l,this.int16[Me+1]=p,this.int16[Me+2]=m,this.float32[Le+2]=_,this.float32[Le+3]=v,this.uint16[Me+8]=w,this.uint16[Me+9]=A,this.uint32[Le+5]=k,this.uint32[Le+6]=R,this.uint32[Le+7]=j,this.uint16[Me+16]=z,this.uint16[Me+17]=U,this.uint16[Me+18]=q,this.float32[Le+10]=X,this.float32[Le+11]=Q,this.uint8[Be+48]=ee,this.uint8[Be+49]=oe,this.uint8[Be+50]=le,this.uint32[Le+13]=de,this.int16[Me+28]=Ae,this.uint8[Be+58]=xe,s}}Kf.prototype.bytesPerElement=60,ri(Kf,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class hw extends $r{_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(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae,xe,Me,Le,Be,ut,Xe,ht,_t,bt,zt,Et,vt){const Ct=this.length;return this.resize(Ct+1),this.emplace(Ct,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae,xe,Me,Le,Be,ut,Xe,ht,_t,bt,zt,Et,vt)}emplace(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae,xe,Me,Le,Be,ut,Xe,ht,_t,bt,zt,Et,vt,Ct){const at=20*s,st=40*s,St=80*s;return this.float32[at+0]=l,this.float32[at+1]=p,this.int16[st+4]=m,this.int16[st+5]=_,this.int16[st+6]=v,this.int16[st+7]=w,this.int16[st+8]=A,this.int16[st+9]=k,this.int16[st+10]=R,this.int16[st+11]=j,this.int16[st+12]=z,this.uint16[st+13]=U,this.uint16[st+14]=q,this.uint16[st+15]=X,this.uint16[st+16]=Q,this.uint16[st+17]=ee,this.uint16[st+18]=oe,this.uint16[st+19]=le,this.uint16[st+20]=de,this.uint16[st+21]=Ae,this.uint16[st+22]=xe,this.uint16[st+23]=Me,this.uint16[st+24]=Le,this.uint16[st+25]=Be,this.uint16[st+26]=ut,this.uint16[st+27]=Xe,this.uint32[at+14]=ht,this.float32[at+15]=_t,this.float32[at+16]=bt,this.float32[at+17]=zt,this.float32[at+18]=Et,this.uint8[St+76]=vt,this.uint16[st+39]=Ct,s}}hw.prototype.bytesPerElement=80,ri(hw,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class pw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v){const w=this.length;return this.resize(w+1),this.emplace(w,s,l,p,m,_,v)}emplace(s,l,p,m,_,v,w){const A=6*s;return this.float32[A+0]=l,this.float32[A+1]=p,this.float32[A+2]=m,this.float32[A+3]=_,this.float32[A+4]=v,this.float32[A+5]=w,s}}pw.prototype.bytesPerElement=24,ri(pw,"StructArrayLayout6f24");class yp extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_){const v=this.length;return this.resize(v+1),this.emplace(v,s,l,p,m,_)}emplace(s,l,p,m,_,v){const w=5*s;return this.float32[w+0]=l,this.float32[w+1]=p,this.float32[w+2]=m,this.float32[w+3]=_,this.float3
vendor: 11,467 bytes, line 814
8142[w+4]=v,s}}yp.prototype.bytesPerElement=20,ri(yp,"StructArrayLayout5f20");class fw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w){const A=this.length;return this.resize(A+1),this.emplace(A,s,l,p,m,_,v,w)}emplace(s,l,p,m,_,v,w,A){const k=7*s;return this.float32[k+0]=l,this.float32[k+1]=p,this.float32[k+2]=m,this.float32[k+3]=_,this.float32[k+4]=v,this.float32[k+5]=w,this.float32[k+6]=A,s}}fw.prototype.bytesPerElement=28,ri(fw,"StructArrayLayout7f28");class Ey extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w,A,k,R,j){const z=this.length;return this.resize(z+1),this.emplace(z,s,l,p,m,_,v,w,A,k,R,j)}emplace(s,l,p,m,_,v,w,A,k,R,j,z){const U=11*s;return this.float32[U+0]=l,this.float32[U+1]=p,this.float32[U+2]=m,this.float32[U+3]=_,this.float32[U+4]=v,this.float32[U+5]=w,this.float32[U+6]=A,this.float32[U+7]=k,this.float32[U+8]=R,this.float32[U+9]=j,this.float32[U+10]=z,s}}Ey.prototype.bytesPerElement=44,ri(Ey,"StructArrayLayout11f44");class mw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w,A,k){const R=this.length;return this.resize(R+1),this.emplace(R,s,l,p,m,_,v,w,A,k)}emplace(s,l,p,m,_,v,w,A,k,R){const j=9*s;return this.float32[j+0]=l,this.float32[j+1]=p,this.float32[j+2]=m,this.float32[j+3]=_,this.float32[j+4]=v,this.float32[j+5]=w,this.float32[j+6]=A,this.float32[j+7]=k,this.float32[j+8]=R,s}}mw.prototype.bytesPerElement=36,ri(mw,"StructArrayLayout9f36");class ah extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l){const p=this.length;return this.resize(p+1),this.emplace(p,s,l)}emplace(s,l,p){const m=2*s;return this.float32[m+0]=l,this.float32[m+1]=p,s}}ah.prototype.bytesPerElement=8,ri(ah,"StructArrayLayout2f8");class gw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,p,m){const _=this.length;return this.resize(_+1),this.emplace(_,s,l,p,m)}emplace(s,l,p,m,_){const v=6*s;return this.uint32[3*s+0]=l,this.uint16[v+2]=p,this.uint16[v+3]=m,this.uint16[v+4]=_,s}}gw.prototype.bytesPerElement=12,ri(gw,"StructArrayLayout1ul3ui12");class cx extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint16[1*s+0]=l,s}}cx.prototype.bytesPerElement=2,ri(cx,"StructArrayLayout1ui2");class ux extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q){const ee=this.length;return this.resize(ee+1),this.emplace(ee,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q)}emplace(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee){const oe=16*s;return this.float32[oe+0]=l,this.float32[oe+1]=p,this.float32[oe+2]=m,this.float32[oe+3]=_,this.float32[oe+4]=v,this.float32[oe+5]=w,this.float32[oe+6]=A,this.float32[oe+7]=k,this.float32[oe+8]=R,this.float32[oe+9]=j,this.float32[oe+10]=z,this.float32[oe+11]=U,this.float32[oe+12]=q,this.float32[oe+13]=X,this.float32[oe+14]=Q,this.float32[oe+15]=ee,s}}ux.prototype.bytesPerElement=64,ri(ux,"StructArrayLayout16f64");class Zf extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,p,m,_,v,w){const A=this.length;return this.resize(A+1),this.emplace(A,s,l,p,m,_,v,w)}emplace(s,l,p,m,_,v,w,A){const k=10*s,R=5*s;return this.uint16[k+0]=l,this.uint16[k+1]=p,this.uint16[k+2]=m,this.uint16[k+3]=_,this.float32[R+2]=v,this.float32[R+3]=w,this.float32[R+4]=A,s}}Zf.prototype.bytesPerElement=20,ri(Zf,"StructArrayLayout4ui3f20");class yw extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s){const l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.int16[1*s+0]=l,s}}yw.prototype.bytesPerElement=2,ri(yw,"StructArrayLayout1i2");class dx extends $r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(s){const l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint8[1*s+0]=l,s}}dx.prototype.bytesPerElement=1,ri(dx,"StructArrayLayout1ub1");class _w extends Cy{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]}}_w.prototype.size=40;class S2 extends dw{get(s){return new _w(this,s)}}ri(S2,"CollisionBoxArray");class hx extends Cy{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(s){this._structArray.uint8[this._pos1+49]=s}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(s){this._structArray.uint8[this._pos1+50]=s}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(s){this._structArray.uint32[this._pos4+13]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(s){this._structArray.uint8[this._pos1+58]=s}}hx.prototype.size=60;class Ay extends Kf{get(s){return new hx(this,s)}}ri(Ay,"PlacedSymbolArray");class vw extends Cy{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(s){this._structArray.uint32[this._pos4+14]=s}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(s){this._structArray.float32[this._pos4+18]=s}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}vw.prototype.size=80;class T2 extends hw{get(s){return new vw(this,s)}}ri(T2,"SymbolInstanceArray");class xw extends ed{getoffsetX(s){return this.float32[1*s+0]}}ri(xw,"GlyphOffsetArray");class C2 extends Qa{getx(s){return this.int16[2*s+0]}gety(s){return this.int16[2*s+1]}}ri(C2,"SymbolLineVertexArray");class px extends Cy{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]}}px.prototype.size=12;class E2 extends gw{get(s){return new px(this,s)}}ri(E2,"FeatureIndexArray");class A2 extends Sc{geta_centroid_pos0(s){return this.uint16[2*s+0]}geta_centroid_pos1(s){return this.uint16[2*s+1]}}ri(A2,"FillExtrusionCentroidArray");class I2 extends Cy{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]}}I2.prototype.size=6;class k2 extends mp{get(s){return new I2(this,s)}}ri(k2,"FillExtrusionWallArray");const P2=wn([{name:"a_pos",components:2,type:"Int16"}],4),bD=wn([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),wD=wn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class ls{constructor(s=[]){this.segments=s}_prepareSegment(s,l,p,m){let _=this.segments[this.segments.length-1];return s>ls.MAX_VERTEX_ARRAY_LENGTH&&di(`Max vertices per segment is ${ls.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}
814`),(!_||_.vertexLength+s>ls.MAX_VERTEX_ARRAY_LENGTH||_.sortKey!==m)&&(_={vertexOffset:l,primitiveOffset:p,vertexLength:0,primitiveLength:0},m!==void 0&&(_.sortKey=m),this.segments.push(_)),_}prepareSegment(s,l,p,m){return this._prepareSegment(s,l.length,p.length,m)}get(){return this.segments}destroy(){for(const s of this.segments)for(const l in s.vaos)s.vaos[l].destroy()}static simpleSegment(s,l,p,m){return new ls([{vertexOffset:s,primitiveOffset:l,vertexLength:p,primitiveLength:m,vaos:{},sortKey:0}])}}function N2(u,s){return 256*(u=re(Math.floor(u),0,255))+re(Math.floor(s),0,255)}ls.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ri(ls,"SegmentVector");const SD=wn([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),TD=wn([{name:"a_pattern_b",components:4,type:"Uint16"}]),CD=wn([{name:"a_dash",components:4,type:"Uint16"}]);class Iy{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(s,l,p,m){this.ids.push(ky(s)),this.positions.push(l,p,m)}eachPosition(s,l){const p=ky(s);let m=0,_=this.ids.length-1;for(;m<_;){const v=m+_>>1;this.ids[v]>=p?_=v:m=v+1}for(;this.ids[m]===p;)l(this.positions[3*m],this.positions[3*m+1],this.positions[3*m+2]),m++}static serialize(s,l){const p=new Float64Array(s.ids),m=new Uint32Array(s.positions);return bw(p,m,0,p.length-1),l&&(l.add(p.buffer),l.add(m.buffer)),{ids:p,positions:m}}static deserialize(s){const l=new Iy;let p;l.ids=s.ids,l.positions=s.positions;for(const m of l.ids)m!==p&&l.uniqueIds.push(m),p=m;return l.indexed=!0,l}}function ky(u){const s=+u;return Number.isSafeInteger(s)?s:Jg(String(u))}function bw(u,s,l,p){for(;l<p;){const m=u[l+p>>1];let _=l-1,v=p+1;for(;;){do _++;while(u[_]<m);do v--;while(u[v]>m);if(_>=v)break;fx(u,_,v),fx(s,3*_,3*v),fx(s,3*_+1,3*v+1),fx(s,3*_+2,3*v+2)}v-l<p-v?(bw(u,s,l,v),l=v+1):(bw(u,s,v+1,p),p=v)}}function fx(u,s,l){const p=u[s];u[s]=u[l],u[l]=p}ri(Iy,"FeaturePositionMap");class Tc{constructor(s){this.gl=s.gl,this.initialized=!1}fetchUniformLocation(s,l){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(s,l),this.initialized=!0),!!this.location}set(s,l,p){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class mx extends Tc{constructor(s){super(s),this.current=0}set(s,l,p){this.fetchUniformLocation(s,l)&&this.current!==p&&(this.current=p,this.gl.uniform1i(this.location,p))}}class Fs extends Tc{constructor(s){super(s),this.current=0}set(s,l,p){this.fetchUniformLocation(s,l)&&this.current!==p&&(this.current=p,this.gl.uniform1f(this.location,p))}}class vu extends Tc{constructor(s){super(s),this.current=[0,0]}set(s,l,p){this.fetchUniformLocation(s,l)&&(p[0]===this.current[0]&&p[1]===this.current[1]||(this.current=p,this.gl.uniform2f(this.location,p[0],p[1])))}}class Xf extends Tc{constructor(s){super(s),this.current=[0,0,0]}set(s,l,p){this.fetchUniformLocation(s,l)&&(p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]||(this.current=p,this.gl.uniform3f(this.location,p[0],p[1],p[2])))}}class Py extends Tc{constructor(s){super(s),this.current=[0,0,0,0]}set(s,l,p){this.fetchUniformLocation(s,l)&&(p[0]===this.current[0]&&p[1]===this.current[1]&&p[2]===this.current[2]&&p[3]===this.current[3]||(this.current=p,this.gl.uniform4f(this.location,p[0],p[1],p[2],p[3])))}}class ww extends Tc{constructor(s){super(s),this.current=lr.transparent.toPremultipliedRenderColor(null)}set(s,l,p){this.fetchUniformLocation(s,l)&&(p.r===this.current.r&&p.g===this.current.g&&p.b===this.current.b&&p.a===this.current.a||(this.current=p,this.gl.uniform4f(this.location,p.r,p.g,p.b,p.a)))}}const M2=new Float32Array(16);class Ny extends Tc{constructor(s){super(s),this.current=M2}set(s,l,p){if(this.fetchUniformLocation(s,l)){if(p[12]!==this.current[12]||p[0]!==this.current[0])return this.current=p,void this.gl.uniformMatrix4fv(this.location,!1,p);for(let m=1;m<16;m++)if(p[m]!==this.current[m]){this.current=p,this.gl.uniformMatrix4fv(this.location,!1,p);break}}}}const ED=new Float32Array(9),D2=new Float32Array(4);class Sw extends Tc{constructor(s){super(s),this.current=D2}set(s,l,p){if(this.fetchUniformLocation(s,l)){for(let m=0;m<4;m++)if(p[m]!==this.current[m]){this.current=p,this.gl.uniformMatrix2fv(this.location,!1,p);break}}}}function Tw(u){return[N2(255*u.r,255*u.g),N2(255*u.b,255*u.a)]}function gx(u,s,l,p,m,_,v,w){return!!u&&(u.kind==="composite"||u.kind==="source"?u.evaluate(new Rr(0,{brightness:_,worldview:w}),s,l,m,p,v)==="none":u.value==="none")}class yx{constructor(s,l,p,m){this.value=s,this.uniformNames=l.map(_=>`u_${_}`),this.type=p,this.context=m}setUniform(s,l,p,m,_){const v=m.constantOr(this.value);l.set(s,_,v instanceof lr?v.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):v)}getBinding(s,l){return this.type==="color"?new ww(s):new Fs(s)}}class My{constructor(s,l){this.uniformNames=l.map(p=>`u_${p}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(s,l){this.pixelRatio=s.pixelRatio||1,this.pattern=s.tl.concat(s.br),this.patternTransition=l?l.tl.concat(l.br):this.pattern}setUniform(s,l,p,m,_){let v=null;_!=="u_pattern"&&_!=="u_dash"||(v=this.pattern),_==="u_pattern_b"&&(v=this.patternTransition),_==="u_pixel_ratio"&&(v=this.pixelRatio),v&&l.set(s,_,v)}getBinding(s,l){return l==="u_pattern"||l==="u_pattern_b"||l==="u_dash"?new Py(s):new Fs(s)}}class td{constructor(s,l,p,m){this.expression=s,this.type=p,this.maxValue=0,this.paintVertexAttributes=l.map(_=>({name:`a_${_}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(s,l,p,m,_,v,w,A){const k=this.paintVertexArray.length,R=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Rr(0,{brightness:v,worldview:A}),l,{},_,m,w):this.expression.kind==="constant"&&this.expression.value,
vendor: 9,665 bytes, line 814
814j=gx(this.lutExpression,l,{},m,_,v,w,A);this.paintVertexArray.resize(s),this._setPaintValue(k,s,R,j?null:this.context.lut)}updatePaintArray(s,l,p,m,_,v,w,A){const k=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:w,worldview:A},p,m,void 0,_):this.expression.kind==="constant"&&this.expression.value,R=gx(this.lutExpression,p,m,_,void 0,w,void 0,A);this._setPaintValue(s,l,k,R?null:this.context.lut)}_setPaintValue(s,l,p,m){if(this.type==="color"){const _=Tw(p.toPremultipliedRenderColor(m));for(let v=s;v<l;v++)this.paintVertexArray.emplace(v,_[0],_[1])}else{for(let _=s;_<l;_++)this.paintVertexArray.emplace(_,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.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 Hc{constructor(s,l,p,m,_,v){this.expression=s,this.uniformNames=l.map(w=>`u_${w}_t`),this.type=p,this.useIntegerZoom=m,this.context=_,this.maxValue=0,this.paintVertexAttributes=l.map(w=>({name:`a_${w}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new v}populatePaintArray(s,l,p,m,_,v,w,A){const k=this.expression.evaluate(new Rr(this.context.zoom,{brightness:v,worldview:A}),l,{},_,m,w),R=this.expression.evaluate(new Rr(this.context.zoom+1,{brightness:v,worldview:A}),l,{},_,m,w),j=gx(this.lutExpression,l,{},m,_,v,w,A),z=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(z,s,k,R,j?null:this.context.lut)}updatePaintArray(s,l,p,m,_,v,w,A){const k=this.expression.evaluate({zoom:this.context.zoom,brightness:w,worldview:A},p,m,void 0,_),R=this.expression.evaluate({zoom:this.context.zoom+1,brightness:w,worldview:A},p,m,void 0,_),j=gx(this.lutExpression,p,m,_,void 0,w,void 0,A);this._setPaintValue(s,l,k,R,j?null:this.context.lut)}_setPaintValue(s,l,p,m,_){if(this.type==="color"){const v=Tw(p.toPremultipliedRenderColor(_)),w=Tw(p.toPremultipliedRenderColor(_));for(let A=s;A<l;A++)this.paintVertexArray.emplace(A,v[0],v[1],w[0],w[1])}else{for(let v=s;v<l;v++)this.paintVertexArray.emplace(v,p,m);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(m))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,l,p,m,_){const v=this.useIntegerZoom?Math.floor(p.zoom):p.zoom,w=re(this.expression.interpolationFactor(v,this.context.zoom,this.context.zoom+1),0,1);l.set(s,_,w)}getBinding(s,l){return new Fs(s)}}class ra{constructor(s,l,p,m,_){this.expression=s,this.layerId=_,this.paintVertexAttributes=(p==="array"?CD:SD).members;for(let v=0;v<l.length;++v);this.paintVertexArray=new m,this.paintTransitionVertexArray=new gp}populatePaintArray(s,l,p,m){const _=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValues(_,s,l.patterns&&l.patterns[this.layerId],p)}updatePaintArray(s,l,p,m,_,v,w){this._setPaintValues(s,l,p.patterns&&p.patterns[this.layerId],v)}_setPaintValues(s,l,p,m){if(!m||!p)return;const _=m[p[0]],v=m[p[1]];if(_){if(_){const{tl:w,br:A,pixelRatio:k}=_;for(let R=s;R<l;R++)this.paintVertexArray.emplace(R,w[0],w[1],A[0],A[1],k)}if(v){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:w,br:A}=v;for(let k=s;k<l;k++)this.paintTransitionVertexArray.emplace(k,w[0],w[1],A[0],A[1])}}}upload(s){const l=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,l)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=s.createVertexBuffer(this.paintTransitionVertexArray,TD.members,l))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class id{constructor(s,l,p=()=>!0){this.binders={},this._buffers=[],this.context=l;const m=[];for(const _ in s.paint._values){const v=s.paint.get(_);if(_.endsWith("-use-theme")||!p(_)||!(v instanceof wc&&qv(v.property.specification)))continue;const w=ID(_,s.type),A=v.value,k=v.property.specification.type,R=!!v.property.useIntegerZoom,j=_==="line-dasharray"||_.endsWith("pattern"),z=s.paint.get(`${_}-use-theme`),U=_==="line-dasharray"&&s.layout.get("line-cap").value.kind!=="constant"||z&&z.value.kind!=="constant";if(A.kind!=="constant"||U)if(A.kind==="source"||U||j){const q=Cw(_,k,"source");this.binders[_]=j?new ra(A,w,k,q,s.id):new td(A,w,k,q),m.push(`/a_${_}`)}else{const q=Cw(_,k,"composite");this.binders[_]=new Hc(A,w,k,R,l,q),m.push(`/z_${_}`)}else this.binders[_]=j?new My(A.value,w):new yx(A.value,w,k,l),m.push(`/u_${_}`);z&&(this.binders[_].lutExpression=z.value)}this.cacheKey=m.sort().join("")}getMaxValue(s){const l=this.binders[s];return l instanceof td||l instanceof Hc?l.maxValue:0}populatePaintArrays(s,l,p,m,_,v,w,A){for(const k in this.binders){const R=this.binders[k];R.context=this.context,(R instanceof td||R instanceof Hc||R instanceof ra)&&R.populatePaintArray(s,l,p,m,_,v,w,A)}}setConstantPatternPositions(s,l){for(const p in this.binders){const m=this.binders[p];m instanceof My&&m.setConstantPatternPositions(s,l)}}getPatternTransitionVertexBuffer(s){const l=this.binders[s];return l instanceof ra?l.paintTransitionVertexBuffer:null}updatePaintArrays(s,l,p,m,_,v,w,A,k,R){let j=!1;const z=Object.keys(s),U=z.length!==0&&!A,q=U?z:l.uniqueIds;this.context.lut=_.lut;for(const X in this.binders){const Q=this.binders[X];if(Q.context=this.context,(Q instanceof td||Q instanceof Hc||Q instanceof ra)&&Q.expression&&Q.expression.kind&&Q.expression.kind!=="constant"&&(Q.expression.isStateDependent===!0||Q.expression.isLightConstant===!1)){const ee=_.paint.get(X);Q.expression=ee.value;for(const oe of q){const le=s[oe.toString()];l.eachPosition(oe,(de,Ae,xe)=>{const Me=m.feature(de);Q.updatePaintArray(Ae,xe,Me,le,v,w,k,R)})}if(!U)for(const oe of p.uniqueIds){const le=s[oe.toString()];p.eachPosition(oe,(de,Ae,xe)=>{const Me=m.feature(de);Q.updatePaintArray(Ae,xe,Me,le,v,w,k,R)})}j=!0}}return j}defines(){const s=[];for(const l in this.binders){const p=this.binders[l];(p instanceof yx||p instanceof My)&&s.push(...p.uniformNames.map(m=>`#define HAS_UNIFORM_${m}`))}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s){const l=[];for(const p in this.binders){const m=this.binders[p];if(m instanceof yx||m instanceof My||m instanceof Hc)for(const _ of m.uniformNames)l.push({name:_,property:p,binding:m.getBinding(s,_)})}return l}setUniforms(s,l,p,m,_){for(const{name:v,property:w,binding:A}of p)this.binders[w].setUniform(s,A,_,m.get(w),v)}updatePaintBuffers(){this._buffers=[];for(const s in this.binders){const l=this.binders[s];(l instanceof td||l instanceof Hc||l instanceof ra)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer),l instanceof ra&&l.paintTransitionVertexBuffer&&this._buffers.push(l.paintTransitionVertexBuffer)}}upload(s){for(const l in this.binders){const p=this.binders[l];(p instanceof td||p instanceof Hc||p instanceof ra)&&p.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const l=this.binders[s];(l instanceof td||l instanceof Hc||l instanceof ra)&&l.destroy()}}}class Gc{constructor(s,l,p=()=>!0){this.programConfigurations={};for(const m of s)this.programConfigurations[m.id]=new id(m,l,p);this.needsUpload=!1,this._featureMap=new Iy,this._featureMapWithoutIds=new Iy,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(s,l,p,m,_,v,w,A,k){for(const R in this.programConfigurations)this.programConfigurations[R].populatePaintArrays(s,l,m,_,v,w,A,k);l.id!==void 0?this._featureMap.add(l.id,p,this._bufferOffset,s):(this._featureMapWithoutIds.add(this._idlessCounter,p,this._bufferOffset,s),this._idlessCounter+=1),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,l,p,m,_,v,w,A){for(const k of p)this.needsUpload=this.programConfigurations[k.id].updatePaintArrays(s,this._featureMap,this._featureMapWithoutIds,l,k,m,_,v,w||0,A)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const l in this.programConfigurations)this.programConfigurations[l].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}const AD={"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":["ga
814pwidth"],"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 ID(u,s){return AD[u]||[u.replace(`${s}-`,"").replace(/-/g,"_")]}const kD={"line-pattern":{source:sh,composite:sh},"fill-pattern":{source:sh,composite:sh},"fill-extrusion-pattern":{source:sh,composite:sh},"line-dasharray":{source:gp,composite:gp}},PD={color:{source:ah,composite:oh},number:{source:ed,composite:ah}};function Cw(u,s,l){const p=kD[u];return p&&p[l]||PD[s][l]}ri(yx,"ConstantBinder"),ri(My,"PatternConstantBinder"),ri(td,"SourceExpressionBinder"),ri(ra,"PatternCompositeBinder"),ri(Hc,"CompositeExpressionBinder"),ri(id,"ProgramConfiguration",{omit:["_buffers"]}),ri(Gc,"ProgramConfigurationSet");const Ja=Ft/Math.PI/2,g=5,a=6,h=16383,y=64,b=[y,32,16],T=-Ja,E=Ja;function P(u,s,l,p=Ja){return l=Pn(l),[u*Math.sin(l)*p,-s*p,u*Math.cos(l)*p]}function M(u,s,l){return P(Math.cos(Pn(u)),Math.sin(Pn(u)),s,l)}const L=63710088e-1,O=2*Math.PI*L;class H{constructor(s,l){if(isNaN(s)||isNaN(l))throw new Error(`Invalid LngLat object: (${s}, ${l})`);if(this.lng=+s,this.lat=+l,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new H(ze(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const l=Math.PI/180,p=this.lat*l,m=s.lat*l,_=Math.sin(p)*Math.sin(m)+Math.cos(p)*Math.cos(m)*Math.cos((s.lng-this.lng)*l);return L*Math.acos(Math.min(_,1))}toBounds(s=0){const l=360*s/40075017,p=l/Math.cos(Math.PI/180*this.lat);return new F({lng:this.lng-p,lat:this.lat-l},{lng:this.lng+p,lat:this.lat+l})}toEcef(s){return M(this.lat,this.lng,Ja+s*Ja/L)}static convert(s){if(s instanceof H)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new H(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new H(Number("lng"in s?s.lng:s.lon),Number(s.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 F{constructor(s,l){s&&(l?this.setSouthWest(s).setNorthEast(l):Array.isArray(s)&&s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1]))}setNorthEast(s){return this._ne=s instanceof H?new H(s.lng,s.lat):H.convert(s),this}setSouthWest(s){return this._sw=s instanceof H?new H(s.lng,s.lat):H.convert(s),this}extend(s){const l=this._sw,p=this._ne;let m,_;if(s instanceof H)m=s,_=s;else{if(!(s instanceof F))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(F.convert(s)):this.extend(H.convert(s)):typeof s=="object"&&s!==null&&s.hasOwnProperty("lat")&&(s.hasOwnProperty("lon")||s.hasOwnProperty("lng"))?this.extend(H.convert(s)):this;if(m=s._sw,_=s._ne,!m||!_)return this}return l||p?(l.lng=Math.min(m.lng,l.lng),l.lat=Math.min(m.lat,l.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new H(m.lng,m.lat),this._ne=new H(_.lng,_.lat)),this}getCenter(){return new H((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 H(this.getWest(),this.getNorth())}getSouthEast(){return new H(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(s){const{lng:l,lat:p}=H.convert(s);let m=this._sw.lng<=l&&l<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=l&&l>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(s){if(s)return s instanceof F?s:new F(s)}}const Z=0,Y=25.5;function J(u){return O*Math.cos(u*Math.PI/180)}function se(u){return(180+u)/360}function ne(u){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+u*Math.PI/360)))/360}function ae(u,s){return u/J(s)}function fe(u){return 360*u-180}function ue(u){return 360/Math.PI*Math.atan(Math.exp((180-360*u)*Math.PI/180)
vendor: 30,441 bytes, line 814
814)-90}function Ce(u,s){return u*J(ue(s))}const me=85.051129;function Ie(u){return Math.cos(Pn(re(u,-me,me)))}function Se(u,s){const l=re(s,Z,Y),p=Math.pow(2,l);return Ie(u)*O/(512*p)}function ve(u){return 1/Math.cos(u*Math.PI/180)}function ke(u,s=0){const l=Math.exp(Math.PI*(1-(u.y+s/Ft)/(1<<u.z)*2));return 80150034*l/(l*l+1)/Ft/(1<<u.z)}class Ke{constructor(s,l,p=0){this.x=+s,this.y=+l,this.z=+p}static fromLngLat(s,l=0){const p=H.convert(s);return new Ke(se(p.lng),ne(p.lat),ae(l,p.lat))}toLngLat(){return new H(fe(this.x),ue(this.y))}toAltitude(){return Ce(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/O*ve(ue(this.y))}}function $e(u,s,l,p,m,_,v,w,A){const k=(s+p)/2,R=(l+m)/2,j=new Tt(k,R);w(j),function(z,U,q,X,Q,ee){const oe=q-Q,le=X-ee;return Math.abs((X-U)*oe-(q-z)*le)/Math.hypot(oe,le)}(j.x,j.y,_.x,_.y,v.x,v.y)>=A?($e(u,s,l,k,R,_,j,w,A),$e(u,k,R,p,m,j,v,w,A)):u.push(v)}function ct(u,s,l){let p=u[0],m=p.x,_=p.y;s(p);const v=[p];for(let w=1;w<u.length;w++){const A=u[w],{x:k,y:R}=A;s(A),$e(v,m,_,k,R,p,A,s,l),m=k,_=R,p=A}return v}function it(u,s,l,p){if(p(s,l)){const m=s.add(l)._mult(.5);it(u,s,m,p),it(u,m,l,p)}else u.push(l)}function gt(u,s){let l=u[0];const p=[l];for(let m=1;m<u.length;m++){const _=u[m];it(p,l,_,s),l=_}return p}const jt=Math.pow(2,14)-1,et=-jt-1;function Oe(u,s){const l=Math.round(u.x*s),p=Math.round(u.y*s);return u.x=re(l,et,jt),u.y=re(p,et,jt),(l<u.x||l>u.x+1||p<u.y||p>u.y+1)&&di("Geometry exceeds allowed extent, reduce your vector tile buffer size"),u}function yt(u,s,l){const p=u.loadGeometry(),m=u.extent,_=Ft/m;if(s&&l&&l.projection.isReprojectedInTileSpace){const v=1<<s.z,{scale:w,x:A,y:k,projection:R}=l,j=z=>{const U=fe((s.x+z.x/m)/v),q=ue((s.y+z.y/m)/v),X=R.project(U,q);z.x=(X.x*w-A)*m,z.y=(X.y*w-k)*m};for(let z=0;z<p.length;z++)if(u.type!==1)p[z]=ct(p[z],j,1);else{const U=[];for(const q of p[z])q.x<0||q.x>=m||q.y<0||q.y>=m||(j(q),U.push(q));p[z]=U}}for(const v of p)for(const w of v)Oe(w,_);return p}function nt(u,s){return{type:u.type,id:u.id,properties:u.properties,geometry:s?yt(u):[]}}class wt{constructor(s,l,p,m,_){this.properties={},this.extent=p,this.type=0,this.id=void 0,this._pbf=s,this._geometry=-1,this._keys=m,this._values=_,s.readFields(Bt,this,l)}loadGeometry(){const s=this._pbf;s.pos=this._geometry;const l=s.readVarint()+s.pos,p=[];let m,_=1,v=0,w=0,A=0;for(;s.pos<l;){if(v<=0){const k=s.readVarint();_=7&k,v=k>>3}if(v--,_===1||_===2)w+=s.readSVarint(),A+=s.readSVarint(),_===1&&(m&&p.push(m),m=[]),m&&m.push(new Tt(w,A));else{if(_!==7)throw new Error(`unknown command ${_}`);m&&m.push(m[0].clone())}}return m&&p.push(m),p}bbox(){const s=this._pbf;s.pos=this._geometry;const l=s.readVarint()+s.pos;let p=1,m=0,_=0,v=0,w=1/0,A=-1/0,k=1/0,R=-1/0;for(;s.pos<l;){if(m<=0){const j=s.readVarint();p=7&j,m=j>>3}if(m--,p===1||p===2)_+=s.readSVarint(),v+=s.readSVarint(),_<w&&(w=_),_>A&&(A=_),v<k&&(k=v),v>R&&(R=v);else if(p!==7)throw new Error(`unknown command ${p}`)}return[w,k,A,R]}toGeoJSON(s,l,p){const m=this.extent*Math.pow(2,p),_=this.extent*s,v=this.extent*l,w=this.loadGeometry();function A(z){return[360*(z.x+_)/m-180,360/Math.PI*Math.atan(Math.exp((1-2*(z.y+v)/m)*Math.PI))-90]}function k(z){return z.map(A)}let R;if(this.type===1){const z=[];for(const q of w)z.push(q[0]);const U=k(z);R=z.length===1?{type:"Point",coordinates:U[0]}:{type:"MultiPoint",coordinates:U}}else if(this.type===2){const z=w.map(k);R=z.length===1?{type:"LineString",coordinates:z[0]}:{type:"MultiLineString",coordinates:z}}else{if(this.type!==3)throw new Error("unknown feature type");{const z=function(q){const X=q.length;if(X<=1)return[q];const Q=[];let ee,oe;for(let le=0;le<X;le++){const de=oi(q[le]);de!==0&&(oe===void 0&&(oe=de<0),oe===de<0?(ee&&Q.push(ee),ee=[q[le]]):ee&&ee.push(q[le]))}return ee&&Q.push(ee),Q}(w),U=[];for(const q of z)U.push(q.map(k));R=U.length===1?{type:"Polygon",coordinates:U[0]}:{type:"MultiPolygon",coordinates:U}}}const j={type:"Feature",geometry:R,properties:this.properties};return this.id!=null&&(j.id=this.id),j}}function Bt(u,s,l){u===1?s.id=l.readVarint():u===2?function(p,m){const _=p.readVarint()+p.pos;for(;p.pos<_;){const v=m._keys[p.readVarint()],w=m._values[p.readVarint()];m.properties[v]=w}}(l,s):u===3?s.type=l.readVarint():u===4&&(s._geometry=l.pos)}function oi(u){let s=0;for(let l,p,m=0,_=u.length,v=_-1;m<_;v=m++)l=u[m],p=u[v],s+=(p.x-l.x)*(l.y+p.y);return s}wt.types=["Unknown","Point","LineString","Polygon"];class Mt{constructor(s,l){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=s,this._keys=[],this._values=[],this._features=[],s.readFields(Lt,this,l),this.length=this._features.length}feature(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];const l=this._pbf.readVarint()+this._pbf.pos;return new wt(this._pbf,l,this.extent,this._keys,this._values)}}function Lt(u,s,l){u===15?s.version=l.readVarint():u===1?s.name=l.readString():u===5?s.extent=l.readVarint():u===2?s._features.push(l.pos):u===3?s._keys.push(l.readString()):u===4&&s._values.push(function(p){let m=null;const _=p.readVarint()+p.pos;for(;p.pos<_;){const v=p.readVarint()>>3;m=v===1?p.readString():v===2?p.readFloat():v===3?p.readDouble():v===4?p.readVarint64():v===5?p.readVarint():v===6?p.readSVarint():v===7?p.readBoolean():null}if(m==null)throw new Error("unknown feature value");return m}(l))}class li{constructor(s,l){this.layers=s.readFields(ti,{},l)}}function ti(u,s,l){if(u===3){const p=new Mt(l,l.readVarint()+l.pos);p.length&&(s[p.name]=p)}}const Yt="3d_elevation_id",ii="level";class ji{constructor(){this._valid=!1}reset(s){return this.feature=s,this._valid=!0,this._geometry=s.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(s,l){return this._valid&&s(l(this._geometry)),this}require(s,l,p){return this.get(s,!0,l,p)}optional(s,l,p){return this.get(s,!1,l,p)}success(){return this._valid}get(s,l,p,m){const _=this.feature.properties.hasOwnProperty(s)?+this.feature.properties[s]:void 0;return this._valid&&_!==void 0&&!Number.isNaN(_)?p(m?m(_):_):l&&(this._valid=!1),this}}class Sn{constructor(s,l){this.featureFunc=s,this.vertexFunc=l}parseFeature(s,l,p){return this.featureFunc(s,l,p)}parseVertex(s,l,p){return this.vertexFunc(s,l,p)}}const zn=new Sn((u,s,l)=>u.reset(s).require(Yt,p=>{l.id=p}).optional("fixed_height_relative",p=>{l.constantHeight=p},qi.decodeRelativeHeight).geometry(p=>{l.bounds=p},uy).success(),(u,s,l)=>u.reset(s).require(Yt,p=>{l.id=p}).require("elevation_idx",p=>{l.idx=p}).require("extent",p=>{l.extent=p}).require("height_relative",p=>{l.height=p},qi.decodeRelativeHeight).geometry(p=>{l.position=p},qi.getPoint).success()),vr=new Sn((u,s,l)=>u.reset(s).require(Yt,p=>{l.id=p}).optional("fixed_height",p=>{l.constantHeight=p},qi.decodeMetricHeight).geometry(p=>{l.bounds=p},uy).success(),(u,s,l)=>u.reset(s).require(Yt,p=>{l.id=p}).require("elevation_idx",p=>{l.idx=p}).require("extent",p=>{l.extent=p}).require("height",p=>{l.height=p},qi.decodeMetricHeight).geometry(p=>{l.position=p},qi.getPoint).success());class qi{static getPoint(s){return co(s[0][0].x,s[0][0].y)}static decodeRelativeHeight(s){return 1e-4*s*5}static decodeMetricHeight(s){return 1e-4*s}static getVersionSchema(s){return s?s==="1.0.1"?vr:void 0:zn}static parse(s){const l=[],p=[],m=s.length,_=new ji;for(let v=0;v<m;v++){const w=s.feature(v),A=w.properties.version,k=qi.getVersionSchema(A);if(k===void 0){di(`Unknown elevation feature version number ${A||"(unknown)"}`);continue}const R=w.properties.type;if(!R)continue;const j=wt.types[w.type];if(j==="Point"&&R==="curve_point"){const z={};k.parseVertex(_,w,z)&&l.push(z)}else if(j==="Polygon"&&R==="curve_meta"){const z={};k.parseFeature(_,w,z)&&p.push(z)}}return{vertices:l,features:p}}}class Dn{constructor(s,l){this.pos=s,this.dir=l}intersectsPlane(s,l,p){const m=na(l,this.dir);if(Math.abs(m)<1e-6)return!1;const _=((s[0]-this.pos[0])*l[0]+(s[1]-this.pos[1])*l[1])/m;return p[0]=this.pos[0]+this.dir[0]*_,p[1]=this.pos[1]+this.dir[1]*_,!0}}class dn{constructor(s,l){this.pos=s,this.dir=l}intersectsPlane(s,l,p){const m=Ai(l,this.dir);if(Math.abs(m)<1e-6)return!1;const _=((s[0]-this.pos[0])*l[0]+(s[1]-this.pos[1])*l[1]+(s[2]-this.pos[2])*l[2])/m;return p[0]=this.pos[0]+this.dir[0]*_,p[1]=this.pos[1]+this.dir[1]*_,p[2]=this.pos[2]+this.dir[2]*_,!0}closestPointOnSphere(s,l,p){if(function(U,q){var X=U[0],Q=U[1],ee=U[2],oe=q[0],le=q[1],de=q[2];return Math.abs(X-oe)<=x*Math.max(1,Math.abs(X),Math.abs(oe))&&Math.abs(Q-le)<=x*Math.max(1,Math.abs(Q),Math.abs(le))&&Math.abs(ee-de)<=x*Math.max(1,Math.abs(ee),Math.abs(de))}(this.pos,s)||l===0)return p[0]=p[1]=p[2]=0,!1;const[m,_,v]=this.dir,w=this.pos[0]-s[0],A=this.pos[1]-s[1],k=this.pos[2]-s[2],R=m*m+_*_+v*v,j=2*(w*m+A*_+k*v),z=j*j-4*R*(w*w+A*A+k*k-l*l);if(z<0){const U=Math.max(-j/2,0),q=w+m*U,X=A+_*U,Q=k+v*U,ee=Math.hypot(q,X,Q);return p[0]=q*l/ee,p[1]=X*l/ee,p[2]=Q*l/ee,!1}{const U=(-j-Math.sqrt(z))/(2*R);if(U<0){const q=Math.hypot(w,A,k);return p[0]=w*l/q,p[1]=A*l/q,p[2]=k*l/q,!1}return p[0]=w+m*U,p[1]=A+_*U,p[2]=k+v*U,!0}}}class hr{constructor(s,l,p,m,_){this.TL=s,this.TR=l,this.BR=p,this.BL=m,this.horizon=_}static fromInvProjectionMatrix(s,l,p){const m=[-1,1,1],_=[1,1,1],v=[1,-1,1],w=[-1,-1,1],A=zi(m,m,s),k=zi(_,_,s),R=zi(v,v,s),j=zi(w,w,s);return new hr(A,k,R,j,l/p)}}function Ln(u,s,l){let p=1/0,m=-1/0;const _=[];for(const v of u){Yn(_,v,s);const w=Ai(_,l);p=Math.min(p,w),m=Math.max(m,w)}return[p,m]}function Ir(u,s){let l=!0;for(let p=0;p<u.planes.length;p++){const m=u.planes[p];let _=0;for(let v=0;v<s.length;v++)_+=+(Ai(m,s[v])+m[3]>=0);if(_===0)return 0;_!==s.length&&(l=!1)}return l?2:1}function Wn(u,s){for(const l of u.projections){const p=Ln(s,u.points[0],l.axis);if(l.projection[1]<p[0]||l.projection[0]>p[1])return 0}return 1}function hn(u,s){let l=0;const p=[0,0,0,0];for(let v=0;v<u.length;v++)p[0]=u[v][0],p[1]=u[v][1],p[2]=u[v][2],p[3]=1,(m=p)[0]*(_=s)[0]+m[1]*_[1]+m[2]*_[2]+m[3]*_[3]>=0&&l++;var m,_;return l}class nr{constructor(s,l){this.points=s||new Array(8).fill([0,0,0]),this.planes=l||new Array(6).fill([0,0,0,0]),this.bounds=gn.fromPoints(this.points),this.projections=[],this.frustumEdges=[Yn([],this.points[2],this.points[3]),Yn([],this.points[0],this.points[3]),Yn([],this.points[4],this.points[0]),Yn([],this.points[5],this.points[1]),Yn([],this.points[6],this.points[2]),Yn([],this.points[7],this.points[3])];for(const p of this.frustumEdges){const m=[0,-p[2],p[1]],_=[p[2],0,-p[0]];this.projections.push({axis:m,projection:Ln(this.points,this.points[0],m)}),this.projections.push({axis:_,projection:Ln(this.points,this.points[0],_)})}}static fromInvProjectionMatrix(s,l,p,m){const _=Math.pow(2,p),v=[[-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(k=>{const R=$t([],k,s),j=1/R[3]/l*_;return(z=R)[0]=(U=R)[0]*(q=[j,j,m?1/R[3]:j,j])[0],z[1]=U[1]*q[1],z[2]=U[2]*q[2],z[3]=U[3]*q[3],z;var z,U,q}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(k=>{const R=Ei([],Xi([],Yn([],v[k[0]],v[k[1]]),Yn([],v[k[2]],v[k[1]]))),j=-Ai(R,v[k[1]]);return R.concat(j)}),A=[];for(let k=0;k<v.length;k++)A.push([v[k][0],v[k][1],v[k][2]]);return new nr(A,w)}intersectsPrecise(s,l,p){for(let m=0;m<l.length;m++)if(!hn(s,l[m]))return 0;for(let m=0;m<this.planes.length;m++)if(!hn(s,this.planes[m]))return 0;for(const m of p)for(const _ of this.frustumEdges){const v=Xi([],m,_),w=qt(v);if(w===0)continue;Ot(v,v,1/w);const A=Ln(this.points,this.points[0],v),k=Ln(s,this.points[0],v);if(A[0]>k[1]||k[0]>A[1])return 0}return 1}containsPoint(s){for(const l of this.planes){const p=l[3];if(Ai([l[0],l[1],l[2]],s)+p<0)return!1}return!0}}class gn{static fromPoints(s){const l=[1/0,1/0,1/0],p=[-1/0,-1/0,-1/0];for(const m of s)Ge(l,l,m),Rt(p,p,m);return new gn(l,p)}static fromTileIdAndHeight(s,l,p){const m=1<<s.canonical.z,_=s.canonical.x,v=s.canonical.y;return new gn([_/m,v/m,l],[(_+1)/m,(v+1)/m,p])}static applyTransform(s,l){const p=s.getCorners();for(let m=0;m<p.length;++m)zi(p[m],p[m],l);return gn.fromPoints(p)}static applyTransformFast(s,l){const p=[l[12],l[13],l[14]],m=[...p];for(let _=0;_<3;_++)for(let v=0;v<3;v++){const w=l[4*v+_],A=w*s.min[v],k=w*s.max[v];p[_]+=Math.min(A,k),m[_]+=Math.max(A,k)}return new gn(p,m)}static projectAabbCorners(s,l){const p=s.getCorners();for(let m=0;m<p.length;++m)zi(p[m],p[m],l);return p}constructor(s,l){this.min=s,this.max=l,this.center=Ot([],Fe([],this.min,this.max),.5)}quadrant(s){const l=[s%2==0,s<2],p=At(this.min),m=At(this.max);for(let _=0;_<l.length;_++)p[_]=l[_]?this.min[_]:this.center[_],m[_]=l[_]?this.center[_]:this.max[_];return m[2]=this.max[2],new gn(p,m)}distanceX(s){return Math.max(Math.min(this.max[0],s[0]),this.min[0])-s[0]}distanceY(s){return Math.max(Math.min(this.max[1],s[1]),this.min[1])-s[1]}distanceZ(s){return Math.max(Math.min(this.max[2],s[2]),this.min[2])-s[2]}getCorners(){const s=this.min,l=this.max;return[[s[0],s[1],s[2]],[l[0],s[1],s[2]],[l[0],l[1],s[2]],[s[0],l[1],s[2]],[s[0],s[1],l[2]],[l[0],s[1],l[2]],[l[0],l[1],l[2]],[s[0],l[1],l[2]]]}intersects(s){return this.intersectsAabb(s.bounds)?Ir(s,this.getCorners()):0}intersectsFlat(s){return this.intersectsAabb(s.bounds)?Ir(s,[[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(s,l){return l||this.intersects(s)?Wn(s,this.getCorners()):0}intersectsPreciseFlat(s,l){return l||this.intersectsFlat(s)?Wn(s,[[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(s){for(let l=0;l<3;++l)if(this.min[l]>s.max[l]||s.min[l]>this.max[l])return!1;return!0}intersectsAabbXY(s){return!(this.min[0]>s.max[0]||s.min[0]>this.max[0]||this.min[1]>s.max[1]||s.min[1]>this.max[1])}encapsulate(s){for(let l=0;l<3;l++)this.min[l]=Math.min(this.min[l],s.min[l]),this.max[l]=Math.max(this.max[l],s.max[l])}encapsulatePoint(s){for(let l=0;l<3;l++)this.min[l]=Math.min(this.min[l],s[l]),this.max[l]=Math.max(this.max[l],s[l])}closestPoint(s){return[Math.max(Math.min(this.max[0],s[0]),this.min[0]),Math.max(Math.min(this.max[1],s[1]),this.min[1]),Math.max(Math.min(this.max[2],s[2]),this.min[2])]}}ri(gn,"Aabb");class Or{constructor(s,l){this.feature=s,this.metersToTile=l,this.index=0}get(){const s=this.feature.vertices[this.index],l=this.feature.vertexProps[this.index].dir,p=l[1],m=-l[0],_=(s.extent+1)*this.metersToTile;return[new Tt(Math.trunc(s.position[0]+p*_),Math.trunc(s.position[1]+m*_)),new Tt(Math.trunc(s.position[0]-p*_),Math.trunc(s.position[1]-m*_))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class or{constructor(s,l,p,m,_,v){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Fr(),Fr(),Fr(),Fr(),Fr(),Fr(),Fr()],this.id=s,this.heightRange={min:p,max:p},this.safeArea=l,this.constantHeight=p,this.constantHeight==null&&(this.constantHeight!=null||m.length!==0)){this.vertices=m,this.edges=_,this.edges=this.edges.filter(w=>{return w.a<this.vertices.length&&w.b<this.vertices.length&&!((A=this.vertices[w.a].position)[0]===(k=this.vertices[w.b].position)[0]&&A[1]===k[1]);var A,k}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const w of this.vertices)this.vertexProps.push({dir:co(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,w.height),this.heightRange.max=Math.max(this.heightRange.max,w.height);for(const w of this.edges){const A=this.vertices[w.a].position,k=this.vertices[w.b].position,R=Qe(Fr(),k,A),j=bn(R),z=Di(Fr(),R,1/j);this.edgeProps.push({vec:R,dir:z,len:j});const U=this.vertexProps[w.a].dir,q=this.vertexProps[w.b].dir;ia(U,U,z),ia(q,q,z)}for(const w of this.vertexProps)w.dir[0]===0&&w.dir[1]===0||Br(w.dir,w.dir);this.tessellate(v)}}pointElevation(s){if(this.constantHeight!=null)return this.constantHeight;const l=this.getClosestEdge(s);if(l==null)return 0;const[p,m]=l;return Vi(this.vertices[this.edges[p].a].height,this.vertices[this.edges[p].b].height,m)}computeSlopeNormal(s,l){const p=this.getClosestEdge(s);if(!p)return kt(0,0,1);const m=p[0],_=this.edges[m],v=this.edgeProps[m].vec,w=kt(v[0],v[1],(this.vertices[_.b].height-this.vertices[_.a].height)*l),A=kt(w[1],-w[0],0);Xi(A,A,w);const k=qt(A);return k>0?Ot(A,A,1/k):Vt(A,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(s){if(this.edges.length===0)return;let l=0,p=Number.POSITIVE_INFINITY,m=0;const[_,v,w,A,k,R,j]=this._tmpVec2;qo(j,s.x,s.y);const z=new Dn(j,null);for(let U=0;U<this.edges.length;U++){const q=this.edges[U],X=this.edgeProps[U].dir;z.dir=X;const Q=this.vertices[q.a].position,ee=this.vertices[q.b].position,oe=z.intersectsPlane(Q,this.vertexProps[q.a].dir,_),le=z.intersectsPlane(ee,this.vertexProps[q.b].dir,v);if(!oe||!le)continue;Qe(w,v,_),Qe(A,j,_);const de=na(w,w),Ae=de>0?na(A,w)/de:0,xe=re(Ae,0,1),Me=Math.abs((Ae-xe)*this.edgeProps[U].len);Qe(k,j,Q),qo(R,X[1],-X[0]);const Le=Me+Math.abs(na(k,R));Le<p&&(l=U,p=Le,m=xe)}return[l,m]}tessellate(s){const l=dt(),p=dt(),m=dt(),_=dt();for(let v=this.edges.length-1;v>=0;--v){const w=this.edges[v].a,A=this.edges[v].b,{position:k,height:R,extent:j}=this.vertices[w],{position:z,height:U,extent:q}=this.vertices[A],X=this.vertexProps[w].dir,Q=this.vertexProps[A].dir;if(Vt(l,k[0]/s,k[1]/s,R),Vt(p,z[0]/s,z[1]/s,U),Vt(m,X[1],-X[0],0),Ot(m,m,j),Vt(_,Q[1],-Q[0],0),Ot(_,_,q),this.distSqLines(kt(l[0]+.5*m[0],l[1]+.5*m[1],l[2]+.5*m[2]),kt(p[0]-.5*_[0],p[1]-.5*_[1],p[2]-.5*_[2]),kt(l[0]-.5*m[0],l[1]-.5*m[1],l[2]-.5*m[2]),kt(p[0]+.5*_[0],p[1]+.5*_[1],p[2]+.5*_[2]))<=.0025000000000000005)continue;const ee=this.vertices.length,oe=ia(Fr(),k,z);this.vertices.push({position:Di(oe,oe,.5),height:.5*(R+U),extent:.5*(j+q)});const le=ia(Fr(),X,Q);this.vertexProps.push({dir:Br(le,le)}),this.edges.splice(v,1),this.edgeProps.splice(v,1),this.edges.push({a:w,b:ee}),this.edges.push({a:ee,b:A});const de=Qe(Fr(),this.vertices[ee].position,k),Ae=bn(de),xe={vec:de,dir:Di(Fr(),de,1/Ae),len:Ae};this.edgeProps.push(xe),this.edgeProps.push(xe)}}distSqLines(s,l,p,m){const _=lt(dt(),l,s),v=lt(dt(),m,p),w=lt(dt(),s,p),A=Ai(_,_),k=Ai(_,v),R=Ai(_,w),j=Ai(v,v),z=Ai(v,w),U=A*j-k*k;if(U===0)return ei(Nn(_,p,m,Ai(w,v)/Ai(v,v)),s);const q=(A*z-k*R)/U;return ei(Nn(_,s,l,(k*z-R*j)/U),Nn(v,p,m,q))}}class Ki{static parseFrom(s,l){const p=qi.parse(s);if(!p)return[];let{vertices:m,features:_}=p;const v=1/ke(l);_.sort((R,j)=>R.id-j.id),m.sort((R,j)=>R.id-j.id||R.idx-j.idx),m=m.filter((R,j,z)=>j===z.findIndex(U=>U.id===R.id&&U.idx===R.idx));const w=new Array;let A=0;const k=m.length;for(const R of _){if(R.constantHeight){w.push(new or(R.id,R.bounds,R.constantHeight));continue}for(;A!==k&&m[A].id<R.id;)A++;if(A===k||m[A].id!==R.id)continue;const j=new Array,z=new Array,U=A;for(;A!==k&&m[A].id===R.id;){const q=m[A];if(j.push({position:q.position,height:q.height,extent:q.extent}),A!==U&&m[A-1].idx===q.idx-1){const X=A-U;z.push({a:X-1,b:X})}A++}w.push(new or(R.id,R.bounds,void 0,j,z,v))}return w}static getElevationFeature(s,l){if(!l)return;const p=+s.properties[Yt];return Number.isNaN(p)?void 0:l.find(m=>m.id===p)}}class Bn{constructor(s,l){this.zScale=1,this.xOffset=0,this.yOffset=0,s.equals(l)||(this.zScale=Math.pow(2,l.z-s.z),this.xOffset=(s.x*this.zScale-l.x)*Ft,this.yOffset=(s.y*this.zScale-l.y)*Ft)}constantElevation(s,l){if(s.constantHeight!=null)return this.computeBiasedHeight(s.constantHeight,l)}pointElevation(s,l,p){const m=this.constantElevation(l,p);return m??(s.x=s.x*this.zScale+this.xOffset,s.y=s.y*this.zScale+this.yOffset,this.computeBiasedHeight(l.pointElevation(s),p))}computeBiasedHeight(s,l){return l<=0?s:s+l*ge(0,l,s>=0?s:Math.abs(.5*s))}}ri(or,"ElevationFeature");class ts{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.projection=s.projection,this.layoutVertexArray=new Qa,this.indexArray=new Xr,this.segments=new ls,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut}),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new ed),this.worldview=s.worldview,this.hasAppearances=null}updateFootprints(s,l){}updateAppearances(s,l,p,m){}populate(s,l,p,m){const _=this.layers[0],v=[];let w=null;_.type==="circle"&&(w=_.layout.get("circle-sort-key"));for(const{feature:k,id:R,index:j,sourceLayerIndex:z}of s){const U=this.layers[0]._featureFilter.needGeometry,q=nt(k,U);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),q,p))continue;const X=w?w.evaluate(q,{},p):void 0,Q={id:R,properties:k.properties,type:k.type,sourceLayerIndex:z,index:j,geometry:U?q.geometry:yt(k,p,m),patterns:{},sortKey:X};v.push(Q)}w&&v.sort((k,R)=>k.sortKey-R.sortKey);let A=null;m.projection.name==="globe"&&(this.globeExtVertexArray=new ox,A=m.projection);for(const k of v){const{geometry:R,index:j,sourceLayerIndex:z}=k,U=s[j].feature;this.addFeature(k,R,j,l.availableImages,p,A,l.brightness,l.elevationFeatures),l.featureIndex.insert(U,R,j,z,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(s,l,p,m,_,v,w){this.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,P2.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=s.createVertexBuffer(this.globeExtVertexArray,wD.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=s.createVertexBuffer(this.elevatedLayoutVertexArray,bD.members))),this.programConfigurations.upload(s),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(s,l,p,m,_,v,w,A){let k;this.elevationMode!=="none"&&(k=Ki.getElevationFeature(s,A));for(const R of l)for(const j of R){const z=j.x,U=j.y;if(z<0||z>=Ft||U<0||U>=Ft)continue;if(v){const Q=v.projectTilePoint(z,U,_),ee=v.upVector(_,z,U);this.addGlobeExtVertex(Q,ee),this.addGlobeExtVertex(Q,ee),this.addGlobeExtVertex(Q,ee),this.addGlobeExtVertex(Q,ee)}const q=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),X=q.vertexLength;if(this.addCircleVertex(z,U,-1,-1),this.addCircleVertex(z,U,1,-1),this.addCircleVertex(z,U,1,1),this.addCircleVertex(z,U,-1,1),this.elevationMode!=="none"){const Q=k?k.pointElevation(new Tt(z,U)):0;this.hasElevation=this.hasElevation||Q!==0;for(let ee=0;ee<4;ee++)this.elevatedLayoutVertexArray.emplaceBack(Q)}this.indexArray.emplaceBack(X,X+1,X+2),this.indexArray.emplaceBack(X,X+2,X+3),q.vertexLength+=4,q.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,{},m,_,w,void 0,this.worldview)}addCircleVertex(s,l,p,m){this.layoutVertexArray.emplaceBack(2*s+(p+1)/2,2*l+(m+1)/2)}addGlobeExtVertex(s,l){this.globeExtVertexArray.emplaceBack(s.x,s.y,s.z,l[0]*16384,l[1]*16384,l[2]*16384)}}function Ps(u,s){for(let l=0;l<u.length;l++)if(vo(s,u[l]))return!0;for(let l=0;l<s.length;l++)if(vo(u,s[l]))return!0;return!!Ma(u,s)}function cs(u,s,l){return!!vo(u,s)||!!Go(s,u,l)}function ws(u,s){if(u.length===1)return Cc(s,u[0]);for(let l=0;l<s.length;l++){const p=s[l];for(let m=0;m<p.length;m++)if(vo(u,p[m]))return!0}for(let l=0;l<u.length;l++)if(Cc(s,u[l]))return!0;for(let l=0;l<s.length;l++)if(Ma(u,s[l]))return!0;return!1}function el(u,s,l){if(u.length>1){if(Ma(u,s))return!0;for(let p=0;p<s.length;p++)if(Go(s[p],u,l))return!0}for(let p=0;p<u.length;p++)if(Go(u[p],s,l))return!0;return!1}function Ma(u,s){if(u.length===0||s.length===0)return!1;for(let l=0;l<u.length-1;l++){const p=u[l],m=u[l+1];for(let _=0;_<s.length-1;_++)if(Ho(p,m,s[_],s[_+1]))return!0}return!1}function Ho(u,s,l,p){return Wi(u,l,p)!==Wi(s,l,p)&&Wi(u,s,l)!==Wi(u,s,p)}function sa(u,s,l){return(u.x-l.x)*(s.y-l.y)-(u.y-l.y)*(s.x-l.x)}function Ol(u,s,l,p){const m=sa(u,s,p),_=sa(u,s,l);if(Math.sign(m)===Math.sign(_))return;const v=sa(l,p,u),w=v+_-m;return Math.sign(v)!==Math.sign(w)?[v/(v-w),_/(_-m)]:void 0}function Go(u,s,l){const p=l*l;if(s.length===1)return u.distSqr(s[0])<p;for(let m=1;m<s.length;m++)if(Fl(u,s[m-1],s[m])<p)return!0;return!1}function Fl(u,s,l){const p=s.distSqr(l);if(p===0)return u.distSqr(s);const m=((u.x-s.x)*(l.x-s.x)+(u.y-s.y)*(l.y-s.y))/p;return u.distSqr(m<0?s:m>1?l:l.sub(s)._mult(m)._add(s))}function Cc(u,s){let l,p,m,_=!1;for(let v=0;v<u.length;v++){l=u[v];for(let w=0,A=l.length-1;w<l.length;A=w++)p=l[w],m=l[A],p.y>s.y!=m.y>s.y&&s.x<(m.x-p.x)*(s.y-p.y)/(m.y-p.y)+p.x&&(_=!_)}return _}function vo(u,s){let l=!1;for(let p=0,m=u.length-1;p<u.length;m=p++){const _=u[p],v=u[m];_.y>s.y!=v.y>s.y&&s.x<(v.x-_.x)*(s.y-_.y)/(v.y-_.y)+_.x&&(l=!l)}return l}function ms(u,s,l,p,m){for(const v of u)if(s<=v.x&&l<=v.y&&p>=v.x&&m>=v.y)return!0;const _=[new Tt(s,l),new Tt(s,m),new Tt(p,m),new Tt(p,l)];if(u.length>2){for(const v of _)if(vo(u,v))return!0}for(let v=0;v<u.length-1;v++)if(Ns(u[v],u[v+1],_))return!0;return!1}function Ns(u,s,l){const p=l[0],m=l[2];if(u.x<p.x&&s.x<p.x||u.x>m.x&&s.x>m.x||u.y<p.y&&s.y<p.y||u.y>m.y&&s.y>m.y)return!1;const _=Wi(u,s,l[0]);return _!==Wi(u,s,l[1])||_!==Wi(u,s,l[2])||_!==Wi(u,s,l[3])}function Ar(u,s,l,p,m,_){let v=s.y-u.y,w=u.x-s.x;if(_=_||0){const A=v*v+w*w;if(A===0)return!0;const k=Math.sqrt(A);v/=k,w/=k}return!((l.x-u.x)*v+(l.y-u.y)*w-_<0||(p.x-u.x)*v+(p.y-u.y)*w-_<0||(m.x-u.x)*v+(m.y-u.y)*w-_<0)}function Rs(u,s,l,p,m,_,v){return!(Ar(u,s,p,m,_,v)||Ar(s,l,p,m,_,v)||Ar(l,u,p,m,_,v)||Ar(p,m,u,s,l,v)||Ar(m,_,u,s,l,v)||Ar(_,p,u,s,l,v))}function xo(u,s,l){const p=s.paint.get(u).value;return p.kind==="constant"?p.value:l.programConfigurations.get(s.id).getMaxValue(u)}function gs(u){return Math.sqrt(u[0]*u[0]+u[1]*u[1])}function Bl(u,s,l,p,m){if(!s[0]&&!s[1])return u;const _=Tt.convert(s)._mult(m);l==="viewport"&&_._rotate(-p);const v=[];for(let w=0;w<u.length;w++)v.push(u[w].sub(_));return v}function Yf(u,s,l,p){const m=Tt.convert(u)._mult(p);return s==="viewport"&&m._rotate(-l),m}let nd,Qf;function Jf(u,s,l){var p=2*Math.PI*6378137/256/Math.pow(2,l);return[u*p-2*Math.PI*6378137/2,s*p-2*Math.PI*6378137/2]}ri(ts,"CircleBucket",{omit:["layers"]});class Ul{constructor(s,l,p){this.z=s,this.x=l,this.y=p,this.key=Vl(0,s,s,l,p)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}isChildOf(s){const l=this.z-s.z;return s.z===0||s.z<this.z&&s.x===this.x>>l&&s.y===this.y>>l}url(s,l){const p=function(_,v,w){var A=Jf(256*_,256*(v=Math.pow(2,w)-v-1),w),k=Jf(256*(_+1),256*(v+1),w);return A[0]+","+A[1]+","+k[0]+","+k[1]}(this.x,this.y,this.z),m=function(_,v,w){let A,k="";for(let R=_;R>0;R--)A=1<<R-1,k+=(v&A?1:0)+(w&A?2:0);return k}(this.z,this.x,this.y);return s[(this.x+this.y)%s.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(l==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",m).replace("{bbox-epsg-3857}",p)}toString(){return`${this.z}/${this.x}/${this.y}`}}class xu{constructor(s,l){this.wrap=s,this.canonical=l,this.key=Vl(s,l.z,l.z,l.x,l.y)}}class po{constructor(s,l,p,m,_){this.overscaledZ=s,this.wrap=l,this.canonical=new Ul(p,+m,+_),this.key=l===0&&s===p?this.canonical.key:Vl(l,s,p,m,_)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){const l=this.canonical.z-s;return s>this.canonical.z?new po(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new po(s,this.wrap,s,this.canonical.x>>l,this.canonical.y>>l)}calculateScaledKey(s,l=!0){if(this.overscaledZ===s&&l)return this.key;if(s>this.canonical.z)return Vl(this.wrap*+l,s,this.canonical.z,this.canonical.x,this.canonical.y);{const p=this.canonical.z-s;return Vl(this.wrap*+l,s,s,this.canonical.x>>p,this.canonical.y>>p)}}isChildOf(s){if(s.wrap!==this.wrap)return!1;const l=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.z<this.canonical.z&&s.canonical.x===this.canonical.x>>l&&s.canonical.y===this.canonical.y>>l}children(s){if(this.overscaledZ>=s)return[new po(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const l=this.canonical.z+1,p=2*this.canonical.x,m=2*this.canonical.y;return[new po(l,this.wrap,l,p,m),new po(l,this.wrap,l,p+1,m),new po(l,this.wrap,l,p,m+1),new po(l,this.wrap,l,p+1,m+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new po(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new po(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new xu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Vl(u,s,l,p,m){const _=1<<Math.min(l,22);let v=_*(m%_)+p%_;return u&&l<22&&(v+=_*_*((u<0?-2*u-1:2*u)%(1<<2*(22-l)))),16*(32*v+l)+(s-l)}const _p=[u=>{let s=u.canonical.x-1,l=u.wrap;return s<0&&(s=(1<<u.canonical.z)-1,l--),new po(u.overscaledZ,l,u.canonical.z,s,u.canonical.y)},u=>{let s=u.canonical.x+1,l=u.wrap;return s===1<<u.canonical.z&&(s=0,l++),new po(u.overscaledZ,l,u.canonical.z,s,u.canonical.y)},u=>new po(u.overscaledZ,u.wrap,u.canonical.z,u.canonical.x,(u.canonical.y===0?1<<u.canonical.z:u.canonical.y)-1),u=>new po(u.overscaledZ,u.wrap,u.canonical.z,u.canonical.x,u.canonical.y===(1<<u.canonical.z)-1?0:u.canonical.y+1)];ri(Ul,"CanonicalTileID"),ri(po,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const R2=wn([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:_x}
vendor: 3,422 bytes, line 814
814=R2,bde=wn([{name:"a_pos_3",components:3,type:"Int16"}]);var t5=wn([{name:"a_pos",type:"Int16",components:2}]);function j2(u){return u*Ja/L}const wde=[new gn([T,T,T],[E,E,E]),new gn([T,T,T],[0,0,E]),new gn([0,T,T],[E,0,E]),new gn([T,0,T],[0,E,E]),new gn([0,0,T],[E,E,E])];function i5(u,s,l,p=!0){const m=Ot([],u._camera.position,u.worldSize),_=[s,l,1,1];$t(_,_,u.pixelMatrixInverse),ot(_,_,1/_[3]);const v=Ei([],Yn([],_,m)),w=u.globeMatrix,A=[w[12],w[13],w[14]],k=Yn([],A,m),R=qt(k),j=Ei([],k),z=u.worldSize/(2*Math.PI),U=Ai(j,v),q=Math.asin(z/R);if(q<Math.acos(U)){if(!p)return null;const ut=[],Xe=[];Ot(ut,v,R/U),Ei(Xe,Yn(Xe,ut,k)),Ei(v,Fe(v,k,Ot(v,Xe,Math.tan(q)*R)))}const X=[];new dn(m,v).closestPointOnSphere(A,z,X);const Q=Ei([],ps(w,0)),ee=Ei([],ps(w,1)),oe=Ei([],ps(w,2)),le=Ai(Q,X),de=Ai(ee,X),Ae=Ai(oe,X),xe=Ms(Math.asin(-de/z));let Me=Ms(Math.atan2(le,Ae));Me=u.center.lng+function(ut,Xe){const ht=(Xe-ut+180)%360-180;return ht<-180?ht+360:ht}(u.center.lng,Me);const Le=se(Me),Be=re(ne(xe),0,1);return new Ke(Le,Be)}class Sde{constructor(s,l,p){this.a=Yn([],s,p),this.b=Yn([],l,p),this.center=p;const m=Ei([],this.a),_=Ei([],this.b);this.angle=Math.acos(Ai(m,_))}}function ND(u,s){if(u.angle===0)return null;let l;return l=u.a[s]===0?1/u.angle*.5*Math.PI:1/u.angle*Math.atan(u.b[s]/u.a[s]/Math.sin(u.angle)-1/Math.tan(u.angle)),l<0||l>1?null:function(p,m,_,v){const w=Math.sin(_);return p*(Math.sin((1-v)*_)/w)+m*(Math.sin(v*_)/w)}(u.a[s],u.b[s],u.angle,re(l,0,1))+u.center[s]}function lh(u){if(u.z<=1)return wde[u.z+2*u.y+u.x];const s=MD(z2(u));return gn.fromPoints(s)}function vp(u,s,l){return Ot(u,u,1-l),Ci(u,u,s,l)}function n5(u,s,l){for(const p of u)zi(p,p,s),Ot(p,p,l)}function r5(u,s,l,p){const m=s/u.worldSize,_=u.globeMatrix;if(l.z<=1){const Be=lh(l).getCorners();return n5(Be,_,m),gn.fromPoints(Be)}const v=z2(l,p),w=MD(v,Ja+j2(u._tileCoverLift));n5(w,_,m);const A=Number.MAX_VALUE,k=[-A,-A,-A],R=[A,A,A];if(v.contains(u.center)){for(const Xe of w)Ge(R,R,Xe),Rt(k,k,Xe);k[2]=0;const Be=u.point,ut=[Be.x*m,Be.y*m,0];return Ge(R,R,ut),Rt(k,k,ut),new gn(R,k)}if(u._tileCoverLift>0){for(const Be of w)Ge(R,R,Be),Rt(k,k,Be);return new gn(R,k)}const j=[_[12]*m,_[13]*m,_[14]*m],z=v.getCenter(),U=re(u.center.lat,-me,me),q=re(z.lat,-me,me),X=se(u.center.lng),Q=ne(U);let ee=X-se(z.lng);const oe=Q-ne(q);ee>.5?ee-=1:ee<-.5&&(ee+=1);let le=0;Math.abs(ee)>Math.abs(oe)?le=ee>=0?1:3:(le=oe>=0?0:2,Ci(j,j,[_[4]*m,_[5]*m,_[6]*m],-Math.sin(Pn(oe>=0?v.getSouth():v.getNorth()))*Ja));const de=w[le],Ae=w[(le+1)%4],xe=new Sde(de,Ae,j),Me=[ND(xe,0)||de[0],ND(xe,1)||de[1],ND(xe,2)||de[2]],Le=em(u.zoom);if(Le>0){const Be=function({x:Xe,y:ht,z:_t},bt,zt,Et,vt){const Ct=1/(1<<_t);let at=Xe*Ct,st=at+Ct,St=ht*Ct,Dt=St+Ct,xt=0;const ni=(at+st)/2-Et;return ni>.5?xt=-1:ni<-.5&&(xt=1),at=((at+xt)*bt-(Et*=bt))*zt+Et,st=((st+xt)*bt-Et)*zt+Et,St=(St*bt-(vt*=bt))*zt+vt,Dt=(Dt*bt-vt)*zt+vt,[[at,Dt,0],[st,Dt,0],[st,St,0],[at,St,0]]}(l,s,u._pixelsPerMercatorPixel,X,Q);for(let Xe=0;Xe<w.length;Xe++)vp(w[Xe],Be[Xe],Le);const ut=Fe([],Be[le],Be[(le+1)%4]);Ot(ut,ut,.5),vp(Me,ut,Le)}for(const Be of w)Ge(R,R,Be),Rt(k,k,Be);return R[2]=Math.min(de[2],Ae[2]),Ge(R,R,Me),Rt(k,k,Me),new gn(R,k)}function z2({x:u,y:s,z:l},p=!1){const m=1/(1<<l),_=new H(fe(u*m),s===(1<<l)-1&&p?-90:ue((s+1)*m)),v=new H(fe((u+1)*m),s===0&&p?90:ue(s*m));return new F(_,v)}function MD(u,s=Ja){const l=Pn(u.getNorth()),p=Pn(u.getSouth()),m=Math.cos(l),_=
vendor: 4,906 bytes, line 814
814Math.cos(p),v=Math.sin(l),w=Math.sin(p),A=u.getWest(),k=u.getEast();return[P(_,w,A,s),P(_,w,k,s),P(m,v,k,s),P(m,v,A,s)]}function Ew(u,s,l,p){const m=1<<l.z,_=(u/Ft+l.x)/m;return M(ue((s/Ft+l.y)/m),fe(_),p)}function L2({min:u,max:s}){return h/Math.max(s[0]-u[0],s[1]-u[1],s[2]-u[2])}const s5=new Float64Array(16);function O2(u){const s=L2(u),l=Ne(s5,[s,s,s]);return te(l,l,Oi([],u.min))}function DD(u){const s=(p=u.min,(l=s5)[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=p[0],l[13]=p[1],l[14]=p[2],l[15]=1,l);var l,p;const m=1/L2(u);return ce(s,s,[m,m,m])}function RD(u){const s=Ft/(2*Math.PI);return u/(2*Math.PI)/s}function o5(u,s){return Ft/(512*Math.pow(2,u))*L2(lh(s))}function a5(u,s,l,p,m){const _=RD(l),v=[u,s,-l/(2*Math.PI)],w=W(new Float64Array(16));return te(w,w,v),ce(w,w,[_,_,_]),_e(w,w,Pn(-m)),Te(w,w,Pn(-p)),w}function em(u){return ge(g,a,u)}function l5(u,s){const l=M(s.lat,s.lng),p=function(q){const X=M(q._center.lat,q._center.lng);let Q=Xi([],kt(0,1,0),X);const ee=pe([],-q.angle,X);Q=zi(Q,Q,ee),pe(ee,-q._pitch,Q);const oe=Ei([],X);return Ot(oe,oe,j2(q.cameraToCenterDistance/q.pixelsPerMeter)),zi(oe,oe,ee),Fe([],X,oe)}(u);return v=(m=lt([],p,l))[0],w=m[1],A=m[2],k=(_=l)[0],R=_[1],j=_[2],U=(z=Math.sqrt((v*v+w*w+A*A)*(k*k+R*R+j*j)))&&Ai(m,_)/z,Math.acos(Math.min(Math.max(U,-1),1));var m,_,v,w,A,k,R,j,z,U}function jD(u,s){return l5(u,s)>Math.PI/2*1.01}const c5=Pn(85),Tde=Math.cos(c5),Cde=Math.sin(c5),Ede=V(),u5=u=>{const s=[];return u.paint.get("circle-pitch-alignment")==="map"&&s.push("PITCH_WITH_MAP"),u.paint.get("circle-pitch-scale")==="map"&&s.push("SCALE_WITH_MAP"),s};function d5(u,s,l,p,m,_,v,w,A){if(_&&u.queryGeometry.isAboveHorizon)return!1;_&&(A*=u.pixelToTileUnitsFactor);const k=u.tileID.canonical,R=l.projection.upVectorScale(k,l.center.lat,l.worldSize).metersToTile;for(const j of s)for(const z of j){const U=z.add(w),q=m&&l.elevation?l.elevation.exaggeration()*m.getElevationAt(U.x,U.y,!0):0,X=l.projection.projectTilePoint(U.x,U.y,k);if(q>0){const le=l.projection.upVector(k,U.x,U.y);X.x+=le[0]*R*q,X.y+=le[1]*R*q,X.z+=le[2]*R*q}const Q=_?U:Ade(X.x,X.y,X.z,p),ee=_?u.tilespaceRays.map(le=>kde(le,q)):u.queryGeometry.screenGeometry,oe=$t([],[X.x,X.y,X.z,1],p);if(!v&&_?A*=oe[3]/l.cameraToCenterDistance:v&&!_&&(A*=l.cameraToCenterDistance/oe[3]),_){const le=ue((z.y/Ft+k.y)/(1<<k.z));A/=l.projection.pixelsPerMeter(le,1)/ae(1,le)}if(cs(ee,Q,A))return!0}return!1}function Ade(u,s,l,p){const m=$t([],[u,s,l,1],p);return new Tt(m[0]/m[3],m[1]/m[3])}const h5=kt(0,0,0),Ide=kt(0,0,1);function kde(u,s){const l=dt();return h5[2]=s,u.intersectsPlane(h5,Ide,l),new Tt(l[0],l[1])}class p5 extends ts{}let f5,m5,g5,y5;function _5(u,{width:s,height:l},p,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==s*l*p)throw new RangeError("mismatched image size")}else m=new Uint8Array(s*l*p);return u.width=s,u.height=l,u.data=m,u}function v5(u,s,l){const{width:p,height:m}=s;p===u.width&&m===u.height||(zD(u,s,{x:0,y:0},{x:0,y:0},{width:Math.min(u.width,p),height:Math.min(u.height,m)},l,null),u.width=p,u.height=m,u.data=s.data)}function zD(u,s,l,p,m,_,v,w){if(m.width===0||m.height===0)return s;if(m.width>u.width||m.height>u.height||l.x>u.width-m.width||l.y>u.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>s.width||m.height>s.height||p.x>s.width-m.width||p.y>s.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const A=u.data,k=s.data,R=_===4&&w;for(let j=0;j<m.height;j++){const z=((l.y+j)*u.width+l.x)*_,U=((p.y+j)*s.width+p.x)*_;if(R)for(let q=0;q<m.width;q++){const X=z+q*_+3,Q=U+q*_;k[Q+0]=255,k[Q+1]=255,k[Q+2]=255,k[Q+3]=A[X]}else if(v)for(let q=0;q<m.width;q++){const X=z+q*_,Q=U+q*_,ee=new lr(A[X+0]/255,A[X+1]/255,A[X+2]/255,A[X+3]).toNonPremultipliedRenderColor(v).toArray();k[Q+0]=ee[0],k[Q+1]=ee[1],k[Q+2]=ee[2],k[Q+3]=ee[3]}else for(let q=0;q<m.width*_;q++)k[U+q]=A[z+q]}return s}ri(p5,"HeatmapBucket",{omit:["layers"]});class tm{constructor(s,l){_5(this,s,1,l)}resize(s){v5(this,new tm(s),1)}clone(){return new tm({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,l,p,m,_){zD(s,l,p,m,_,1,null)}}class oa{constructor(s,l){_5(this,s,4,l)}resize(s){v5(this,new oa(s),4)}replace(s,l){l?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new oa({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,l,p,m,_,v,w){zD(s,l,p,m,_,4,v,w)}}class x5{constructor(s,l){this.width=s.width,this.height=s.height,this.data=l instanceof Uint8Array?new Float32Array(l.buffer):l}}function Aw(u){const s={},l=u.resolution||256,p=u.clips?u.clips.length:1,m=u.image||new oa({width:l,height:p}),_=(v,w,A)=>{s[u.evaluationKey]=A;const k=u.expression.evaluate(s),R=k?k.toNonPremultipliedRenderColor(null):null;
vendor: 4,241 bytes, line 814
814R&&(m.data[v+w+0]=Math.floor(255*R.r),m.data[v+w+1]=Math.floor(255*R.g),m.data[v+w+2]=Math.floor(255*R.b),m.data[v+w+3]=Math.floor(255*R.a))};if(u.clips)for(let v=0,w=0;v<p;++v,w+=4*l)for(let A=0,k=0;A<l;A++,k+=4){const R=A/(l-1),{start:j,end:z}=u.clips[v];_(w,k,j*(1-R)+z*R)}else for(let v=0,w=0;v<l;v++,w+=4)_(0,w,v/(l-1));return m}ri(tm,"AlphaImage"),ri(oa,"RGBAImage");const Pde=wn([{name:"a_pos",components:2,type:"Int16"}],4),Nde=wn([{name:"a_road_z_offset",components:1,type:"Float32"}],4),Mde=wn([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Dde=wn([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function vx(u,s,l=2){const p=s&&s.length,m=p?s[0]*l:u.length;let _=b5(u,0,m,l,!0);const v=[];if(!_||_.next===_.prev)return v;let w,A,k;if(p&&(_=function(R,j,z,U){const q=[];for(let X=0,Q=j.length;X<Q;X++){const ee=b5(R,j[X]*U,X<Q-1?j[X+1]*U:R.length,U,!1);ee===ee.next&&(ee.steiner=!0),q.push(Ude(ee))}q.sort(Ode);for(let X=0;X<q.length;X++)z=Fde(q[X],z);return z}(u,s,_,l)),u.length>80*l){w=u[0],A=u[1];let R=w,j=A;for(let z=l;z<m;z+=l){const U=u[z],q=u[z+1];U<w&&(w=U),q<A&&(A=q),U>R&&(R=U),q>j&&(j=q)}k=Math.max(R-w,j-A),k=k!==0?32767/k:0}return Iw(_,v,l,w,A,k,0),v}function b5(u,s,l,p,m){let _;if(m===function(v,w,A,k){let R=0;for(let j=w,z=A-k;j<A;j+=k)R+=(v[z]-v[j])*(v[j+1]+v[z+1]),z=j;return R}(u,s,l,p)>0)for(let v=s;v<l;v+=p)_=C5(v/p|0,u[v],u[v+1],_);else for(let v=l-p;v>=s;v-=p)_=C5(v/p|0,u[v],u[v+1],_);return _&&xx(_,_.next)&&(Nw(_),_=_.next),_}function Dy(u,s){if(!u)return u;s||(s=u);let l,p=u;do if(l=!1,p.steiner||!xx(p,p.next)&&bo(p.prev,p,p.next)!==0)p=p.next;else{if(Nw(p),p=s=p.prev,p===p.next)break;l=!0}while(l||p!==s);return s}function Iw(u,s,l,p,m,_,v){if(!u)return;!v&&_&&function(A,k,R,j){let z=A;do z.z===0&&(z.z=LD(z.x,z.y,k,R,j)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==A);z.prevZ.nextZ=null,z.prevZ=null,function(U){let q,X=1;do{let Q,ee=U;U=null;let oe=null;for(q=0;ee;){q++;let le=ee,de=0;for(let xe=0;xe<X&&(de++,le=le.nextZ,le);xe++);let Ae=X;for(;de>0||Ae>0&≤)de!==0&&(Ae===0||!le||ee.z<=le.z)?(Q=ee,ee=ee.nextZ,de--):(Q=le,le=le.nextZ,Ae--),oe?oe.nextZ=Q:U=Q,Q.prevZ=oe,oe=Q;ee=le}oe.nextZ=null,X*=2}while(q>1)}(z)}(u,p,m,_);let w=u;for(;u.prev!==u.next;){const A=u.prev,k=u.next;if(_?jde(u,p,m,_):Rde(u))s.push(A.i,u.i,k.i),Nw(u),u=k.next,w=k.next;else if((u=k)===w){v?v===1?Iw(u=zde(Dy(u),s),s,l,p,m,_,2):v===2&&Lde(u,s,l,p,m,_):Iw(Dy(u),s,l,p,m,_,1);break}}}function Rde(u){const s=u.prev,l=u,p=u.next;if(bo(s,l,p)>=0)return!1;const m=s.x,_=l.x,v=p.x,w=s.y,A=l.y,k=p.y,R=Math.min(m,_,v),j=Math.min(w,A,k),z=Math.max(m,_,v),U=Math.max(w,A,k);let q=p.next;for(;q!==s;){if(q.x>=R&&q.x<=z&&q.y>=j&&q.y<=U&&kw(m,w,_,A,v,k,q.x,q.y)&&bo(q.prev,q,q.next)>=0)return!1;q=q.next}return!0}function jde(u,s,l,p){const m=u.prev,_=u,v=u.next;if(bo(m,_,v)>=0)return!1;const w=m.x,A=_.x,k=v.x,R=m.y,j=_.y,z=v.y,U=Math.min(w,A,k),q=Math.min(R,j,z),X=Math.max(w,A,k),Q=Math.max(R,j,z),ee=LD(U,q,s,l,p),oe=LD(X,Q,s,l,p);let le=u.prevZ,de=u.nextZ;for(;le&&le.z>=ee&&de&&de.z<=oe;){if(le.x>=U&&le.x<=X&&le.y>=q&&le.y<=Q&&le!==m&&le!==v&&kw(w,R,A,j,k,z,le.x,le.y)&&bo(le.prev,le,le.next)>=0||(le=le.prevZ,de.x>=U&&de.x<=X&&de.y>=q&&de.y<=Q&&de!==m&&de!==v&&kw(w,R,A,j,k,z,de.x,de.y)&&bo(de.prev,de,de.next)>=0))return!1;de=de.nextZ}for(;le&&le.z>=ee;){if(le.x>=U&&le.x<=X&&le.y>=q&&le.y<=Q&&le!==m&&le!==v&&kw(w,R,A,j,k,z,le.x,le.y)&&bo(le.prev,le,le.next)>=0)return!1;le=le.prevZ}for(;de&&de.z<=oe;){if(de.x>=U&&de.x<=X&&de.y>=q&&de.y<=Q&&de!==m&&de!==v&&kw(w,R,A,j,k,z,de.x,de.y)&&bo(de.prev,de,de.next)>=0)return!1;de=de.nextZ}return!0}function zde(u,s){let l=u;do{const p=l.prev,m=l.next.next;!xx(p,m)&&S5(p,l,l.next,m)&&Pw(p,m)&&Pw(m,p)&&(s.push(p.i,l.i,m.i),Nw(l),Nw(l.next),l=u=m),l=l.next}while(l!==u);return Dy(l)}function Lde(u,s,l,p,m,_){let v=u;do{let w=v.next.next;for(;w!==v.prev;){if(v.i!==w.i&&Vde(v,w)){let A=T5(v,w);return v=Dy(v,v.next),A=Dy(A,A.next),Iw(v,s,l,p,m,_,0),void Iw(A,s,l,p,m,_,0)}w=w.next}v=v.next}while(v!==u)}function Ode(u,s){let l=u.x-s.x;return l===0&&(l=u.y-s.y,l===0)&&(l=(u.next.y-u.y)/(u.next.x-u.x)-(s.next.y-s.y)/(s.next.x-s.x)),l}function Fde(u,s){const l=function(m,_){let v=_;const w=m.x,A=m.y;let k,R=-1/0;
vendor: 1,740 bytes, line 814
814if(xx(m,v))return v;do{if(xx(m,v.next))return v.next;if(A<=v.y&&A>=v.next.y&&v.next.y!==v.y){const X=v.x+(A-v.y)*(v.next.x-v.x)/(v.next.y-v.y);if(X<=w&&X>R&&(R=X,k=v.x<v.next.x?v:v.next,X===w))return k}v=v.next}while(v!==_);if(!k)return null;const j=k,z=k.x,U=k.y;let q=1/0;v=k;do{if(w>=v.x&&v.x>=z&&w!==v.x&&w5(A<U?w:R,A,z,U,A<U?R:w,A,v.x,v.y)){const X=Math.abs(A-v.y)/(w-v.x);Pw(v,m)&&(X<q||X===q&&(v.x>k.x||v.x===k.x&&Bde(k,v)))&&(k=v,q=X)}v=v.next}while(v!==j);return k}(u,s);if(!l)return s;const p=T5(l,u);return Dy(p,p.next),Dy(l,l.next)}function Bde(u,s){return bo(u.prev,u,s.prev)<0&&bo(s.next,u,u.next)<0}function LD(u,s,l,p,m){return(u=1431655765&((u=858993459&((u=252645135&((u=16711935&((u=(u-l)*m|0)|u<<8))|u<<4))|u<<2))|u<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-p)*m|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function Ude(u){let s=u,l=u;do(s.x<l.x||s.x===l.x&&s.y<l.y)&&(l=s),s=s.next;while(s!==u);return l}function w5(u,s,l,p,m,_,v,w){return(m-v)*(s-w)>=(u-v)*(_-w)&&(u-v)*(p-w)>=(l-v)*(s-w)&&(l-v)*(_-w)>=(m-v)*(p-w)}function kw(u,s,l,p,m,_,v,w){return!(u===v&&s===w)&&w5(u,s,l,p,m,_,v,w)}function Vde(u,s){return u.next.i!==s.i&&u.prev.i!==s.i&&!function(l,p){let m=l;do{if(m.i!==l.i&&m.next.i!==l.i&&m.i!==p.i&&m.next.i!==p.i&&S5(m,m.next,l,p))return!0;m=m.next}while(m!==l);return!1}(u,s)&&(Pw(u,s)&&Pw(s,u)&&function(l,p){let m=l,_=!1;const v=(l.x+p.x)/2,w=(l.y+p.y)/2;do m.y>w!=m.next.y>w&&m.next.y!==m.y&&v<(m.next.x-m.x)*(w-m.y)/(m.next.y-m.y)+m.x&&(_=!_),m=m.next;while(m!==l);return _}(u,s)&&(bo(u.prev,u,s.prev)||bo(u,s.prev,s))||xx(u,s)&&bo(u.prev,u,u.next)>0&&bo(s.prev,s,s.next)>0)}function bo(u,s,l){return(s.y-u.y)*(l.x-s.x)-(s.x-u.x)*(l.y-s.y)}function xx(u,s){return u.x===s.x&&u.y===s.y}
vendor: 15,152 bytes, line 814
814function S5(u,s,l,p){const m=B2(bo(u,s,l)),_=B2(bo(u,s,p)),v=B2(bo(l,p,u)),w=B2(bo(l,p,s));return m!==_&&v!==w||!(m!==0||!F2(u,l,s))||!(_!==0||!F2(u,p,s))||!(v!==0||!F2(l,u,p))||!(w!==0||!F2(l,s,p))}function F2(u,s,l){return s.x<=Math.max(u.x,l.x)&&s.x>=Math.min(u.x,l.x)&&s.y<=Math.max(u.y,l.y)&&s.y>=Math.min(u.y,l.y)}function B2(u){return u>0?1:u<0?-1:0}function Pw(u,s){return bo(u.prev,u,u.next)<0?bo(u,s,u.next)>=0&&bo(u,u.prev,s)>=0:bo(u,s,u.prev)<0||bo(u,u.next,s)<0}function T5(u,s){const l=OD(u.i,u.x,u.y),p=OD(s.i,s.x,s.y),m=u.next,_=s.prev;return u.next=s,s.prev=u,l.next=m,m.prev=l,p.next=l,l.prev=p,_.next=p,p.prev=_,p}function C5(u,s,l,p){const m=OD(u,s,l);return p?(m.next=p.next,m.prev=p,p.next.prev=m,p.next=m):(m.prev=m,m.next=m),m}function Nw(u){u.next.prev=u.prev,u.prev.next=u.next,u.prevZ&&(u.prevZ.nextZ=u.nextZ),u.nextZ&&(u.nextZ.prevZ=u.prevZ)}function OD(u,s,l){return{i:u,x:s,y:l,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Mw(u,s){const l=u.length;if(l<=1)return[u];const p=[];let m,_;for(let v=0;v<l;v++){const w=ln(u[v]);w!==0&&(u[v].area=Math.abs(w),_===void 0&&(_=w<0),_===w<0?(m&&p.push(m),m=[u[v]]):m.push(u[v]))}if(m&&p.push(m),s>1)for(let v=0;v<p.length;v++)p[v].length<=s||(Xu(p[v],s,1,p[v].length-1,$de),p[v]=p[v].slice(0,s));return p}function $de(u,s){return s.area-u.area}function E5(u,s,l=1){if(!u)return null;const p=typeof u=="string"?Ya.from(u).getPrimary():u.getPrimary(),m=typeof u=="string"?null:u.getSecondary();for(const _ of[p,m]){if(!_)continue;const v=_.id.toString();s.has(v)||s.set(v,[]),_.scaleSelf(l),s.get(v).push(_)}return{primary:p.toString(),secondary:m?m.toString():null}}function FD(u,s,l,p){const m=p.patternDependencies;let _=!1;for(const v of s){const w=v.paint.get(`${u}-pattern`);w.isConstant()||(_=!0),E5(w.constantOr(null),m,l)&&(_=!0)}return _}function BD(u,s,l,p,m,_){const v=_.patternDependencies;for(const w of s){const A=w.paint.get(`${u}-pattern`).value;if(A.kind!=="constant"){let k=A.evaluate({zoom:p},l,{},_.availableImages);k=k&&k.name?k.name:k;const R=E5(k,v,m);if(!R)continue;const{primary:j,secondary:z}=R;j&&(l.patterns[w.id]=[j,z].filter(Boolean))}}return l}class A5{constructor(){this.polygons=new Map}add(s,...l){const p=this.polygons.get(s);p?p.push(...l):this.polygons.set(s,l)}merge(s){for(const[l,p]of s.polygons)this.add(l,...p)}}class xp{constructor(){this.portals=[]}static isOnBorder(s,l){return s<=0&&l<=0||s>=Ft&&l>=Ft}static evaluate(s){if(s.length===0)return new xp;let l=[];for(const A of s)l.push(...A.portals);if(l.length===0)return new xp;for(const A of l){const k=A.va,R=A.vb;(xp.isOnBorder(k.x,R.x)||xp.isOnBorder(k.y,R.y))&&(A.type="border")}const p=l.filter(A=>A.type!=="unevaluated"),m=l.filter(A=>A.type==="unevaluated");if(m.length===0)return new xp;m.sort((A,k)=>A.hash===k.hash?A.isTunnel===k.isTunnel?0:A.isTunnel?-1:1:A.hash<k.hash?1:-1),l=p.concat(m);let _=p.length,v=_,w=_;do if(v++,v===l.length||l[_].hash!==l[v].hash){if(v-_==2){w<_&&(l[w]=l[_],l[_]=null);const A=l[w],k=l[v-1];A.type=A.isTunnel!==k.isTunnel?"tunnel":"polygon",A.connection={a:A.connection.a,b:k.connection.a},w++}_=v}while(_!==l.length);return l.splice(w),l.sort((A,k)=>A.hash<k.hash?1:-1),{portals:l}}}ri(xp,"ElevationPortalGraph"),ri(A5,"ElevationPolygons");class qde{constructor(s,l,p){this.outPositions=s,this.outNormals=l,this.outIndices=p,this.vertexLookup=new Map}addVertex(s,l,p){let m=s[2];p!=null&&(m*=p);const _=`${s[0]},${s[1]},${s[2]},${l[0]},${l[1]},${l[2]}`,v=this.vertexLookup.get(_);if(v!=null)return v;const w=this.outPositions.length;this.vertexLookup.set(_,w);const A=Math.trunc(16384*l[0]),k=Math.trunc(16384*l[1]),R=Math.trunc(16384*l[2]);return this.outPositions.emplaceBack(s[0],s[1],m),this.outNormals.emplaceBack(A,k,R),w}addTriangle(s,l,p){this.outIndices.emplaceBack(s,l,p)}addTriangles(s,l,p){if(s.length===0)return;const m=p.length===1,_=dt(),v=dt();for(let w=0;w<s.length;w+=3){const A=l[s[w+0]],k=l[s[w+1]],R=l[s[w+2]],j=m?p[0]:p[s[w+1]],z=m?p[0]:p[s[w+2]];Vt(_,A.x,A.y,m?p[0]:p[s[w+0]]);const U=this.addVertex(_,v);Vt(_,k.x,k.y,j);const q=this.addVertex(_,v);Vt(_,R.x,R.y,z);const X=this.addVertex(_,v);this.outIndices.emplaceBack(U,q,X)}}addQuad(s,l,p,m,_,v){const w=this.addVertex(s,_,v),A=this.addVertex(l,_,v),k=this.addVertex(p,_,v),R=this.addVertex(m,_,v);this.addTriangle(w,A,k),this.addTriangle(k,R,w)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class $l{constructor(s,l,p,m){this.unevaluatedPortals=new xp,this.portalPolygons=new A5,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new lw,this.vertexNormals=new cw,this.indexArray=new Xr,this.tileToMeters=ke(s),this.bridgeProgramConfigurations=new Gc(l,{zoom:p,lut:m},_=>_!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Gc(l,{zoom:p,lut:m},_=>_!=="fill-bridge-guard-rail-color")}addVertices(s,l){const p=this.unevalVertices.length;for(let m=0;m<s.length;m++)this.unevalVertices.push(s[m]),this.unevalHeights.push(l[m]);return p}addTriangles(s,l,p){const m=p?this.unevalTunnelTriangles:this.unevalTriangles;for(const _ of s)m.push(_+l)}addRenderableRing(s,l,p,m,_,v){const w=[new Tt(_.min.x,_.min.y),new Tt(_.max.x,_.min.y),new Tt(_.max.x,_.max.y),new Tt(_.min.x,_.max.y)];for(let A=0;A<p-1;A++){const k=l+A,R=k+1,j=this.unevalVertices[k],z=this.unevalVertices[R];if(!(j.x>=_.min.x&&j.x<=_.max.x&&j.y>=_.min.y&&j.y<=_.max.y||z.x>=_.min.x&&z.x<=_.max.x&&z.y>=_.min.y&&z.y<=_.max.y||Ns(j,z,w))||this.isOnBorder(j.x,z.x)||this.isOnBorder(j.y,z.y))continue;const U=$l.computeEdgeHash(this.unevalVertices[k],this.unevalVertices[R]);let q,X=this.vertexHashLookup.get($l.computePosHash(j));X!=null?q=X.next:(X=this.vertexHashLookup.get($l.computePosHash(z)),q=X!=null?X.prev:U),this.unevalEdges.push({polygonIdx:s,a:k,b:R,hash:U,portalHash:q,isTunnel:m,type:"unevaluated",featureInfo:v})}}addPortalCandidates(s,l,p,m,_){if(l.length===0)return;this.portalPolygons.add(s,{geometry:l,zLevel:_});const v=l[0];this.vertexHashLookup.clear();let w=$l.computeEdgeHash(v[v.length-2],v[v.length-1]);for(let A=0;A<v.length-1;A++){const k=v[A+0],R=v[A+1],j=co(R.x-k.x,R.y-k.y),z=bn(j);if(z===0)continue;let U="unevaluated";const q=m.pointElevation(k),X=m.pointElevation(R);Math.abs(q)<.01&&Math.abs(X)<.01?U="entrance":(this.isOnBorder(k.x,R.x)||this.isOnBorder(k.y,R.y))&&(U="border");const Q=$l.computeEdgeHash(k,R);this.unevaluatedPortals.portals.push({connection:{a:s,b:void 0},va:k,vb:R,vab:j,length:z,hash:Q,isTunnel:p,type:U});const ee=$l.computePosHash(k);this.vertexHashLookup.set(ee,{prev:w,next:Q}),w=Q}}construct(s){if(this.unevalVertices.length===0)return;const l=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),p=z=>{z.primitiveLength=this.indexArray.length-z.primitiveOffset},m=new qde(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(s.portals,this.unevalEdges);const _=l(),v=l(),w=l(),A=(z,U)=>{z.sort((X,Q)=>X.type===U&&Q.type!==U?-1:X.type!==U&&Q.type===U?1:0);const q=z.findIndex(X=>X.type!==U);return q>=0?q:z.length};let k=0;this.unevalEdges.length>0&&(k=A(this.unevalEdges,"none"),this.constructBridgeStructures(m,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:k},this.tileToMeters)),p(w);const R=l(),j=l();if(this.unevalEdges.length>0){const z=this.unevalEdges.splice(k),U=A(z,"tunnel")+k;this.unevalEdges.push(...z),this.constructTunnelStructures(m,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:k},{min:k,max:U})}p(R),m.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),p(j),m.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),p(v),m.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),p(_),this.maskSegments=ls.simpleSegment(0,j.primitiveOffset,0,j.primitiveLength),this.depthSegments=ls.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.renderableBridgeSegments=ls.simpleSegment(0,w.primitiveOffset,0,w.primitiveLength),this.renderableTunnelSegments=ls.simpleSegment(0,R.primitiveOffset,0,R.primitiveLength),this.shadowCasterSegments=ls.simpleSegment(0,_.primitiveOffset,0,_.primitiveLength)}update(s,l,p,m,_,v,w,A){this.bridgeProgramConfigurations.updatePaintArrays(s,l,_,p,m,v,w,A),this.tunnelProgramConfigurations.updatePaintArrays(s,l,_,p,m,v,w,A)}upload(s){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=s.createVertexBuffer(this.vertexPositions,Mde.members),this.vertexBufferNormal=s.createVertexBuffer(this.vertexNormals,Dde.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(s),this.tunnelProgramConfigurations.upload(s))}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(s,l,p,m,_){const v=(w,A)=>{for(let k=0;k<A.length-1;k++){const R=A[k].featureIndex,j=A[k+1].vertexStart,z=s.feature(R);w.populatePaintArrays(j,z,R,{},p,l,m,void 0,_)}};v(this.bridgeProgramConfigurations,this.bridgeFeatureSections),v(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(s,l,p,m,_){const v=new Map;for(let w=m;w<_;w++){const A=p[w],k=A.a,R=A.b,j=$l.computePosHash(s[k]),z=$l.computePosHash(s[R]);let U=v.get(j);U||(U={},v.set(j,U));let q=v.get(z);q||(q={},v.set(z,q)),l[k]<=0&&l[R]<=0||(U.to=R,q.from=k)}return v}isTerminalVertex(s,l){const p=$l.computePosHash(this.unevalVertices[s]),m=l.get(p);return!m||!m.from||!m.to}constructBridgeStructures(s,l,p,m,_,v){s.clearVertexLookup();const w=this.computeVertexConnections(l,p,m,_.min,_.max),A=1/v,k=.5*A,R=(zt,Et)=>Vt(zt,l[Et].x,l[Et].y,p[Et]*A),j=dt(),z=dt(),U=dt(),q=dt(),X=dt(),Q=(zt,Et)=>{const vt=w.get($l.computePosHash(l[Et])),Ct=vt.from,at=vt.to;if(!Ct||!at)return;R(j,Ct),R(z,Et),R(U,at),Kr(q),rs(j,z)||(Yn(X,z,j),Ei(q,X)),rs(U,z)||(Yn(X,U,z),Fe(q,q,Ei(X,X)));const st=Ia(q);return st>0?Ot(zt,q,1/st):void 0};let ee=Number.POSITIVE_INFINITY;this.sortSubarray(m,_.min,_.max,(zt,Et)=>zt.featureInfo.featureIndex-Et.featureInfo.featureIndex);const oe=dt(),le=dt(),de=dt(),Ae=dt(),xe=dt(),Me=dt(),Le=dt(),Be=dt(),ut=dt(),Xe=[dt(),dt(),dt(),dt()],ht=[dt(),dt(),dt(),dt()],_t=[{coord:new Tt(0,0),height:0},{coord:new Tt(0,0),height:0}],bt=(zt,Et)=>zt>Et;for(let zt=_.min;zt<_.max;zt++){const Et=m[zt];if(!Et.featureInfo.guardRailEnabled||!this.prepareEdgePoints(_t,l,p,Et,bt))continue;const[vt,Ct]=_t;if(Vt(oe,vt.coord.x,vt.coord.y,A*vt.height),Vt(le,Ct.coord.x,Ct.coord.y,A*Ct.height),rs(oe,le))continue;Yn(de,le,oe),Ei(de,de);const at=Q(Be,Et.a)||de,st=Q(ut,Et.b)||de;Vt(Ae,at[1],-at[0],0),Ei(Ae,Ae),Vt(xe,st[1],-st[0],0),Ei(xe,xe),Xi(Be,Ae,at),Ei(Me,Be),Xi(Be,xe,st),Ei(Le,Be),Fe(Xe[0],oe,Ot(Be,Yn(Be,Ae,Me),k)),Fe(Xe[1],oe,Ot(Be,Fe(Be,Ae,Me),k)),Fe(Xe[2],oe,Ot(Be,Me,k)),Xe[3]=oe,Fe(ht[0],le,Ot(Be,Yn(Be,xe,Le),k)),Fe(ht[1],le,Ot(Be,Fe(Be,xe,Le),k)),Fe(ht[2],le,Ot(Be,Le,k)),ht[3]=le,ee=this.addFeatureSection(Et.featureInfo.featureIndex,ee,this.bridgeFeatureSections,s);const St=s.addVertex(Xe[0],Ae,v),Dt=s.addVertex(Xe[1],Ae,v),xt=s.addVertex(ht[0],xe,v),ni=s.addVertex(ht[1],xe,v);s.addTriangle(St,Dt,xt),s.addTriangle(Dt,ni,xt);const ai=s.addVertex(Xe[1],Me,v),Qt=s.addVertex(Xe[2],Me,v),Ht=s.addVertex(ht[1],Le,v),Zi=s.addVertex(ht[2],Le,v);s.addTriangle(ai,Qt,Ht),s.addTriangle(Qt,Zi,Ht),Oi(Ae,Ae),Oi(xe,xe);const Kt=s.addVertex(Xe[2],Ae,v),Ii=s.addVertex(Xe[3],Ae,v),tn=s.addVertex(ht[2],xe,v),yn=s.addVertex(ht[3],xe,v);s.addTriangle(Kt,Ii,tn),s.addTriangle(Ii,yn,tn);const Un=this.isTerminalVertex(Et.a,w),sn=this.isTerminalVertex(Et.b,w);vt.height<.01&&Un&&s.addQuad(Xe[3],Xe[2],Xe[1],Xe[0],Oi(at,at),v),Ct.height<.01&&sn&&s.addQuad(ht[0],ht[1],ht[2],ht[3],st,v)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:s.getVertexCount()})}constructTunnelStructures(s,l,p,m,_,v){s.clearVertexLookup();let w=Number.POSITIVE_INFINITY;const A=(ee,oe)=>ee.featureInfo.featureIndex-oe.featureInfo.featureIndex;this.sortSubarray(m,_.min,_.max,A),this.sortSubarray(m,v.min,v.max,A);const k=ee=>Ei(ee,ee),R=[{coord:new Tt(0,0),height:0},{coord:new Tt(0,0),height:0}],j=(ee,oe)=>ee<oe,z=dt(),U=dt(),q=dt(),X=dt(),Q=dt();for(let ee=_.min;ee<_.max;ee++){if(!this.prepareEdgePoints(R,l,p,m[ee],j))continue;const[oe,le]=R,de=k(Vt(Q,-(le.coord.y-oe.coord.y),le.coord.x-oe.coord.x,0));w=this.addFeatureSection(m[ee].featureInfo.featureIndex,w,this.tunnelFeatureSections,s),s.addQuad(Vt(z,oe.coord.x,oe.coord.y,oe.height),Vt(U,le.coord.x,le.coord.y,le.height),Vt(q,le.coord.x,le.coord.y,m[ee].isTunnel?-.1:0),Vt(X,oe.coord.x,oe.coord.y,m[ee].isTunnel?-.1:0),de)}for(let ee=v.min;ee<v.max;ee++){const oe=m[ee];oe.isTunnel&&([oe.a,oe.b]=[oe.b,oe.a]);const le=l[oe.a],de=l[oe.b],Ae=k(Vt(Q,-(de.y-le.y),de.x-le.x,0));w=this.addFeatureSection(oe.featureInfo.featureIndex,w,this.tunnelFeatureSections,s),s.addQuad(Vt(z,de.x,de.y,0),Vt(U,le.x,le.y,0),Vt(q,le.x,le.y,p[oe.a]+4),Vt(X,de.x,de.y,p[oe.b]+4),Ae),s.addQuad(Vt(z,le.x,le.y,0),Vt(U,de.x,de.y,0),Vt(q,de.x,de.y,p[oe.b]+4),Vt(X,le.x,le.y,p[oe.a]+4),Ae)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:s.getVertexCount()})}setElevatedPoint(s,l,p,m){s.coord.x=l,s.coord.y=p,s.height=m}prepareEdgePoints(s,l,p,m,_){let v=l[m.a].x,w=l[m.a].y,A=l[m.b].x,k=l[m.b].y,R=p[m.a],j=p[m.b];const z=_(R,0),U=_(j,0);if(z&&U)return this.setElevatedPoint(s[0],v,w,R),this.setElevatedPoint(s[1],A,k,j),!0;if(!z&&!U)return!1;if(z){if(!U){const q=j/(j-R);A=Vi(A,v,q),k=Vi(k,w,q),j=Vi(j,R,q)}}else{const q=R/(R-j);v=Vi(v,A,q),w=Vi(w,k,q),R=Vi(R,j,q)}return this.setElevatedPoint(s[0],v,w,R),this.setElevatedPoint(s[1],A,k,j),!0}prepareEdges(s,l){if(l.length===0)return;l.sort((w,A)=>w.hash===A.hash?A.polygonIdx-w.polygonIdx:A.hash>w.hash?1:-1);let p=0,m=0,_=0,v=l[p].polygonIdx;do m++,(m===l.length||l[p].hash!==l[m].hash)&&((m-p==1||l[m-1].polygonIdx!==v)&&(_<p&&(l[_]=l[p],l[p]=null),l[_].type="none",_++),p=m,p!==l.length&&(v=l[p].polygonIdx));while(p!==l.length);if(l.splice(_),l.length!==0&&s.length!==0){l.sort((k,R)=>k.portalHash<R.portalHash?1:-1);let w=0,A=0;for(;w!==l.length&&A!==s.length;){const k=l[w],R=s[A];k.portalHash>R.hash?w++:R.hash>k.portalHash?A++:(k.type=R.type,w++)}}}isOnBorder(s,l){return s<=0&&l<=0||s>=Ft&&l>=Ft}addFeatureSection(s,l,p,m){return s!==l&&(l=s,p.push({featureIndex:s,vertexStart:m.getVertexCount()}),m.clearVertexLookup()),l}sortSubarray(s,l,p,m){const _=s.slice(l,p);_.sort(m),s.splice(l,_.length,..._)}static computeEdgeHash(s,l){return(s.y===l.y&&s.x>l.x||s.y>l.y)&&([s,l]=[l,s]),BigInt($l.computePosHash(s))<<32n|BigInt($l.computePosHash(l))}static computePosHash(s){return((65535&s.x)<<16|65535&s.y)>>>0}}
814var I5,k5={exports:{}},P5=(I5||(I5=1,function(u,s){(function(l){function p(be,ye){return be>ye?1:be<ye?-1:0}var m=function(be,ye){be===void 0&&(be=p),ye===void 0&&(ye=!1),this._compare=be,this._root=null,this._size=0,this._noDuplicates=!!ye},_={size:{configurable:!0}};function v(be,ye,ft,Ut,mt){var Gt=mt-Ut;if(Gt>0){var yi=Ut+Math.floor(Gt/2),fi={key:ye[yi],data:ft[yi],parent:be};return fi.left=v(fi,ye,ft,Ut,yi),fi.right=v(fi,ye,ft,yi+1,mt),fi}return null}function w(be,ye,ft,Ut,mt){if(!(ft>=Ut)){for(var Gt=be[ft+Ut>>1],yi=ft-1,fi=Ut+1;;){do yi++;while(mt(be[yi],Gt)<0);do fi--;while(mt(be[fi],Gt)>0);if(yi>=fi)break;var cn=be[yi];be[yi]=be[fi],be[fi]=cn,cn=ye[yi],ye[yi]=ye[fi],ye[fi]=cn}w(be,ye,ft,fi,mt),w(be,ye,fi+1,Ut,mt)}}m.prototype.rotateLeft=function(be){var ye=be.right;ye&&(be.right=ye.left,ye.left&&(ye.left.parent=be),ye.parent=be.parent),be.parent?be===be.parent.left?be.parent.left=ye:be.parent.right=ye:this._root=ye,ye&&(ye.left=be),be.parent=ye},m.prototype.rotateRight=function(be){var ye=be.left;ye&&(be.left=ye.right,ye.right&&(ye.right.parent=be),ye.parent=be.parent),be.parent?be===be.parent.left?be.parent.left=ye:be.parent.right=ye:this._root=ye,ye&&(ye.right=be),be.parent=ye},m.prototype._splay=function(be){for(;be.parent;){var ye=be.parent;ye.parent?ye.left===be&&ye.parent.left===ye?(this.rotateRight(ye.parent),this.rotateRight(ye)):ye.right===be&&ye.parent.right===ye?(this.rotateLeft(ye.parent),this.rotateLeft(ye)):ye.left===be&&ye.parent.right===ye?(this.rotateRight(ye),this.rotateLeft(ye)):(this.rotateLeft(ye),this.rotateRight(ye)):ye.left===be?this.rotateRight(ye):this.rotateLeft(ye)}},m.prototype.splay=function(be){for(var ye,ft,Ut,mt,Gt;be.parent;)(ft=(ye=be.parent).parent)&&ft.parent?((Ut=ft.parent).left===ft?Ut.left=be:Ut.right=be,be.parent=Ut):(be.parent=null,this._root=be),mt=be.left,Gt=be.right,be===ye.left?(ft&&(ft.left===ye?(ye.right?(ft.left=ye.right,ft.left.parent=ft):ft.left=null,ye.right=ft,ft.parent=ye):(mt?(ft.right=mt,mt.parent=ft):ft.right=null,be.left=ft,ft.parent=be)),Gt?(ye.left=Gt,Gt.parent=ye):ye.left=null,be.right=ye,ye.parent=be):(ft&&(ft.right===ye?(ye.left?(ft.right=ye.left,ft.right.parent=ft):ft.right=null,ye.left=ft,ft.parent=ye):(Gt?(ft.left=Gt,Gt.parent=ft):ft.left=null,be.right=ft,ft.parent=be)),mt?(ye.right=mt,mt.parent=ye):ye.right=null,be.left=ye,ye.parent=be)},m.prototype.replace=function(be,ye){be.parent?be===be.parent.left?be.parent.left=ye:be.parent.right=ye:this._root=ye,ye&&(ye.parent=be.parent)},m.prototype.minNode=function(be){if(be===void 0&&(be=this._root),be)for(;be.left;)be=be.left;return be},m.prototype.maxNode=function(be){if(be===void 0&&(be=this._root),be)for(;be.right;)be=be.right;return be},m.prototype.insert=function(be,ye){var ft=this._root,Ut=null,mt=this._compare;if(this._noDuplicates)for(;ft;){if(Ut=ft,mt(ft.key,be)===0)return;ft=mt(ft.key,be)<0?ft.right:ft.left}else for(;ft;)Ut=ft,ft=mt(ft.key,be)<0?ft.right:ft.left;return ft={key:be,data:ye,left:null,right:null,parent:Ut},Ut?mt(Ut.key,ft.key)<0?Ut.right=ft:Ut.left=ft:this._root=ft,this.splay(ft),this._size++,ft},m.prototype.find=function(be){for(var ye=this._root,ft=this._compare;ye;){var Ut=ft(ye.key,be);if(Ut<0)ye=ye.right;else{if(!(Ut>0))return ye;ye=ye.left}}return null},m.prototype.contains=function(be){for(var ye=this._root,ft=this._compare;ye;){var Ut=ft(be,ye.key);if(Ut===0)return!0;ye=Ut<0?ye.left:ye.right}return!1},m.prototype.remove=function(be){var ye=this.find(be);if(!ye)return!1;if(this.splay(ye),ye.left)if(ye.right){var ft=this.minNode(ye.right);ft.parent!==ye&&(this.replace(ft,ft.right),ft.right=ye.right,ft.right.parent=ft),this.replace(ye,ft),ft.left=ye.left,ft.left.parent=ft}else this.replace(ye,ye.left);else this.replace(ye,ye.right);return this._size--,!0},m.prototype.removeNode=function(be){if(!be)return!1;if(this.splay(be),be.left)if(be.right){var ye=this.minNode(be.right);ye.parent!==be&&(this.replace(ye,ye.right),ye.right=be.right,ye.right.parent=ye),this.replace(be,ye),ye.left=be.left,ye.left.parent=ye}else this.replace(be,be.left);else this.replace(be,be.right);return this._size--,!0}
814,m.prototype.erase=function(be){var ye=this.find(be);if(ye){this.splay(ye);var ft=ye.left,Ut=ye.right,mt=null;ft&&(ft.parent=null,mt=this.maxNode(ft),this.splay(mt),this._root=mt),Ut&&(ft?mt.right=Ut:this._root=Ut,Ut.parent=mt),this._size--}},m.prototype.pop=function(){var be=this._root,ye=null;if(be){for(;be.left;)be=be.left;ye={key:be.key,data:be.data},this.remove(be.key)}return ye},m.prototype.next=function(be){var ye=be;if(ye)if(ye.right)for(ye=ye.right;ye&&ye.left;)ye=ye.left;else for(ye=be.parent;ye&&ye.right===be;)be=ye,ye=ye.parent;return ye},m.prototype.prev=function(be){var ye=be;if(ye)if(ye.left)for(ye=ye.left;ye&&ye.right;)ye=ye.right;else for(ye=be.parent;ye&&ye.left===be;)be=ye,ye=ye.parent;return ye},m.prototype.forEach=function(be){for(var ye=this._root,ft=[],Ut=!1,mt=0;!Ut;)ye?(ft.push(ye),ye=ye.left):ft.length>0?(be(ye=ft.pop(),mt++),ye=ye.right):Ut=!0;return this},m.prototype.range=function(be,ye,ft,Ut){for(var mt=[],Gt=this._compare,yi=this._root;mt.length!==0||yi;)if(yi)mt.push(yi),yi=yi.left;else{if(Gt((yi=mt.pop()).key,ye)>0)break;if(Gt(yi.key,be)>=0&&ft.call(Ut,yi))return this;yi=yi.right}return this},m.prototype.keys=function(){for(var be=this._root,ye=[],ft=[],Ut=!1;!Ut;)be?(ye.push(be),be=be.left):ye.length>0?(be=ye.pop(),ft.push(be.key),be=be.right):Ut=!0;return ft},m.prototype.values=function(){for(var be=this._root,ye=[],ft=[],Ut=!1;!Ut;)be?(ye.push(be),be=be.left):ye.length>0?(be=ye.pop(),ft.push(be.data),be=be.right):Ut=!0;return ft},m.prototype.at=function(be){for(var ye=this._root,ft=[],Ut=!1,mt=0;!Ut;)if(ye)ft.push(ye),ye=ye.left;else if(ft.length>0){if(ye=ft.pop(),mt===be)return ye;mt++,ye=ye.right}else Ut=!0;return null},m.prototype.load=function(be,ye,ft){if(be===void 0&&(be=[]),ye===void 0&&(ye=[]),ft===void 0&&(ft=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var Ut=be.length;return ft&&w(be,ye,0,Ut-1,this._compare),this._root=v(null,be,ye,0,Ut),this._size=Ut,this},m.prototype.min=function(){var be=this.minNode(this._root);return be?be.key:null},m.prototype.max=function(){var be=this.maxNode(this._root);return be?be.key:null},m.prototype.isEmpty=function(){return this._root===null},_.size.get=function(){return this._size},m.createTree=function(be,ye,ft,Ut,mt){return new m(ft,mt).load(be,ye,Ut)},Object.defineProperties(m.prototype,_);var A=0,k=1,R=2,j=3,z=0,U=1,q=2,X=3;function Q(be,ye,ft){ye===null?(be.inOut=!1,be.otherInOut=!0):(be.isSubject===ye.isSubject?(be.inOut=!ye.inOut,be.otherInOut=ye.otherInOut):(be.inOut=!ye.otherInOut,be.otherInOut=ye.isVertical()?!ye.inOut:ye.inOut),ye&&(be.prevInResult=!ee(ye,ft)||ye.isVertical()?ye.prevInResult:ye));var Ut=ee(be,ft);be.resultTransition=Ut?function(mt,Gt){var yi,fi=!mt.inOut,cn=!mt.otherInOut;switch(Gt){case z:yi=fi&&cn;break;case U:yi=fi||cn;break;case X:yi=fi^cn;break;case q:yi=mt.isSubject?fi&&!cn:cn&&!fi}return yi?1:-1}(be,ft):0}function ee(be,ye){switch(be.type){case A:switch(ye){case z:return!be.otherInOut;case U:return be.otherInOut;case q:return be.isSubject&&be.otherInOut||!be.isSubject&&!be.otherInOut;case X:return!0}break;case R:return ye===z||ye===U;case j:return ye===q;case k:return!1}return!1}var oe=function(be,ye,ft,Ut,mt){this.left=ye,this.point=be,this.otherEvent=ft,this.isSubject=Ut,this.type=mt||A,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},le={inResult:{configurable:!0}};function de(be,ye){return be[0]===ye[0]&&be[1]===ye[1]}oe.prototype.isBelow=function(be){var ye=this.point,ft=this.otherEvent.point;return this.left?(ye[0]-be[0])*(ft[1]-be[1])-(ft[0]-be[0])*(ye[1]-be[1])>0:(ft[0]-be[0])*(ye[1]-be[1])-(ye[0]-be[0])*(ft[1]-be[1])>0},oe.prototype.isAbove=function(be){return!this.isBelow(be)},oe.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},le.inResult.get=function(){return this.resultTransition!==0},oe.prototype.clone=function(){var be=new oe(this.point,this.left,this.otherEvent,this.isSubject,this.type);return be.contourId=this.contourId,be.resultTransition=this.resultTransition,be.prevInResult=this.prevInResult,be.isExteriorRing=this.isExteriorRing,be.inOut=this.inOut,be.otherInOut=this.otherInOut,be},Object.defineProperties(oe.prototype,le);var Ae=11102230246251565e-32,xe=134217729,Me=(3+8*Ae)*Ae;function Le(be,ye,ft,Ut,mt){var Gt,yi,fi,cn,Fi=ye[0],ui=Ut[0],Kn=0,Cr=0;ui>Fi==ui>-Fi?(Gt=Fi,Fi=ye[++Kn]):(Gt=ui,ui=Ut[++Cr]);var Ui=0;if(Kn<be&&Cr<ft)for(ui>Fi==ui>-Fi?(fi=Gt-((yi=Fi+Gt)-Fi),Fi=ye[++Kn]):(fi=Gt-((yi=ui+Gt)-ui),ui=Ut[++Cr]),Gt=yi,fi!==0&&(mt[Ui++]=fi);Kn<be&&Cr<ft;)ui>Fi==ui>-Fi?(fi=Gt-((yi=Gt+Fi)-(cn=yi-Gt))+(Fi-cn),Fi=ye[++Kn]):(fi=Gt-((yi=Gt+ui)-(cn=yi-Gt))+(ui-cn),ui=Ut[++Cr]),Gt=yi,fi!==0&&(mt[Ui++]=fi);for(;Kn<be;)fi=Gt-((yi=Gt+Fi)-(cn=yi-Gt))+(Fi-cn),Fi=ye[++Kn],Gt=yi,fi!==0&&(mt[Ui++]=fi);for(;Cr<ft;)fi=Gt-((yi=Gt+ui)-(cn=yi-Gt))+(ui-cn),ui=Ut[++Cr],Gt=yi,fi!==0&&(mt[Ui++]=fi);return Gt===0&&Ui!==0||(mt[Ui++]=Gt),Ui}function Be(be){return new Float64Array(be)}var ut=33306690738754716e-32,Xe=22204460492503146e-32,ht=11093356479670487e-47,_t=Be(4),bt=Be(8),zt=Be(12),Et=Be(16),vt=Be(4);function Ct(be,ye,ft){var Ut=function(mt,Gt,yi,fi,cn,Fi){var ui=(Gt-Fi)*(yi-cn),Kn=(mt-cn)*(fi-Fi),Cr=ui-Kn;if(ui===0||Kn===0||ui>0!=Kn>0)return Cr;var Ui=Math.abs(ui+Kn);return Math.abs(Cr)>=ut*Ui?Cr:-function(On,Er,cr,ys,qr,Nr,mr){var er,un,tr,Mr,Bi,Vn,Hr,As,js,eo,Gr,Hs,yl,Gs,Hl,aa,Kc,_l,Gl=On-qr,la=cr-qr,Wl=Er-Nr,Zc=ys-Nr;_t[0]=(Hl=(As=Gl-(Hr=(Vn=xe*Gl)-(Vn-Gl)))*(eo=Zc-(js=(Vn=xe*Zc)-(Vn-Zc)))-((Gs=Gl*Zc)-Hr*js-As*js-Hr*eo))-((Gr=Hl-(Kc=(As=Wl-(Hr=(Vn=xe*Wl)-(Vn-Wl)))*(eo=la-(js=(Vn=xe*la)-(Vn-la)))-((aa=Wl*la)-Hr*js-As*js-Hr*eo)))+(Bi=Hl-Gr))+(Bi-Kc),_t[1]=(yl=Gs-((Hs=Gs+Gr)-(Bi=Hs-Gs))+(Gr-Bi))-((Gr=yl-aa)+(Bi=yl-Gr))+(Bi-aa),_t[2]=Hs-((_l=Hs+Gr)-(Bi=_l-Hs))+(Gr-Bi),_t[3]=_l;var Lo=function(am,hh){for(var kA=hh[0],Fx=1;Fx<4;Fx++)kA+=hh[Fx];return kA}(0,_t),Da=Xe*mr;if(Lo>=Da||-Lo>=Da||(er=On-(Gl+(Bi=On-Gl))+(Bi-qr),tr=cr-(la+(Bi=cr-la))+(Bi-qr),un=Er-(Wl+(Bi=Er-Wl))+(Bi-Nr),Mr=ys-(Zc+(Bi=ys-Zc))+(Bi-Nr),er===0&&un===0&&tr===0&&Mr===0)||(Da=ht*mr+Me*Math.abs(Lo),(Lo+=Gl*Mr+Zc*er-(Wl*tr+la*un))>=Da||-Lo>=Da))return Lo;vt[0]=(Hl=(As=er-(Hr=(Vn=xe*er)-(Vn-er)))*(eo=Zc-(js=(Vn=xe*Zc)-(Vn-Zc)))-((Gs=er*Zc)-Hr*js-As*js-Hr*eo))-((Gr=Hl-(Kc=(As=un-(Hr=(Vn=xe*un)-(Vn-un)))*(eo=la-(js=(Vn=xe*la)-(Vn-la)))-((aa=un*la)-Hr*js-As*js-Hr*eo)))+(Bi=Hl-Gr))+(Bi-Kc),vt[1]=(yl=Gs-((Hs=Gs+Gr)-(Bi=Hs-Gs))+(Gr-Bi))-((Gr=yl-aa)+(Bi=yl-Gr))+(Bi-aa),vt[2]=Hs-((_l=Hs+Gr)-(Bi=_l-Hs))+(Gr-Bi),vt[3]=_l;var dh=Le(4,_t,4,vt,bt);vt[0]=(Hl=(As=Gl-(Hr=(Vn=xe*Gl)-(Vn-Gl)))*(eo=Mr-(js=(Vn=xe*Mr)-(Vn-Mr)))-((Gs=Gl*Mr)-Hr*js-As*js-Hr*eo))-((Gr=Hl-(Kc=(As=Wl-(Hr=(Vn=xe*Wl)-(Vn-Wl)))*(eo=tr-(js=(Vn=xe*tr)-(Vn-tr)))-((aa=Wl*tr)-Hr*js-As*js-Hr*eo)))+(Bi=Hl-Gr))+(Bi-Kc),vt[1]=(yl=Gs-((Hs=Gs+Gr)-(Bi=Hs-Gs))+(Gr-Bi))-((Gr=yl-aa)+(Bi=yl-Gr))+(Bi-aa),vt[2]=Hs-((_l=Hs+Gr)-(Bi=_l-Hs))+(Gr-Bi),vt[3]=_l;var om=Le(dh,bt,4,vt,zt);vt[0]=(Hl=(As=er-(Hr=(Vn=xe*er)-(Vn-er)))*(eo=Mr-(js=(Vn=xe*Mr)-(Vn-Mr)))-((Gs=er*Mr)-Hr*js-As*js-Hr*eo))-((Gr=Hl-(Kc=(As=un-(Hr=(Vn=xe*un)-(Vn-un)))*(eo=tr-(js=(Vn=xe*tr)-(Vn-tr)))-((aa=un*tr)-Hr*js-As*js-Hr*eo)))+(Bi=Hl-Gr))+(Bi-Kc),vt[1]=(yl=Gs-((Hs=Gs+Gr)-(Bi=Hs-Gs))+(Gr-Bi))-((Gr=yl-aa)+(Bi=yl-Gr))+(Bi-aa),vt[2]=Hs-((_l=Hs+Gr)-(Bi=_l-Hs))+(Gr-Bi),vt[3]=_l;var Ox=Le(om,zt,4,vt,Et);return Et[Ox-1]}(mt,Gt,yi,fi,cn,Fi,Ui)}(be[0],be[1],ye[0],ye[1],ft[0],ft[1]);return Ut>0?-1:Ut<0?1:0}function at(be,ye){var ft=be.point,Ut=ye.point;return ft[0]>Ut[0]?1:ft[0]<Ut[0]?-1:ft[1]!==Ut[1]?ft[1]>Ut[1]?1:-1:function(mt,Gt,yi,fi){return mt.left!==Gt.left?mt.left?1:-1:Ct(yi,mt.otherEvent.point,Gt.otherEvent.point)!==0?mt.isBelow(Gt.otherEvent.point)?-1:1:!mt.isSubject&&Gt.isSubject?1:-1}(be,ye,ft)}function st(be,ye,ft){var Ut=new oe(ye,!1,be,be.isSubject),mt=new oe(ye,!0,be.otherEvent,be.isSubject);return de(be.point,be.otherEvent.point)&&console.warn("what is that, a collapsed
814segment?",be),Ut.contourId=mt.contourId=be.contourId,at(mt,be.otherEvent)>0&&(be.otherEvent.left=!0,mt.left=!1),be.otherEvent.otherEvent=mt,be.otherEvent=Ut,ft.push(mt),ft.push(Ut),ft}function St(be,ye){return be[0]*ye[1]-be[1]*ye[0]}function Dt(be,ye){return be[0]*ye[0]+be[1]*ye[1]}function xt(be,ye,ft){var Ut=function(cn,Fi,ui,Kn,Cr){var Ui=[Fi[0]-cn[0],Fi[1]-cn[1]],On=[Kn[0]-ui[0],Kn[1]-ui[1]];function Er(Vn,Hr,As){return[Vn[0]+Hr*As[0],Vn[1]+Hr*As[1]]}var cr=[ui[0]-cn[0],ui[1]-cn[1]],ys=St(Ui,On),qr=ys*ys,Nr=Dt(Ui,Ui);if(qr>0){var mr=St(cr,On)/ys;if(mr<0||mr>1)return null;var er=St(cr,Ui)/ys;return er<0||er>1?null:mr===0||mr===1?[Er(cn,mr,Ui)]:er===0||er===1?[Er(ui,er,On)]:[Er(cn,mr,Ui)]}if((qr=(ys=St(cr,Ui))*ys)>0)return null;var un=Dt(Ui,cr)/Nr,tr=un+Dt(Ui,On)/Nr,Mr=Math.min(un,tr),Bi=Math.max(un,tr);return Mr<=1&&Bi>=0?Mr===1?[Er(cn,Mr>0?Mr:0,Ui)]:Bi===0?[Er(cn,Bi<1?Bi:1,Ui)]:[Er(cn,Mr>0?Mr:0,Ui),Er(cn,Bi<1?Bi:1,Ui)]:null}(be.point,be.otherEvent.point,ye.point,ye.otherEvent.point),mt=Ut?Ut.length:0;if(mt===0||mt===1&&(de(be.point,ye.point)||de(be.otherEvent.point,ye.otherEvent.point))||mt===2&&be.isSubject===ye.isSubject)return 0;if(mt===1)return de(be.point,Ut[0])||de(be.otherEvent.point,Ut[0])||st(be,Ut[0],ft),de(ye.point,Ut[0])||de(ye.otherEvent.point,Ut[0])||st(ye,Ut[0],ft),1;var Gt=[],yi=!1,fi=!1;return de(be.point,ye.point)?yi=!0:at(be,ye)===1?Gt.push(ye,be):Gt.push(be,ye),de(be.otherEvent.point,ye.otherEvent.point)?fi=!0:at(be.otherEvent,ye.otherEvent)===1?Gt.push(ye.otherEvent,be.otherEvent):Gt.push(be.otherEvent,ye.otherEvent),yi&&fi||yi?(ye.type=k,be.type=ye.inOut===be.inOut?R:j,yi&&!fi&&st(Gt[1].otherEvent,Gt[0].point,ft),2):fi?(st(Gt[0],Gt[1].point,ft),3):Gt[0]!==Gt[3].otherEvent?(st(Gt[0],Gt[1].point,ft),st(Gt[1],Gt[2].point,ft),3):(st(Gt[0],Gt[1].point,ft),st(Gt[3].otherEvent,Gt[2].point,ft),3)}function ni(be,ye){if(be===ye)return 0;if(Ct(be.point,be.otherEvent.point,ye.point)!==0||Ct(be.point,be.otherEvent.point,ye.otherEvent.point)!==0)return de(be.point,ye.point)?be.isBelow(ye.otherEvent.point)?-1:1:be.point[0]===ye.point[0]?be.point[1]<ye.point[1]?-1:1:at(be,ye)===1?ye.isAbove(be.point)?-1:1:be.isBelow(ye.point)?-1:1;if(be.isSubject!==ye.isSubject)return be.isSubject?-1:1;var ft=be.point,Ut=ye.point;return ft[0]===Ut[0]&&ft[1]===Ut[1]?(ft=be.otherEvent.point)[0]===(Ut=ye.otherEvent.point)[0]&&ft[1]===Ut[1]?0:be.contourId>ye.contourId?1:-1:at(be,ye)===1?1:-1}var ai=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Qt(be,ye,ft,Ut){var mt,Gt=be+1,yi=ye[be].point,fi=ye.length;for(Gt<fi&&(mt=ye[Gt].point);Gt<fi&&mt[0]===yi[0]&&mt[1]===yi[1];){if(!ft[Gt])return Gt;++Gt<fi&&(mt=ye[Gt].point)}for(Gt=be-1;ft[Gt]&&Gt>Ut;)Gt--;return Gt}ai.prototype.isExterior=function(){return this.holeOf==null};var Ht=Kt,Zi=Kt;function Kt(be,ye){if(!(this instanceof Kt))return new Kt(be,ye);if(this.data=be||[],this.length=this.data.length,this.compare=ye||Ii,this.length>0)for(var ft=(this.length>>1)-1;ft>=0;ft--)this._down(ft)}function Ii(be,ye){return be<ye?-1:be>ye?1:0}Kt.prototype={push:function(be){this.data.push(be),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var be=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),be}},peek:function(){return this.data[0]},_up:function(be){for(var ye=this.data,ft=this.compare,Ut=ye[be];be>0;){var mt=be-1>>1,Gt=ye[mt];if(ft(Ut,Gt)>=0)break;ye[be]=Gt,be=mt}ye[be]=Ut},_down:function(be){for(var ye=this.data,ft=this.compare,Ut=this.length>>1,mt=ye[be];be<Ut;){var Gt=1+(be<<1),yi=Gt+1,fi=ye[Gt];if(yi<this.length&&ft(ye[yi],fi)<0&&(Gt=yi,fi=ye[yi]),ft(fi,mt)>=0)break;ye[be]=fi,be=Gt}ye[be]=mt}},Ht.default=Zi;var tn=Math.max,yn=Math.min,Un=0;function sn(be,ye,ft,Ut,mt,Gt){var yi,fi,cn,Fi,ui,Kn;for(yi=0,fi=be.length-1;yi<fi;yi++)if(Fi=be[yi+1],ui=new oe(cn=be[yi],!1,void 0,ye),Kn=new oe(Fi,!1,ui,ye),ui.otherEvent=Kn,cn[0]!==Fi[0]||cn[1]!==Fi[1]){ui.contourId=Kn.contourId=ft,Gt||(ui.isExteriorRing=!1,Kn.isExteriorRing=!1),at(ui,Kn)>0?Kn.left=!0:ui.left=!0;var Cr=cn[0],Ui=cn[1];mt[0]=yn(mt[0],Cr),mt[1]=yn(mt[1],Ui),mt[2]=tn(mt[2],Cr),mt[3]=tn(mt[3],Ui),Ut.push(ui),Ut.push(Kn)}}var Qn=[];function Jn(be,ye,ft){typeof be[0][0][0]=="number"&&(be=[be]),typeof ye[0][0][0]=="number"&&(ye=[ye]);var Ut=function(Ui,On,Er){var cr=null;
814return Ui.length*On.length==0&&(Er===z?cr=Qn:Er===q?cr=Ui:Er!==U&&Er!==X||(cr=Ui.length===0?On:Ui)),cr}(be,ye,ft);if(Ut)return Ut===Qn?null:Ut;var mt=[1/0,1/0,-1/0,-1/0],Gt=[1/0,1/0,-1/0,-1/0],yi=function(Ui,On,Er,cr,ys){var qr,Nr,mr,er,un,tr,Mr=new Ht(null,at);for(mr=0,er=Ui.length;mr<er;mr++)for(un=0,tr=(qr=Ui[mr]).length;un<tr;un++)(Nr=un===0)&&Un++,sn(qr[un],!0,Un,Mr,Er,Nr);for(mr=0,er=On.length;mr<er;mr++)for(un=0,tr=(qr=On[mr]).length;un<tr;un++)Nr=un===0,ys===q&&(Nr=!1),Nr&&Un++,sn(qr[un],!1,Un,Mr,cr,Nr);return Mr}(be,ye,mt,Gt,ft);if(Ut=function(Ui,On,Er,cr,ys){var qr=null;return(Er[0]>cr[2]||cr[0]>Er[2]||Er[1]>cr[3]||cr[1]>Er[3])&&(ys===z?qr=Qn:ys===q?qr=Ui:ys!==U&&ys!==X||(qr=Ui.concat(On))),qr}(be,ye,mt,Gt,ft))return Ut===Qn?null:Ut;for(var fi=function(Ui){var On,Er,cr=function(mr){var er,un,tr,Mr,Bi=[];for(un=0,tr=mr.length;un<tr;un++)((er=mr[un]).left&&er.inResult||!er.left&&er.otherEvent.inResult)&&Bi.push(er);for(var Vn=!1;!Vn;)for(Vn=!0,un=0,tr=Bi.length;un<tr;un++)un+1<tr&&at(Bi[un],Bi[un+1])===1&&(Mr=Bi[un],Bi[un]=Bi[un+1],Bi[un+1]=Mr,Vn=!1);for(un=0,tr=Bi.length;un<tr;un++)(er=Bi[un]).otherPos=un;for(un=0,tr=Bi.length;un<tr;un++)(er=Bi[un]).left||(Mr=er.otherPos,er.otherPos=er.otherEvent.otherPos,er.otherEvent.otherPos=Mr);return Bi}(Ui),ys={},qr=[],Nr=function(){if(!ys[On]){var mr=qr.length,er=function(Bi,Vn,Hr){var As=new ai;if(Bi.prevInResult!=null){var js=Bi.prevInResult,eo=js.outputContourId;if(js.resultTransition>0){var Gr=Vn[eo];if(Gr.holeOf!=null){var Hs=Gr.holeOf;Vn[Hs].holeIds.push(Hr),As.holeOf=Hs,As.depth=Vn[eo].depth}else Vn[eo].holeIds.push(Hr),As.holeOf=eo,As.depth=Vn[eo].depth+1}else As.holeOf=null,As.depth=Vn[eo].depth}else As.holeOf=null,As.depth=0;return As}(cr[On],qr,mr),un=function(Bi){ys[Bi]=!0,Bi<cr.length&&cr[Bi]&&(cr[Bi].outputContourId=mr)},tr=On,Mr=On;for(er.points.push(cr[On].point);un(tr),un(tr=cr[tr].otherPos),er.points.push(cr[tr].point),!((tr=Qt(tr,cr,ys,Mr))==Mr||tr>=cr.length)&&cr[tr];);qr.push(er)}};for(On=0,Er=cr.length;On<Er;On++)Nr();return qr}(function(Ui,On,Er,cr,ys,qr){for(var Nr,mr,er,un=new m(ni),tr=[],Mr=Math.min(cr[2],ys[2]);Ui.length!==0;){var Bi=Ui.pop();if(tr.push(Bi),qr===z&&Bi.point[0]>Mr||qr===q&&Bi.point[0]>cr[2])break;if(Bi.left){mr=Nr=un.insert(Bi),Nr=Nr!==(er=un.minNode())?un.prev(Nr):null,mr=un.next(mr);var Vn=Nr?Nr.key:null;if(Q(Bi,Vn,qr),mr&&xt(Bi,mr.key,Ui)===2&&(Q(Bi,Vn,qr),Q(mr.key,Bi,qr)),Nr&&xt(Nr.key,Bi,Ui)===2){var Hr=Nr;Q(Vn,(Hr=Hr!==er?un.prev(Hr):null)?Hr.key:null,qr),Q(Bi,Vn,qr)}}else mr=Nr=un.find(Bi=Bi.otherEvent),Nr&&mr&&(Nr=Nr!==er?un.prev(Nr):null,mr=un.next(mr),un.remove(Bi),mr&&Nr&&xt(Nr.key,mr.key,Ui))}return tr}(yi,0,0,mt,Gt,ft)),cn=[],Fi=0;Fi<fi.length;Fi++){var ui=fi[Fi];if(ui.isExterior()){for(var Kn=[ui.points],Cr=0;Cr<ui.holeIds.length;Cr++)Kn.push(fi[ui.holeIds[Cr]].points);cn.push(Kn)}}return cn}var is={UNION:U,DIFFERENCE:q,INTERSECTION:z,XOR:X};l.diff=function(be,ye){return Jn(be,ye,q)},l.intersection=function(be,ye){return Jn(be,ye,z)},l.operations=is,l.union=function(be,ye){return Jn(be,ye,U)},l.xor=function(be,ye){return Jn(be,ye,X)},Object.defineProperty(l,"__esModule",{value:!0})})(s)}(0,k5.exports)),k5.exports);/** 815 * martinez v0.7.4 816 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor 817 * 818 * @author Alex Milevski <[email protected]> 819 * @license MIT 820 * @preserve 821 */function U2(u,s,l,p){const m=[],_=p===0?(v,w,A,k,R,j)=>{v.push(new Tt(j,A+(j-w)/(k-w)*(R-A)))}:(v,w,A,k,R,j)=>{v.push(new Tt(w+(j-A)/(R-A)*(k-w),j))};for(const v of u){const w=[];for(const A of v){if(A.length<=2)continue;const k=[];for(let z=0;z<A.length-1;z++){const U=A[z].x,q=A[z].y,X=A[z+1].x,Q=A[z+1].y,ee=p===0?U:q,oe=p===0?X:Q;ee<s?oe>s&&_(k,U,q,X,Q,s):ee>l?oe<l&&_(k,U,q,X,Q,l):k.push(A[z]),oe<s&&ee>=s&&_(k,U,q,X,Q,s),oe>l&&ee<=l&&_(k,U,q,X,Q,l)}let R=A[A.length-1];const j=p===0?R.x:R.y;j>=s&&j<=l&&k.push(R),k.length&&(R=k[k.length-1],k[0].x===R.x&&k[0].y===R.y||k.push(k[0]),w.push(k))}w.length&&m.push(w)}return m}function Hde(u,s){const l=UD(u),p=UD([s]),m=P5.intersection(l,p);return m==null?[]:N5(m)}function Gde(u,s){let p=UD(u,65536);const m=[];for(;s.valid();s.next()){const[_,v]=s.get(),w=_.x*65536,A=_.y*65536,k=v.x*65536,R=v.y*65536,j=k-w,z=R-A,U=Math.hypot(j,z);if(U===0)continue;const q=Math.trunc(z/U*3),X=-Math.trunc(j/U*3);m.push([[[w,A],[k,R],[k+q,R+X],[w+q,A+X],[w,A]]])}return m.length>0&&(p=P5.diff(p,m)),N5(p,1/65536)}function UD(u,s=1){return[u.map(l=>l.map(p=>[p.x*s,p.y*s]))]}function N5(u,s=1){return u.map(l=>l.map((p,m)=>{const _=p.map(v=>
821new Tt(v[0]*s,v[1]*s).round());return m>0&&_.reverse(),_}))}class VD{constructor(s,l){this.layoutVertexArray=new Qa,this.indexArray=new Xr,this.lineIndexArray=new Sc,this.triangleSegments=new ls,this.lineSegments=new ls,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut}),this.uploaded=!1,l&&(this.elevatedLayoutVertexArray=new ed)}update(s,l,p,m,_,v,w,A){this.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,A)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Pde.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.lineIndexBuffer=s.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=s.createVertexBuffer(this.elevatedLayoutVertexArray,Nde.members))),this.programConfigurations.upload(s),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(s,l,p,m,_,v,w){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,l,p,m,_,v,void 0,w)}}class $D{constructor(s){this.zoom=s.zoom,this.pixelRatio=s.pixelRatio,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=s.lut,this.bufferData=new VD(s,!1),this.elevationBufferData=new VD(s,!0),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.projection=s.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=s.sourceLayerIndex,this.worldview=s.worldview,this.hasAppearances=null}updateFootprints(s,l){}updateAppearances(s,l,p,m){}populate(s,l,p,m){this.hasPattern=FD("fill",this.layers,this.pixelRatio,l);const _=this.layers[0].layout.get("fill-sort-key"),v=[];for(const{feature:w,id:A,index:k,sourceLayerIndex:R}of s){const j=this.layers[0]._featureFilter.needGeometry,z=nt(w,j);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),z,p))continue;const U=_?_.evaluate(z,{},p,l.availableImages):void 0,q={id:A,properties:w.properties,type:w.type,sourceLayerIndex:R,index:k,geometry:j?z.geometry:yt(w,p,m),patterns:{},sortKey:U};v.push(q)}_&&v.sort((w,A)=>w.sortKey-A.sortKey);for(const w of v){const{geometry:A,index:k,sourceLayerIndex:R}=w;if(this.hasPattern){const j=BD("fill",this.layers,w,this.zoom,this.pixelRatio,l);this.patternFeatures.push(j)}else this.addFeature(w,A,k,p,{},l.availableImages,l.brightness,l.elevationFeatures);l.featureIndex.insert(s[k].feature,A,k,R,this.index)}}update(s,l,p,m,_,v,w){this.bufferData.update(s,l,p,m,_,v,w,this.worldview),this.elevationBufferData.update(s,l,p,m,_,v,w,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(s,l,p,m,_,v,w,this.worldview)}addFeatures(s,l,p,m,_,v){for(const w of this.patternFeatures)this.addFeature(w,w.geometry,w.index,l,p,m,v,s.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(s){this.bufferData.upload(s),this.elevationBufferData.upload(s),this.elevatedStructures&&this.elevatedStructures.upload(s)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(s,l,p,m,_,v=[],w,A){const k=Mw(l,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(s,k,m,p,A):this.addGeometry(k,this.bufferData),this.bufferData.populatePaintArrays(s,p,_,v,m,w,this.worldview),this.elevationBufferData.populatePaintArrays(s,p,_,v,m,w,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(s,l,p,m,_){this.elevatedStructures&&(this.elevatedStructures.construct(s),this.elevatedStructures.populatePaintArrays(l,p,m,_,this.worldview))}addElevatedRoadFeature(s,l,p,m,_){const v=new Array,w=Ki.getElevationFeature(s,_);if(!w)return void this.addGeometry(l,this.bufferData);
vendor: 46,113 bytes, line 821
821{const k=this.clipPolygonsToTile(l,1);k.length>0&&v.push({polygons:k,elevationFeature:w,elevationTileID:p})}const A={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(s,{},p),featureIndex:m};for(const k of v)if(k.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new $l(k.elevationTileID,this.layers,this.zoom,this.lut));const j=k.elevationFeature.isTunnel();let z=0;s.properties.hasOwnProperty(ii)&&(z=+s.properties[ii]);for(const U of k.polygons)this.elevatedStructures.addPortalCandidates(k.elevationFeature.id,U,j,k.elevationFeature,z)}k.elevationFeature.constantHeight==null&&(k.polygons=this.prepareElevatedPolygons(k.polygons,k.elevationFeature,k.elevationTileID));const R=new Bn(p,k.elevationTileID);this.addElevatedGeometry(k.polygons,R,k.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,m,A)}}addElevatedGeometry(s,l,p,m,_,v){const w={elevation:p,elevationSampler:l,bias:m,index:_,featureInfo:v},[A,k]=this.addGeometry(s,this.elevationBufferData,w);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:A,max:k}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,A),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,k))}addGeometry(s,l,p){let m=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,v=null;p&&(v=p.elevationSampler.constantElevation(p.elevation,p.bias),v!=null&&(m=v,_=v));const w=(A,k,R)=>{if(p!=null)if(k.push(A),v!=null)l.elevatedLayoutVertexArray.emplaceBack(v),R.push(v);else{const j=p.elevationSampler.pointElevation(A,p.elevation,p.bias);l.elevatedLayoutVertexArray.emplaceBack(j),R.push(j),m=Math.min(m,j),_=Math.max(_,j)}};for(const A of s){let k=0;for(const le of A)k+=le.length;const R=l.triangleSegments.prepareSegment(k,l.layoutVertexArray,l.indexArray),j=R.vertexLength,z=[],U=[],q=[],X=[],Q=[],ee=l.layoutVertexArray.length;for(const le of A){if(le.length===0)continue;le!==A[0]&&U.push(z.length/2);const de=l.lineSegments.prepareSegment(le.length,l.layoutVertexArray,l.lineIndexArray),Ae=de.vertexLength;p&&Q.push(l.layoutVertexArray.length-ee),w(le[0],q,X),l.layoutVertexArray.emplaceBack(le[0].x,le[0].y),l.lineIndexArray.emplaceBack(Ae+le.length-1,Ae),z.push(le[0].x),z.push(le[0].y);for(let xe=1;xe<le.length;xe++)w(le[xe],q,X),l.layoutVertexArray.emplaceBack(le[xe].x,le[xe].y),l.lineIndexArray.emplaceBack(Ae+xe-1,Ae+xe),z.push(le[xe].x),z.push(le[xe].y);de.vertexLength+=le.length,de.primitiveLength+=le.length}const oe=vx(z,U);for(let le=0;le<oe.length;le+=3)l.indexArray.emplaceBack(j+oe[le],j+oe[le+1],j+oe[le+2]);if(oe.length>0&&p&&this.elevationMode==="hd-road-base"){const le=p.elevation.isTunnel(),de=p.elevation.safeArea,Ae=this.elevatedStructures.addVertices(q,X);this.elevatedStructures.addTriangles(oe,Ae,le);const xe=Q.length;if(xe>0){for(let Me=0;Me<xe-1;Me++)this.elevatedStructures.addRenderableRing(p.index,Q[Me]+Ae,Q[Me+1]-Q[Me],le,de,p.featureInfo);this.elevatedStructures.addRenderableRing(p.index,Q[xe-1]+Ae,q.length-Q[xe-1],le,de,p.featureInfo)}}R.vertexLength+=k,R.primitiveLength+=oe.length/3}return[m,_]}prepareElevatedPolygons(s,l,p){const m=1/ke(p),_=[];for(const v of s){const w=Gde(v,new Or(l,m));_.push(...w)}return _}clipPolygonsToTile(s,l){const p=-l,m=-l,_=Ft+l,v=Ft+l;let w=0;const A=[],k=[];for(;w<s.length;w++){const z=s[w],U=uy(z);(U.min.x>=p&&U.max.x<=_&&U.min.y>=m&&U.max.y<=v?A:k).push(z)}if(A.length===s.length)return s;const R=[new Tt(p,m),new Tt(_,m),new Tt(_,v),new Tt(p,v),new Tt(p,m)],j=A;for(const z of k)j.push(...Hde(z,R));return j}}let M5,D5,R5,j5;ri($D,"FillBucket",{omit:["layers","patternFeatures"]}),ri(VD,"FillBufferData"),ri($l,"ElevatedStructures");class V2{constructor(s,l,p,m){if(this.triangleCount=l.length/3,this.min=new Tt(0,0),this.max=new Tt(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||s.length===0)return;const[_,v]=[s[0].clone(),s[0].clone()];for(let j=1;j<s.length;++j){const z=s[j];_.x=Math.min(_.x,z.x),_.y=Math.min(_.y,z.y),v.x=Math.max(v.x,z.x),v.y=Math.max(v.y,z.y)}if(m){const j=Math.ceil(Math.max(v.x-_.x,v.y-_.y)/m);p=Math.max(p,j)}if(p===0)return;this.min=_,this.max=v;const w=this.max.sub(this.min);w.x=Math.max(w.x,1),w.y=Math.max(w.y,1);const A=Math.max(w.x,w.y)/p;this.cellsX=Math.max(1,Math.ceil(w.x/A)),this.cellsY=Math.max(1,Math.ceil(w.y/A)),this.xScale=1/A,this.yScale=1/A;const k=[];for(let j=0;j<this.triangleCount;j++){const z=s[l[3*j+0]].sub(this.min),U=s[l[3*j+1]].sub(this.min),q=s[l[3*j+2]].sub(this.min),X=ch(Math.floor(Math.min(z.x,U.x,q.x)),this.xScale,this.cellsX),Q=ch(Math.floor(Math.max(z.x,U.x,q.x)),this.xScale,this.cellsX),ee=ch(Math.floor(Math.min(z.y,U.y,q.y)),this.yScale,this.cellsY),oe=ch(Math.floor(Math.max(z.y,U.y,q.y)),this.yScale,this.cellsY),le=new Tt(0,0),de=new Tt(0,0),Ae=new Tt(0,0),xe=new Tt(0,0);for(let Me=ee;Me<=oe;++Me){le.y=de.y=Me*A,Ae.y=xe.y=(Me+1)*A;for(let Le=X;Le<=Q;++Le)le.x=Ae.x=Le*A,de.x=xe.x=(Le+1)*A,(Rs(z,U,q,le,de,xe)||Rs(z,U,q,le,xe,Ae))&&k.push({cellIdx:Me*this.cellsX+Le,triIdx:j})}}if(k.length===0)return;k.sort((j,z)=>j.cellIdx-z.cellIdx||j.triIdx-z.triIdx);let R=0;for(;R<k.length;){const j=k[R].cellIdx,z={start:this.payload.length,len:0};for(;R<k.length&&k[R].cellIdx===j;)++z.len,this.payload.push(k[R++].triIdx);this.cells[j]=z}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(s,l){if(this.triangleCount===0||this.cells.length===0||s.x>this.max.x||this.min.x>s.x||s.y>this.max.y||this.min.y>s.y)return;const p=ch(s.x-this.min.x,this.xScale,this.cellsX),m=ch(s.y-this.min.y,this.yScale,this.cellsY),_=this.cells[m*this.cellsX+p];if(_){this._lazyInitLookup();for(let v=0;v<_.len;v++){const w=this.payload[_.start+v],A=Math.floor(w/8),k=1<<w%8;if(!(this.lookup[A]&k)&&(this.lookup[A]|=k,l.push(w),l.length===this.triangleCount))return}}}query(s,l,p){if(this.triangleCount===0||this.cells.length===0||s.x>this.max.x||this.min.x>l.x||s.y>this.max.y||this.min.y>l.y)return;this._lazyInitLookup();const m=ch(s.x-this.min.x,this.xScale,this.cellsX),_=ch(l.x-this.min.x,this.xScale,this.cellsX),v=ch(s.y-this.min.y,this.yScale,this.cellsY),w=ch(l.y-this.min.y,this.yScale,this.cellsY);for(let A=v;A<=w;A++)for(let k=m;k<=_;k++){const R=this.cells[A*this.cellsX+k];if(R)for(let j=0;j<R.len;j++){const z=this.payload[R.start+j],U=Math.floor(z/8),q=1<<z%8;if(!(this.lookup[U]&q)&&(this.lookup[U]|=q,p.push(z),p.length===this.triangleCount))return}}}}function ch(u,s,l){return Math.max(0,Math.min(l-1,Math.floor(u*s)))}ri(V2,"TriangleGridIndex");class z5{constructor(s){this.zoom=s.zoom,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.footprints=[],this.worldview=s.worldview,this.hasAppearances=null}updateFootprints(s,l){for(const p of this.footprints)l.push({footprint:p,id:s})}updateAppearances(s,l,p,m){}populate(s,l,p,m){const _=[];for(const{feature:v,id:w,index:A,sourceLayerIndex:k}of s){const R=this.layers[0]._featureFilter.needGeometry,j=nt(v,R);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),j,p))continue;const z={id:w,properties:v.properties,type:v.type,sourceLayerIndex:k,index:A,geometry:R?j.geometry:yt(v,p,m),patterns:{}};_.push(z)}for(const v of _){const{geometry:w,index:A,sourceLayerIndex:k}=v;this.addFeature(v,w,A,p,{},l.availableImages,l.brightness),l.featureIndex.insert(s[A].feature,w,A,k,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(s){}update(s,l,p,m,_,v,w){}destroy(){}addFeature(s,l,p,m,_,v=[],w){for(const A of Mw(l,2)){const k=[],R=[],j=[],z=new Tt(1/0,1/0),U=new Tt(-1/0,-1/0);for(const Q of A)if(Q.length!==0){Q!==A[0]&&j.push(R.length/2);for(let ee=0;ee<Q.length;ee++)R.push(Q[ee].x),R.push(Q[ee].y),k.push(Q[ee]),z.x=Math.min(z.x,Q[ee].x),z.y=Math.min(z.y,Q[ee].y),U.x=Math.max(U.x,Q[ee].x),U.y=Math.max(U.y,Q[ee].y)}const q=vx(R,j),X=new V2(k,q,8,256);this.footprints.push({vertices:k,indices:q,grid:X,min:z,max:U})}}}ri(z5,"ClipBucket",{omit:["layers"]});const Wde=wn([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Kde=wn([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Zde=wn([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),Xde=wn([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Yde=wn([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Qde=wn([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Jde=wn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:ehe}=Wde,Dw=Number.MAX_SAFE_INTEGER,L5=Dw-1;function O5(u,s,l,p){return u.order<s||u.order===Dw||!(u.clipMask&l)||function(m,_){return _.length!==0&&_.find(v=>v===m)===void 0}(p,u.clipScope)}function $2(u,s){return u.x-s.x||u.y-s.y}function F5(u,s){return $2(u.min,s.min)===0&&$2(u.max,s.max)===0}function qD(u,s){return!(u.min.x>s.max.x||u.max.x<s.min.x||u.min.y>s.max.y||u.max.y<s.min.y)}function q2(u,s){if(u.length!==s.length)return!1;for(let l=0;l<u.length;l++)if(u[l].sourceId!==s[l].sourceId||!F5(u[l],s[l])||u[l].order!==s[l].order||u[l].clipMask!==s[l].clipMask||!Nl(u[l].clipScope,s[l].clipScope))return!1;return!0}function B5(u,s,l){const p=1/Ft,m=1/(1<<l.canonical.z),_=(s.x*p+l.canonical.x)*m+l.wrap,v=(s.y*p+l.canonical.y)*m;return{min:new Tt((u.x*p+l.canonical.x)*m+l.wrap,(u.y*p+l.canonical.y)*m),max:new Tt(_,v)}}function the(u,s,l){const p=1<<l.canonical.z,m=((s.x-l.wrap)*p-l.canonical.x)*Ft,_=(s.y*p-l.canonical.y)*Ft;return{min:new Tt(((u.x-l.wrap)*p-l.canonical.x)*Ft,(u.y*p-l.canonical.y)*Ft),max:new Tt(m,_)}}function HD(u,s,l,p,m,_,v){const w=u.indices,A=u.vertices,k=[];for(let R=p;R<p+m;R+=3){const j=s[l[R+0]+_],z=s[l[R+1]+_],U=s[l[R+2]+_],q=Math.min(j.x,z.x,U.x),X=Math.max(j.x,z.x,U.x),Q=Math.min(j.y,z.y,U.y),ee=Math.max(j.y,z.y,U.y);k.length=0,u.grid.query(new Tt(q,Q),new Tt(X,ee),k);for(let oe=0;oe<k.length;oe++){const le=k[oe];if(Rs(A[w[3*le+0]],A[w[3*le+1]],A[w[3*le+2]],j,z,U,v))return!0}}return!1}function U5(u,s,l,p){if(!u||!l)return!1;let m=u.vertices;if(!s.canonical.equals(p.canonical)||s.wrap!==p.wrap){if(l.vertices.length<u.vertices.length)return U5(l,p,u,s);const _=s.canonical,v=p.canonical,w=Math.pow(2,v.z-_.z);m=u.vertices.map(A=>new Tt((A.x+_.x*Ft)*w-v.x*Ft,(A.y+_.y*Ft)*w-v.y*Ft))}return HD(l,m,u.indices,0,u.indices.length,0,0)}function V5(u,s,l,p){const m=Math.pow(2,p.z-l.z);return new Tt((u+l.x*Ft)*m-p.x*Ft,(s+l.y*Ft)*m-p.y*Ft)}function GD(u,s){const l=[];s.grid.queryPoint(u,l);const p=s.indices,m=s.vertices;for(let _=0;_<l.length;_++){const v=l[_];if(vo([m[p[3*v+0]],m[p[3*v+1]],m[p[3*v+2]]],u))return!0}return!1}const WD=[new Tt(0,0),new Tt(Ft,0),new Tt(Ft,Ft),new Tt(0,Ft)];function $5(u,s){const l=[];let p=[];if(!s||u.length<2)return[u];if(u.length===2)return Ns(u[0],u[1],WD)?[u]:[];for(let m=0;m<u.length+2;m++){const _=u[m%u.length],v=u[(m+1)%u.length],w=Ns(m===0?u[u.length-1]:u[(m-1)%u.length],_,WD),A=Ns(_,v,WD),k=w||A;k&&p.push(_),k&&A||p.length>0&&(p.length>1&&l.push(p),p=[])}return p.length>1&&l.push(p),l}const KD=wt.types,ihe=["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"],nhe=["fill-extrusion-flood-light-ground-radius"],rhe=Math.pow(2,13),she=Math.pow(2,15)-1,q5=new Tt(0,1),im=2147483648,H5=7,G5=450;function Rw(u,s,l,p,m,_,v,w){u.emplaceBack((s<<1)+v,(l<<1)+_,(Math.floor(p*rhe)<<1)+m,Math.round(w))}function jw(u,s,l){u.emplaceBack(s.x*Ft,s.y*Ft,l?1:0)}function H2(u,s,l,p,m,_){u.emplaceBack(s.x,s.y,(l.x<<1)+p,(l.y<<1)+m,_)}function zw(u,s,l){u.emplaceBack(s.x,s.y,s.z,l[0]*16384,l[1]*16384,l[2]*16384)}class W5{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class K5{constructor(){this.centroidXY=new Tt(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 Tt(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Tt(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Tt(this.max.x-this.min.x,this.max.y-this.min.y)}}class Z5{constructor(){this.acc=new Tt(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(s,l){s.min.x===Number.MAX_VALUE&&(s.min.x=s.max.x=l.x,s.min.y=s.max.y=l.y)}appendEdge(s,l,p){this.accCount++,this.acc._add(l);let m=!!this.borders;l.x<s.min.x?(s.min.x=l.x,m=!0):l.x>s.max.x&&(s.max.x=l.x,m=!0),l.y<s.min.y?(s.min.y=l.y,m=!0):l.y>s.max.y&&(s.max.y=l.y,m=!0),((l.x===0||l.x===Ft)&&l.x===p.x)!=((l.y===0||l.y===Ft)&&l.y===p.y)&&this.processBorderOverlap(l,p),m&&this.checkBorderIntersection(l,p)}checkBorderIntersection(s,l){l.x<0!=s.x<0&&this.addBorderIntersection(0,Vi(l.y,s.y,(0-l.x)/(s.x-l.x))),l.x>Ft!=s.x>Ft&&this.addBorderIntersection(1,Vi(l.y,s.y,(Ft-l.x)/(s.x-l.x))),l.y<0!=s.y<0&&this.addBorderIntersection(2,Vi(l.x,s.x,(0-l.y)/(s.y-l.y))),l.y>Ft!=s.y>Ft&&this.addBorderIntersection(3,Vi(l.x,s.x,(Ft-l.y)/(s.y-l.y)))}addBorderIntersection(s,l){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 p=this.borders[s];l<p[0]&&(p[0]=l),l>p[1]&&(p[1]=l)}processBorderOverlap(s,l){if(s.x===l.x){if(s.y===l.y)return;const p=s.x===0?0:1;this.addBorderIntersection(p,l.y),this.addBorderIntersection(p,s.y)}else{const p=s.y===0?2:3;this.addBorderIntersection(p,l.x),this.addBorderIntersection(p,s.x)}}centroid(){return this.accCount===0?new Tt(0,0):new Tt(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((s,l)=>s+ +(l[0]!==Number.MAX_VALUE),0):0}}function X5(u,s){const l=u.add(s)._unit(),p=re(u.x*l.x+u.y*l.y,-1,1);var m,_,v;return m=Math.acos(p),Math.min(4,Math.max(-4,Math.tan(m)))/4*she*((_=u).x*(v=s).y-_.y*v.x<0?-1:1)}const ohe=[u=>u.x<0,u=>u.x>Ft,u=>u.y<0,u=>u.y>Ft];function ahe(u,s,l,p){const m=[4];if(p===0)return m;l._mult(p);const _=u.sub(l),v=s.sub(l),w=[u,s,_,v];for(let A=0;A<4;A++)for(const k of w)if(ohe[A](k)){m.push(A);break}return m}class ZD{constructor(s){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new rx,this.indexArray=new Xr,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut},l=>nhe.includes(l)),this._segments=new ls,this.hiddenByLandmarkVertexArray=new dx,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new ls}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(s,l,p,m=!1){const _=s.length;if(_>2){let v=Math.max(0,this._segments.get().length-1);const w=this._segments._prepareSegment(4*_,this.vertexArray.length,2*this._segmentToGroundQuads[v].length);let A;v!==this._segments.get().length-1&&(v++,this._segmentToGroundQuads[v]=[],this._segmentToRegionTriCounts[v]=[0,0,0,0,0]);{const k=s[0],R=s[1];A=X5(k.sub(s[_-1])._perp()._unit(),R.sub(k)._perp()._unit())}for(let k=0;k<_;k++){const R=k===_-1?0:k+1,j=s[k],z=s[R],U=s[R===_-1?0:R+1],q=z.sub(j)._perp()._unit(),X=X5(q,U.sub(z)._perp()._unit()),Q=A,ee=X;if(XD(j,z,l)||m&&J5(j,l)&&J5(z,l)){A=X;continue}const oe=w.vertexLength;H2(this.vertexArray,j,z,1,1,Q),H2(this.vertexArray,j,z,1,0,Q),H2(this.vertexArray,j,z,0,1,ee),H2(this.vertexArray,j,z,0,0,ee),w.vertexLength+=4;const le=ahe(j,z,q,p);for(const de of le)this._segmentToGroundQuads[v].push({id:oe,region:de}),this._segmentToRegionTriCounts[v][de]+=2,w.primitiveLength+=2;A=X}}}prepareBorderSegments(){if(!this.hasData())return;const s=this._segments.get(),l=s.length;for(let p=0;p<l;p++)this._segmentToGroundQuads[p].sort((m,_)=>m.region-_.region);for(let p=0;p<l;p++){const m=this._segmentToGroundQuads[p],_=s[p],v=this._segmentToRegionTriCounts[p];v.reduce((A,k)=>A+k,0);let w=0;for(let A=0;A<=4;A++){const k=v[A];if(k!==0){let R=this.regionSegments[A];R||(R=this.regionSegments[A]=new ls);const j={vertexOffset:_.vertexOffset,primitiveOffset:_.primitiveOffset+w,vertexLength:_.vertexLength,primitiveLength:k};R.get().push(j)}w+=k}for(let A=0;A<m.length;A++){const k=m[A].id;this.indexArray.emplaceBack(k,k+1,k+3),this.indexArray.emplaceBack(k,k+3,k+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(s,l,p,m,_,v,w){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,s,l,p,m,_,v,void 0,w)}upload(s){this.hasData()&&(this.vertexBuffer=s.createVertexBuffer(this.vertexArray,Kde.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=s.createVertexBuffer(this.groundRadiusArray,Zde.members)))}uploadPaintProperties(s){this.hasData()&&this.programConfigurations.upload(s)}update(s,l,p,m,_,v,w,A){this.hasData()&&this.programConfigurations.updatePaintArrays(s,l,p,m,_,v,w,A)}updateHiddenByLandmark(s){this.updateHiddenByLandmarkRange(s.groundVertexArrayOffset,s.groundVertexCount,!!(s.flags&im))}updateHiddenByLandmarkRange(s,l,p){if(!this.hasData())return;const m=l+s;if(l!==0){for(let _=s;_<m;++_)this.hiddenByLandmarkVertexArray.emplace(_,p?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(s){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=s.createVertexBuffer(this.hiddenByLandmarkVertexArray,Qde.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 s=0;s<=4;s++){const l=this.regionSegments[s];l&&l.destroy()}}}}class G2{constructor(s){this.zoom=s.zoom,this.canonical=s.canonical,this.overscaling=s.overscaling,this.layers=s.layers,this.pixelRatio=s.pixelRatio,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=s.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Xr,this.footprintVertices=new Qa,this.footprintSegments=[],this.layoutVertexArray=new qf,this.centroidVertexArray=new A2,this.wallVertexArray=new k2,this.indexArray=new Xr,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut},l=>ihe.includes(l)),this.segments=new ls,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.groundEffect=new ZD(s),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=s.worldview,this.hasAppearances=null}updateFootprints(s,l){}updateAppearances(s,l,p,m){}populate(s,l,p,m){this.features=[],this.hasPattern=FD("fill-extrusion",this.layers,this.pixelRatio,l),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=ke(p),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:_,id:v,index:w,sourceLayerIndex:A}of s){const k=this.layers[0]._featureFilter.needGeometry,R=nt(_,k);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),R,p))continue;const j={id:v,sourceLayerIndex:A,index:w,geometry:k?R.geometry:yt(_,p,m),properties:_.properties,type:_.type,patterns:{}},z=this.layoutVertexArray.length,U=KD[j.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:_.id,feature:BD("fill-extrusion",this.layers,j,this.zoom,this.pixelRatio,l)});else if(this.wallMode)for(const q of j.geometry)for(const X of $5(q,U))this.addFeature(_.id,j,[X],w,p,{},l.availableImages,m,l.brightness);else this.addFeature(_.id,j,j.geometry,w,p,{},l.availableImages,m,l.brightness);l.featureIndex.insert(_,j.geometry,w,A,this.index,z)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(s,l,p,m,_,v){for(const{featureId:w,feature:A}of this.features){const k=KD[A.type]==="Polygon",{geometry:R}=A;if(this.wallMode)for(const j of R)for(const z of $5(j,k))this.addFeature(w,A,[z],A.index,l,p,m,_,v);else this.addFeature(w,A,R,A.index,l,p,m,_,v)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(s,l,p,m,_,v,w){this.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,this.worldview),this.groundEffect.update(s,l,_,p,m,v,w,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,ehe),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.wallVertexBuffer=s.createVertexBuffer(this.wallVertexArray,Yde.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=s.createVertexBuffer(this.layoutVertexExtArray,Jde.members,!0)),this.groundEffect.upload(s)),this.groundEffect.uploadPaintProperties(s),this.programConfigurations.upload(s),this.uploaded=!0}uploadCentroid(s){this.groundEffect.uploadHiddenByLandmark(s),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,Xde.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(s,l,p,m,_,v,w,A,k){const R=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(l,{})/this.tileToMeter,j=[new Tt(0,0),new Tt(Ft,Ft)],z=A.projection,U=z.name==="globe",q=this.wallMode||KD[l.type]==="Polygon",X=new Z5;X.centroidDataIndex=this.centroidData.length;const Q=new K5;Q.buildingId=s,l.properties&&l.properties.hasOwnProperty("building_id")&&(Q.buildingId=l.properties.building_id);const ee=this.layers[0].paint.get("fill-extrusion-base").evaluate(l,{},_)<=0,oe=this.layers[0].paint.get("fill-extrusion-height").evaluate(l,{},_);let le;if(Q.height=oe,Q.vertexArrayOffset=this.layoutVertexArray.length,Q.groundVertexArrayOffset=this.groundEffect.vertexArray.length,U&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new ox),this.wallMode){if(U)return void di("Non zero fill-extrusion-line-width is not yet supported on globe.");if(p.length!==1)return;le=function(Xe){const ht=Xe[0].x===Xe[Xe.length-1].x&&Xe[0].y===Xe[Xe.length-1].y;(function(Qt){let Ht=0;const Zi=Qt.length;for(let Kt=0;Kt<Zi;Kt++)Ht+=(Qt[(Kt+1)%Zi].x-Qt[Kt].x)*(Qt[(Kt+1)%Zi].y+Qt[Kt].y);return Ht>=0})(Xe)||(Xe=Xe.reverse());const bt={geometry:[],joinNormals:[],indices:[]},zt=[],Et=[],vt=[];let Ct=Xe.length;for(;Ct>=2&&Xe[Ct-1].equals(Xe[Ct-2]);)Ct--;if(Ct<(ht?3:2))return bt;let at,st,St,Dt,xt,ni=0;for(;ni<Ct-1&&Xe[ni].equals(Xe[ni+1]);)ni++;ht&&(at=Xe[Ct-2],xt=Xe[ni].sub(at)._unit()._perp());for(let Qt=ni;Qt<Ct;Qt++){if(St=Qt===Ct-1?ht?Xe[ni+1]:void 0:Xe[Qt+1],St&&Xe[Qt].equals(St))continue;xt&&(Dt=xt),at&&(st=at),at=Xe[Qt],xt=St?St.sub(at)._unit()._perp():Dt,Dt=Dt||xt;let Ht=Dt.add(xt);Ht.x===0&&Ht.y===0||Ht._unit();const Zi=Ht.x*xt.x+Ht.y*xt.y,Kt=Zi!==0?1/Zi:1/0,Ii=Dt.x*xt.y-Dt.y*xt.x>0;let tn="miter";const yn=2;tn==="miter"&&Kt>yn&&(tn="bevel"),tn==="bevel"&&(Kt>100&&(tn="flipbevel"),Kt<yn&&(tn="miter"));const Un=(sn,Qn,Jn,is)=>{const be=new Tt(sn.x,sn.y),ye=new Tt(sn.x,sn.y);be.x+=Qn.x*is,be.y+=Qn.y*is,ye.x-=Qn.x*Math.max(Jn,1),ye.y-=Qn.y*Math.max(Jn,1),vt.push(Qn),zt.push(be),Et.push(ye)};if(tn==="miter")Ht._mult(Kt),Un(at,Ht,0,0);else if(tn==="flipbevel")Ht=xt.mult(-1),Un(at,Ht,0,0),Un(at,Ht.mult(-1),0,0);else{const sn=-Math.sqrt(Kt*Kt-1),Qn=Ii?sn:0,Jn=Ii?0:sn;st&&Un(at,Dt,Qn,Jn),St&&Un(at,xt,Qn,Jn)}}bt.geometry=[...zt,...Et.reverse(),zt[0]],bt.joinNormals=[...vt,...vt.reverse(),vt[vt.length-1]];const ai=bt.geometry.length-1;for(let Qt=0;Qt<ai/2;Qt++)if(Qt+1<ai/2){let Ht=Qt,Zi=Qt+1,Kt=ai-1-Qt,Ii=ai-2-Qt;Ht=Ht===0?ai-1:Ht-1,Zi=Zi===0?ai-1:Zi-1,Kt=Kt===0?ai-1:Kt-1,Ii=Ii===0?ai-1:Ii-1,bt.indices.push(Kt),bt.indices.push(Zi),bt.indices.push(Ht),bt.indices.push(Kt),bt.indices.push(Ii),bt.indices.push(Zi)}return bt}(p[0]),p=[le.geometry]}const de=(Xe,ht)=>Xe<(ht.length-1)/2||Xe===ht.length-1,Ae=this.wallMode?[p]:Mw(p,500);for(let Xe=Ae.length-1;Xe>=0;Xe--){const ht=Ae[Xe];(ht.length===0||(xe=ht[0]).every(_t=>_t.x<=0)||xe.every(_t=>_t.x>=Ft)||xe.every(_t=>_t.y<=0)||xe.every(_t=>_t.y>=Ft))&&Ae.splice(Xe,1)}var xe;let Me;if(U)Me=nU(Ae,j,_);else{Me=[];for(const Xe of Ae)Me.push({polygon:Xe,bounds:j})}const Le=q?this.edgeRadius:0,Be=Le>0&&this.zoom<17,ut=(Xe,ht)=>{if(Xe.length===0)return!1;const _t=Xe[Xe.length-1];return ht.x===_t.x&&ht.y===_t.y};for(const{polygon:Xe,bounds:ht}of Me){let _t=0,bt=0;for(const Ct of Xe)q&&!Ct[0].equals(Ct[Ct.length-1])&&Ct.push(Ct[0]),bt+=q?Ct.length-1:Ct.length;const zt=this.segments.prepareSegment((q?5:4)*bt,this.layoutVertexArray,this.indexArray);Q.footprintSegIdx<0&&(Q.footprintSegIdx=this.footprintSegments.length),Q.polygonSegIdx<0&&(Q.polygonSegIdx=this.polygonSegments.length);const Et={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},vt=new W5;if(vt.vertexOffset=this.footprintVertices.length,vt.indexOffset=3*this.footprintIndices.length,vt.ringIndices=[],q){const Ct=[],at=[];_t=zt.vertexLength;for(let St=0;St<Xe.length;St++){const Dt=Xe[St];Dt.length&&St!==0&&at.push(Ct.length/2);const xt=[];let ni,ai;ni=Dt[1].sub(Dt[0])._perp()._unit(),vt.ringIndices.push(Dt.length-1);for(let Qt=1;Qt<Dt.length;Qt++){const Ht=Dt[Qt],Zi=Dt[Qt===Dt.length-1?1:Qt+1],Kt=Ht.clone();if(Le){ai=Zi.sub(Ht)._perp()._unit();const Ii=ni.add(ai)._unit(),tn=Le*Math.min(4,1/(ni.x*Ii.x+ni.y*Ii.y));Kt.x+=tn*Ii.x,Kt.y+=tn*Ii.y,Kt.x=Math.round(Kt.x),Kt.y=Math.round(Kt.y),ni=ai}if(!ee||Le!==0&&!Be||ut(xt,Kt)||xt.push(Kt),Rw(this.layoutVertexArray,Kt.x,Kt.y,0,0,1,1,0),this.wallMode){const Ii=de(Qt,Dt);jw(this.wallVertexArray,le.joinNormals[Qt],!Ii)}zt.vertexLength++,this.footprintVertices.emplaceBack(Ht.x,Ht.y),Ct.push(Ht.x,Ht.y),U&&zw(this.layoutVertexExtArray,z.projectTilePoint(Kt.x,Kt.y,_),z.upVector(_,Kt.x,Kt.y))}ee&&(Le===0||Be)&&(xt.length!==0&&ut(xt,xt[0])&&xt.pop(),this.groundEffect.addData(xt,ht,R))}const st=this.wallMode?le.indices:vx(Ct,at);for(let St=0;St<st.length;St+=3)this.footprintIndices.emplaceBack(vt.vertexOffset+st[St+0],vt.vertexOffset+st[St+1],vt.vertexOffset+st[St+2]),this.indexArray.emplaceBack(_t+st[St],_t+st[St+2],_t+st[St+1]),zt.primitiveLength++;vt.indexCount+=st.length,vt.vertexCount+=this.footprintVertices.length-vt.vertexOffset}for(let Ct=0;Ct<Xe.length;Ct++){const at=Xe[Ct];X.startRing(Q,at[0]);let st=at.length>4&&eU(at[at.length-2],at[0],at[1]),St=Le?lhe(at[at.length-2],at[0],at[1],Le):0;const Dt=[];let xt,ni,ai;ni=at[1].sub(at[0])._perp()._unit();let Qt=!0;for(let Ht=1,Zi=0;Ht<at.length;Ht++){let Kt=at[Ht-1],Ii=at[Ht];const tn=at[Ht===at.length-1?1:Ht+1];if(X.appendEdge(Q,Ii,Kt),XD(Ii,Kt,ht)){Le&&(ni=tn.sub(Ii)._perp()._unit(),Qt=!Qt);continue}const yn=Ii.sub(Kt)._perp(),Un=yn.x/(Math.abs(yn.x)+Math.abs(yn.y)),sn=yn.y>0?1:0,Qn=Kt.dist(Ii);if(Zi+Qn>32768&&(Zi=0),Le){ai=tn.sub(Ii)._perp()._unit();let ye=Q5(Kt,Ii,tn,Y5(ni,ai),Le);isNaN(ye)&&(ye=0);const ft=Ii.sub(Kt)._unit();Kt=Kt.add(ft.mult(St))._round(),Ii=Ii.add(ft.mult(-ye))._round(),St=ye,ni=ai,ee&&this.zoom>=17&&(ut(Dt,Kt)||Dt.push(Kt),ut(Dt,Ii)||Dt.push(Ii))}const Jn=zt.vertexLength,is=at.length>4&&eU(Kt,Ii,tn);let be=tU(Zi,st,Qt);if(Rw(this.layoutVertexArray,Kt.x,Kt.y,Un,sn,0,0,be),Rw(this.layoutVertexArray,Kt.x,Kt.y,Un,sn,0,1,be),this.wallMode){const ye=de(Ht-1,at),ft=le.joinNormals[Ht-1];jw(this.wallVertexArray,ft,ye),jw(this.wallVertexArray,ft,ye)}if(Zi+=Qn,be=tU(Zi,is,!Qt),st=is,Rw(this.layoutVertexArray,Ii.x,Ii.y,Un,sn,0,0,be),Rw(this.layoutVertexArray,Ii.x,Ii.y,Un,sn,0,1,be),this.wallMode){const ye=de(Ht,at),ft=le.joinNormals[Ht];jw(this.wallVertexArray,ft,ye),jw(this.wallVertexArray,ft,ye)}if(zt.vertexLength+=4,this.indexArray.emplaceBack(Jn+0,Jn+1,Jn+2),this.indexArray.emplaceBack(Jn+1,Jn+3,Jn+2),zt.primitiveLength+=2,Le){const ye=_t+(Ht===1?at.length-2:Ht-2),ft=Ht===1?_t:ye+1;if(this.indexArray.emplaceBack(Jn+1,ye,Jn+3),this.indexArray.emplaceBack(ye,ft,Jn+3),zt.primitiveLength+=2,xt===void 0&&(xt=Jn),!XD(tn,at[Ht],ht)){const Ut=Ht===at.length-1?xt:zt.vertexLength;this.indexArray.emplaceBack(Jn+2,Jn+3,Ut),this.indexArray.emplaceBack(Jn+3,Ut+1,Ut),this.indexArray.emplaceBack(Jn+3,ft,Ut+1),zt.primitiveLength+=3}Qt=!Qt}if(U){const ye=this.layoutVertexExtArray,ft=z.projectTilePoint(Kt.x,Kt.y,_),Ut=z.projectTilePoint(Ii.x,Ii.y,_),mt=z.upVector(_,Kt.x,Kt.y),Gt=z.upVector(_,Ii.x,Ii.y);zw(ye,ft,mt),zw(ye,ft,mt),zw(ye,Ut,Gt),zw(ye,Ut,Gt)}}q&&(_t+=at.length-1),ee&&Le&&this.zoom>=17&&(Dt.length!==0&&ut(Dt,Dt[0])&&Dt.pop(),this.groundEffect.addData(Dt,ht,R,Le>0))}this.footprintSegments.push(vt),Et.triangleCount=this.indexArray.length-Et.triangleArrayOffset,this.polygonSegments.push(Et),++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=X.borders?q5:this.encodeCentroid(X,Q),this.centroidData.push(Q),X.borders){this.featuresOnBorder.push(X);const Xe=this.featuresOnBorder.length-1;for(let ht=0;ht<X.borders.length;ht++)X.borders[ht][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ht].push(Xe)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,m,v,w,_,k,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(l,m,v,w,_,k,this.worldview),this.maxHeight=Math.max(this.maxHeight,oe)}}sortBorders(){for(let s=0;s<this.borderFeatureIndices.length;s++)this.borderFeatureIndices[s].sort((l,p)=>this.featuresOnBorder[l].borders[s][0]-this.featuresOnBorder[p].borders[s][0])}splitToSubtiles(){const s=[];for(let w=0;w<this.centroidData.length;w++){const A=this.centroidData[w],k=+(A.min.y+A.max.y>Ft),R=2*k+(+(A.min.x+A.max.x>Ft)^k);for(let j=0;j<A.polygonSegLen;j++){const z=A.polygonSegIdx+j;s.push({centroidIdx:w,subtile:R,polygonSegmentIdx:z,triangleSegmentIdx:this.polygonSegments[z].triangleSegIdx})}}const l=new Xr;s.sort((w,A)=>w.triangleSegmentIdx===A.triangleSegmentIdx?w.subtile-A.subtile:w.triangleSegmentIdx-A.triangleSegmentIdx);let p=0,m=0,_=0;for(const w of s){if(w.triangleSegmentIdx!==p)break;_++}const v=s.length;for(;m!==s.length;){p=s[m].triangleSegmentIdx;let w=0,A=m,k=m;for(let R=A;R<_&&s[R].subtile===w;R++)k++;for(;A!==_;){const R=s[A];w=R.subtile;const j=this.centroidData[R.centroidIdx].min.clone(),z=this.centroidData[R.centroidIdx].max.clone(),U={vertexOffset:this.segments.segments[p].vertexOffset,primitiveOffset:l.length,vertexLength:this.segments.segments[p].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let q=A;q<k;q++){const X=s[q],Q=this.polygonSegments[X.polygonSegmentIdx],ee=this.centroidData[X.centroidIdx].min,oe=this.centroidData[X.centroidIdx].max,le=this.indexArray.uint16;for(let de=Q.triangleArrayOffset;de<Q.triangleArrayOffset+Q.triangleCount;de++)l.emplaceBack(le[3*de],le[3*de+1],le[3*de+2]);U.primitiveLength+=Q.triangleCount,j.x=Math.min(j.x,ee.x),j.y=Math.min(j.y,ee.y),z.x=Math.max(z.x,oe.x),z.y=Math.max(z.y,oe.y)}U.primitiveLength>0&&this.triangleSubSegments.push({segment:U,min:j,max:z}),A=k;for(let q=A;q<_&&s[q].subtile===s[A].subtile;q++)k++}m=_;for(let R=m;R<v&&s[R].triangleSegmentIdx===s[m].triangleSegmentIdx;R++)_++}l._trim(),this.indexArray=l}getVisibleSegments(s,l,p){const m=new ls;if(this.wallMode){for(const X of this.triangleSubSegments)m.segments.push(X.segment);return m}let _=0,v=0;const w=1<<s.canonical.z;if(l){const X=l.getMinMaxForTile(s);X&&(_=X.min,v=X.max)}v+=this.maxHeight;const A=s.toUnwrapped();let k;const R=[A.canonical.x/w+A.wrap,A.canonical.y/w],j=[(A.canonical.x+1)/w+A.wrap,(A.canonical.y+1)/w],z=(X,Q,ee)=>[X[0]*(1-ee[0])+Q[0]*ee[0],X[1]*(1-ee[1])+Q[1]*ee[1]],U=[],q=[];for(const X of this.triangleSubSegments){U[0]=X.min.x/Ft,U[1]=X.min.y/Ft,q[0]=X.max.x/Ft,q[1]=X.max.y/Ft;const Q=z(R,j,U),ee=z(R,j,q);if(new gn([Q[0],Q[1],_],[ee[0],ee[1],v]).intersectsPrecise(p)===0){k&&(m.segments.push(k),k=void 0);continue}const oe=X.segment;k&&k.vertexOffset!==oe.vertexOffset&&(m.segments.push(k),k=void 0),k?(k.vertexLength+=oe.vertexLength,k.primitiveLength+=oe.primitiveLength):k={vertexOffset:oe.vertexOffset,primitiveLength:oe.primitiveLength,vertexLength:oe.vertexLength,primitiveOffset:oe.primitiveOffset,sortKey:void 0,vaos:{}}}return k&&m.segments.push(k),m}encodeCentroid(s,l){const p=s.centroid(),m=l.span(),_=Math.min(7,Math.round(m.x*this.tileToMeter/10)),v=Math.min(7,Math.round(m.y*this.tileToMeter/10));return new Tt(re(p.x,1,Ft-1)<<3|_,re(p.y,1,Ft-1)<<3|v)}encodeBorderCentroid(s){if(!s.borders)return new Tt(0,0);const l=s.borders,p=Number.MAX_VALUE;if(l[0][0]!==p||l[1][0]!==p){const m=l[0][0]!==p?0:1;return new Tt(6|(l[0][0]!==p?0:65528),(l[m][0]+l[m][1])/2<<3|6)}{const m=l[2][0]!==p?2:3;return new Tt((l[m][0]+l[m][1])/2<<3|6,6|(l[2][0]!==p?0:65528))}}showCentroid(s){const l=this.centroidData[s.centroidDataIndex];l.flags&=2147483647,l.centroidXY.x=0,l.centroidXY.y=0,this.writeCentroidToBuffer(l)}writeCentroidToBuffer(s){this.groundEffect.updateHiddenByLandmark(s);const l=s.vertexArrayOffset,p=s.vertexCount+s.vertexArrayOffset,m=s.flags&im?q5:s.centroidXY,_=this.centroidVertexArray.geta_centroid_pos0(l);if(this.centroidVertexArray.geta_centroid_pos1(l)!==m.y||_!==m.x){for(let v=l;v<p;++v)this.centroidVertexArray.emplace(v,m.x,m.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const s of this.centroidData)this.writeCentroidToBuffer(s)}updateReplacement(s,l,p){if(l.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=l.updateTime;const m=l.getReplacementRegionsForTile(s.toUnwrapped());if(q2(this.activeReplacements,m))return;if(this.activeReplacements=m,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const v of this.centroidData)v.flags&=2147483647;const _=[];for(const v of this.activeReplacements){if(v.order<p)continue;const w=Math.max(1,Math.pow(2,v.footprintTileId.canonical.z-s.canonical.z));if(v.footprint.buildingId){const A=v.footprint.buildingId;for(const k of this.centroidData)k.buildingId===A&&(k.flags|=im)}else for(const A of this.centroidData)if(!(A.flags&im||v.min.x>A.max.x||A.min.x>v.max.x||v.min.y>A.max.y||A.min.y>v.max.y))for(let k=0;k<A.footprintSegLen;k++){const R=this.footprintSegments[A.footprintSegIdx+k];if(_.length=0,che(this.footprintVertices,R.vertexOffset,R.vertexCount,v.footprintTileId.canonical,s.canonical,_),HD(v.footprint,_,this.footprintIndices.uint16,R.indexOffset,R.indexCount,-R.vertexOffset,-w)){A.flags|=im;break}}}for(const v of this.centroidData)this.writeCentroidToBuffer(v);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(s,l,p){let m=!1;for(let _=0;_<p.footprintSegLen;_++){const v=this.footprintSegments[p.footprintSegIdx+_];let w=0;for(const A of v.ringIndices){for(let k=w,R=A+w-1;k<A+w;R=k++){const j=this.footprintVertices.int16[2*(k+v.vertexOffset)+0],z=this.footprintVertices.int16[2*(k+v.vertexOffset)+1],U=this.footprintVertices.int16[2*(R+v.vertexOffset)+1];z>l!=U>l&&s<(this.footprintVertices.int16[2*(R+v.vertexOffset)+0]-j)*(l-z)/(U-z)+j&&(m=!m)}w=A}}return m}getHeightAtTileCoord(s,l){let p=Number.NEGATIVE_INFINITY,m=!0;const _=4*(s+Ft)*Ft+(l+Ft);if(this.partLookup.hasOwnProperty(_)){const v=this.partLookup[_];return v?{height:v.height,hidden:!!(v.flags&im)}:void 0}for(const v of this.centroidData)s>v.max.x||v.min.x>s||l>v.max.y||v.min.y>l||v.height<=p||this.footprintContainsPoint(s,l,v)&&(p=v.height,this.partLookup[_]=v,m=!!(v.flags&im));if(p!==Number.NEGATIVE_INFINITY)return{height:p,hidden:m};this.partLookup[_]=void 0}}function Y5(u,s){const l=u.add(s)._unit();return u.x*l.x+u.y*l.y}function lhe(u,s,l,p){const m=s.sub(u)._perp()._unit(),_=l.sub(s)._perp()._unit();return Q5(u,s,l,Y5(m,_),p)}function Q5(u,s,l,p,m){const _=Math.sqrt(1-p*p);return Math.min(u.dist(s)/3,s.dist(l)/3,m*_/p)}function XD(u,s,l){return u.x<l[0].x&&s.x<l[0].x||u.x>l[1].x&&s.x>l[1].x||u.y<l[0].y&&s.y<l[0].y||u.y>l[1].y&&s.y>l[1].y}function J5(u,s){return u.x<s[0].x||u.x>s[1].x||u.y<s[0].y||u.y>s[1].y}function eU(u,s,l){if(u.x<0||u.x>=Ft||s.x<0||s.x>=Ft||l.x<0||l.x>=Ft)return!1;const p=l.sub(s),m=p.perp(),_=u.sub(s);return(p.x*_.x+p.y*_.y)/Math.sqrt((p.x*p.x+p.y*p.y)*(_.x*_.x+_.y*_.y))>-.866&&m.x*_.x+m.y*_.y<0}function tU(u,s,l){const p=s?2|u:-3&u;return l?1|p:-2&p}function iU(){const u=Math.PI/32,s=Math.tan(u),l=L;return l*Math.sqrt(1+2*s*s)-l}function nU(u,s,l){const p=1<<l.z,m=fe(l.x/p),_=fe((l.x+1)/p),v=ue(l.y/p),w=ue((l.y+1)/p);return function(A,k,R,j,z=0,U){const q=[];if(!A.length||!R||!j)return q;const X=(xe,Me)=>{for(const Le of xe)q.push({polygon:Le,bounds:Me})},Q=Math.ceil(Math.log2(R)),ee=Math.ceil(Math.log2(j)),oe=Q-ee,le=[];for(let xe=0;xe<Math.abs(oe);xe++)le.push(oe>0?0:1);for(let xe=0;xe<Math.min(Q,ee);xe++)le.push(0),le.push(1);let de=A;if(de=U2(de,k[0].y-z,k[1].y+z,1),de=U2(de,k[0].x-z,k[1].x+z,0),!de.length)return q;const Ae=[];for(le.length?Ae.push({polygons:de,bounds:k,depth:0}):X(de,k);Ae.length;){const xe=Ae.pop(),Me=xe.depth,Le=le[Me],Be=xe.bounds[0],ut=xe.bounds[1],Xe=Le===0?Be.x:Be.y,ht=Le===0?ut.x:ut.y,_t=U?U(Le,Xe,ht):.5*(Xe+ht),bt=U2(xe.polygons,Xe-z,_t+z,Le),zt=U2(xe.polygons,_t-z,ht+z,Le);if(bt.length){const Et=[Be,new Tt(Le===0?_t:ut.x,Le===1?_t:ut.y)];le.length>Me+1?Ae.push({polygons:bt,bounds:Et,depth:Me+1}):X(bt,Et)}if(zt.length){const Et=[new Tt(Le===0?_t:Be.x,Le===1?_t:Be.y),ut];le.length>Me+1?Ae.push({polygons:zt,bounds:Et,depth:Me+1}):X(zt,Et)}}return q}(u,s,Math.ceil((_-m)/11.25),Math.ceil((v-w)/11.25),1,(A,k,R)=>{if(A===0)return .5*(k+R);{const j=ue((l.y+k/Ft)/p);return(ne(.5*(ue((l.y+R/Ft)/p)+j))*p-l.y)*Ft}})}function che(u,s,l,p,m,_){const v=Math.pow(2,p.z-m.z);for(let w=0;w<l;w++){let A=u.int16[2*(w+s)+0],k=u.int16[2*(w+s)+1];A=(A+m.x*Ft)*v-p.x*Ft,k=(k+m.y*Ft)*v-p.y*Ft,_.push(new Tt(A,k))}}let rU,sU;ri(G2,"FillExtrusionBucket",{omit:["layers","features"]}),ri(K5,"PartData"),ri(W5,"FootprintSegment"),ri(Z5,"BorderCentroidData"),ri(ZD,"GroundEffect");class Ry extends Tt{constructor(s,l,p){super(s,l),this.z=p}}class oU extends Ry{constructor(s,l,p,m){super(s,l,p),this.w=m}}function aU(u,s,l,p){const m=l==="x"?"y":"x",_=(p-u[l])/(s[l]-u[l]);u[m]=Math.round(u[m]+(s[m]-u[m])*_),u[l]=p,u.hasOwnProperty("z")&&(u.z=Vi(u.z,s.z,_)),u.hasOwnProperty("w")&&(u.w=Vi(u.w,s.w,_))}function lU(u,s,l,p){const m=l,_=p;for(const v of["x","y"]){let w=u,A=s;w[v]>=A[v]&&(w=s,A=u),w[v]<m&&A[v]>m&&aU(w,A,v,m),w[v]<_&&A[v]>_&&aU(A,w,v,_)}}function W2(u,s,l,p,m,_){const v=[];for(let w=0;w<u.length;w++){const A=u[w];let k;const R=v.length;let j=0;for(let z=0;z<A.length-1;z++){let U=A[z],q=A[z+1],X=0;const Q=j;let ee,oe;_&&(X=Math.hypot(q.x-U.x,q.y-U.y),j+=X,ee=U,oe=q),U.x<s&&q.x<s||(U.x<s?U=new Tt(s,U.y+(s-U.x)/(q.x-U.x)*(q.y-U.y))._round():q.x<s&&(q=new Tt(s,U.y+(s-U.x)/(q.x-U.x)*(q.y-U.y))._round()),U.y<l&&q.y<l||(U.y<l?U=new Tt(U.x+(l-U.y)/(q.y-U.y)*(q.x-U.x),l)._round():q.y<l&&(q=new Tt(U.x+(l-U.y)/(q.y-U.y)*(q.x-U.x),l)._round()),U.x>=p&&q.x>=p||(U.x>=p?U=new Tt(p,U.y+(p-U.x)/(q.x-U.x)*(q.y-U.y))._round():q.x>=p&&(q=new Tt(p,U.y+(p-U.x)/(q.x-U.x)*(q.y-U.y))._round()),U.y>=m&&q.y>=m||(U.y>=m?U=new Tt(U.x+(m-U.y)/(q.y-U.y)*(q.x-U.x),m)._round():q.y>=m&&(q=new Tt(U.x+(m-U.y)/(q.y-U.y)*(q.x-U.x),m)._round()),k&&U.equals(k[k.length-1])||(k=[U],v.push(k),_&&_.push({progress:{min:Q+cU(ee,oe,U)*X,max:1},parentIndex:w,prevPoint:ee,nextPoint:oe})),k.push(q),_&&(_[_.length-1].progress.max=Q+cU(ee,oe,q)*X,_[_.length-1].nextPoint=oe)))))}if(_&&j>0)for(let z=R;z<v.length;z++)_[z].progress.min/=j,_[z].progress.max/=j}return v}function uhe(u,s,l,p,m){if(u.length<2)return void p.push(u);const _=[];for(;s.valid();){const[k,R]=s.get();for(let j=0;j<u.length-1;j++){const z=u[j],U=u[j+1],q=Ol(z,U,k,R);if(q){const[X]=q,Q=new Tt(Vi(z.x,U.x,X),Vi(z.y,U.y,X));_.push({t:j+X,distance:0,point:Q})}}s.next()}if(_.length===0)return void p.push(u);_.sort((k,R)=>k.t-R.t);let v=0,w=0,A=[];for(p.push(A);v!==u.length;){if(w===_.length){for(;v!==u.length;)A.length!==0&&A[A.length-1].equals(u[v])||A.push(u[v]),v++;break}_[w].t<=v?(A.length!==0&&A[A.length-1].equals(_[w].point)||A.push(_[w].point),Math.trunc(_[w].t),w++):(A.length!==0&&A[A.length-1].equals(u[v])||A.push(u[v]),v++)}}function cU(u,s,l){return u.x!==s.x?(l.x-u.x)/(s.x-u.x):u.y!==s.y?(l.y-u.y)/(s.y-u.y):0}function Lw(u,s){return u.x*s.x+u.y*s.y}function uU(u,s){if(u.length===1){let l=0;const p=s[l++];let m;for(;!m||p.equals(m);)if(m=s[l++],!m)return 1/0;for(;l<s.length;l++){const _=s[l],v=u[0],w=m.sub(p),A=_.sub(p),k=v.sub(p),R=Lw(w,w),j=Lw(w,A),z=Lw(A,A),U=Lw(k,w),q=Lw(k,A),X=R*z-j*j,Q=(z*U-j*q)/X,ee=(R*q-j*U)/X,oe=p.z*(1-Q-ee)+m.z*Q+_.z*ee;if(isFinite(oe))return oe}return 1/0}{let l=1/0;for(const p of s)l=Math.min(l,p.z);return l}}function dU(u,s,l){let p=1/0;ws(l,s)&&(p=uU(l,s[0]));for(let m=0;m<s.length;m++){const _=s[m],v=u[m];for(let w=0;w<_.length-1;w++){const A=_[w],k=[A,_[w+1],v[w+1],v[w],A];Ps(l,k)&&(p=Math.min(p,uU(l,k)))}}return p!==1/0&&p}function hU(u,s,l,p,m,_,v,w,A,k,R){return u.projection.name==="globe"?function(j,z,U,q,X,Q,ee,oe,le,de,Ae){const xe=[],Me=[],Le=j.projection.upVectorScale(Ae,j.center.lat,j.worldSize).metersToTile,Be=[0,0,0,1],ut=[0,0,0,1],Xe=(_t,bt,zt,Et)=>{_t[0]=bt,_t[1]=zt,_t[2]=Et,_t[3]=1},ht=iU();U>0&&(U+=ht),q+=ht;for(const _t of z){const bt=[],zt=[];for(const Et of _t){const vt=Et.x+X.x,Ct=Et.y+X.y,at=j.projection.projectTilePoint(vt,Ct,Ae),st=j.projection.upVector(Ae,Et.x,Et.y);let St=U,Dt=q;if(ee){const xt=pU(vt,Ct,U,q,ee,oe,le,de);St+=xt.base,Dt+=xt.top}U!==0?Xe(Be,at.x+st[0]*Le*St,at.y+st[1]*Le*St,at.z+st[2]*Le*St):Xe(Be,at.x,at.y,at.z),Xe(ut,at.x+st[0]*Le*Dt,at.y+st[1]*Le*Dt,at.z+st[2]*Le*Dt),zi(Be,Be,Q),zi(ut,ut,Q),bt.push(new Ry(Be[0],Be[1],Be[2])),zt.push(new Ry(ut[0],ut[1],ut[2]))}xe.push(bt),Me.push(zt)}return[xe,Me]}(u,s,l,p,m,_,v,w,A,k,R):v?function(j,z,U,q,X,Q,ee,oe,le){const de=[],Ae=[],xe=[0,0,0,1];for(const Me of j){const Le=[],Be=[];for(const ut of Me){const Xe=ut.x+q.x,ht=ut.y+q.y,_t=pU(Xe,ht,z,U,Q,ee,oe,le);xe[0]=Xe,xe[1]=ht,xe[2]=_t.base,xe[3]=1,$t(xe,xe,X),xe[3]=Math.max(xe[3],1e-5);const bt=new Ry(xe[0]/xe[3],xe[1]/xe[3],xe[2]/xe[3]);xe[0]=Xe,xe[1]=ht,xe[2]=_t.top,xe[3]=1,$t(xe,xe,X),xe[3]=Math.max(xe[3],1e-5);const zt=new Ry(xe[0]/xe[3],xe[1]/xe[3],xe[2]/xe[3]);Le.push(bt),Be.push(zt)}de.push(Le),Ae.push(Be)}return[de,Ae]}(s,l,p,m,_,v,w,A,k):function(j,z,U,q,X){const Q=[],ee=[],oe=X[8]*z,le=X[9]*z,de=X[10]*z,Ae=X[11]*z,xe=X[8]*U,Me=X[9]*U,Le=X[10]*U,Be=X[11]*U;for(const ut of j){const Xe=[],ht=[];for(const _t of ut){const bt=_t.x+q.x,zt=_t.y+q.y,Et=X[0]*bt+X[4]*zt+X[12],vt=X[1]*bt+X[5]*zt+X[13],Ct=X[2]*bt+X[6]*zt+X[14],at=X[3]*bt+X[7]*zt+X[15],st=Et+oe,St=vt+le,Dt=Ct+de,xt=Math.max(at+Ae,1e-5),ni=Et+xe,ai=vt+Me,Qt=Ct+Le,Ht=Math.max(at+Be,1e-5);Xe.push(new Ry(st/xt,St/xt,Dt/xt)),ht.push(new Ry(ni/Ht,ai/Ht,Qt/Ht))}Q.push(Xe),ee.push(ht)}return[Q,ee]}(s,l,p,m,_)}function pU(u,s,l,p,m,_,v,w){const A=v*m.getElevationAt(u,s,!0,!0),k=_[0]!==0,R=k?_[1]===0?v*(_[0]/H5-G5):v*function(j,z,U){const q=Math.floor(z[0]/8),X=Math.floor(z[1]/8),Q=10*(z[0]-8*q),ee=10*(z[1]-8*X),oe=j.getElevationAt(q,X,!0,!0),le=j.getMeterToDEM(U),de=Math.floor(.5*(Q*le-1)),Ae=Math.floor(.5*(ee*le-1)),xe=j.tileCoordToPixel(q,X),Me=2*de+1,Le=2*Ae+1,Be=function(zt,Et,vt,Ct,at){return[zt.getElevationAtPixel(Et,vt,!0),zt.getElevationAtPixel(Et+at,vt,!0),zt.getElevationAtPixel(Et,vt+at,!0),zt.getElevationAtPixel(Et+Ct,vt+at,!0)]}(j,xe.x-de,xe.y-Ae,Me,Le),ut=Math.abs(Be[0]-Be[1]),Xe=Math.abs(Be[2]-Be[3]),ht=Math.abs(Be[0]-Be[2])+Math.abs(Be[1]-Be[3]),_t=Math.min(.25,.5*le*(ut+Xe)/Me),bt=Math.min(.25,.5*le*ht/Le);return oe+Math.max(_t*Q,bt*ee)}(m,_,w):A;return{base:A+(l===0?-1:l),top:k?Math.max(R+p,A+l+2):A+p}}class dhe{constructor(s){this._callback=s,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 hhe{constructor(){this.tasks={},this.taskQueue=[],Ve(["process"],this),this.invoker=new dhe(this.process),this.nextId=0}add(s,l){const p=this.nextId++,m=function({type:_,isSymbolTile:v,zoom:w}){return w=w||0,_==="message"?0:_!=="maybePrepare"||v?_!=="parseTile"||v?_==="parseTile"&&v?300-w:_==="maybePrepare"&&v?400-w:500:200-w:100-w}(l);
821if(m===0){try{s()}finally{}return null}return this.tasks[p]={fn:s,metadata:l,priority:m,id:p},this.taskQueue.push(p),this.invoker.trigger(),{cancel:()=>{delete this.tasks[p]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(p=>!!this.tasks[p]),!this.taskQueue.length)return;const s=this.pick();if(s===null)return;const l=this.tasks[s];if(delete this.tasks[s],this.taskQueue.length&&this.invoker.trigger(),!l)return;l.fn()}finally{}}pick(){let s=null,l=1/0;for(let m=0;m<this.taskQueue.length;m++){const _=this.tasks[this.taskQueue[m]];_.priority<l&&(l=_.priority,s=m)}if(s===null)return null;const p=this.taskQueue[s];return this.taskQueue.splice(s,1),p}remove(){this.invoker.remove()}}class fU{constructor(s,l,p){this.target=s,this.parent=l,this.mapId=p,this.callbacks={},this.cancelCallbacks={},Ve(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new hhe}send(s,l,p,m,_=!1,v){const w=Math.round(1e18*Math.random()).toString(36).substring(0,10);p&&(p.metadata=v,this.callbacks[w]=p);const A=new Set;return this.target.postMessage({id:w,type:s,hasCallback:!!p,targetMapId:m,mustQueue:_,sourceMapId:this.mapId,data:ih(l,A)},A),{cancel:()=>{p&&delete this.callbacks[w],this.target.postMessage({id:w,type:"<cancel>",targetMapId:m,sourceMapId:this.mapId})}}}receive(s){const l=s.data;if(!l)return;const p=l.id;if(p&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type==="<cancel>"){const m=this.cancelCallbacks[p];delete this.cancelCallbacks[p],m&&m.cancel()}else if(l.mustQueue||Zr(self)){const m=this.callbacks[p],_=this.scheduler.add(()=>this.processTask(p,l),m&&m.metadata||{type:"message"});_&&(this.cancelCallbacks[p]=_)}else this.processTask(p,l)}processTask(s,l){if(delete this.cancelCallbacks[s],l.type==="<response>"){const p=this.callbacks[s];delete this.callbacks[s],p&&(l.error?p(nh(l.error)):p(null,nh(l.data)))}else{const p=new Set,m=l.hasCallback?(v,w)=>{this.target.postMessage({id:s,type:"<response>",sourceMapId:this.mapId,error:v?ih(v):null,data:ih(w,p)},p)}:()=>{},_=nh(l.data);if(this.parent[l.type])this.parent[l.type](l.sourceMapId,_,m);else if(this.parent.getWorkerSource){const v=l.type.split("."),{source:w,scope:A}=_;this.parent.getWorkerSource(l.sourceMapId,v[0],w,A)[v[1]](_,m)}else m(new Error(`Could not find function ${l.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Ow={workerUrl:"",workerClass:null,workerParams:void 0};const YD="mapboxgl_preloaded_worker_pool";class jy{constructor(){this.active={}}acquire(s,l=jy.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<l;)this.workers.push(Ow.workerClass!=null?new Ow.workerClass:new self.Worker(Ow.workerUrl,Ow.workerParams));return this.active[s]=!0,this.workers.slice()}release(s){delete this.active[s],this.workers&&this.numActive()===0&&(this.workers.forEach(l=>{l.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[YD]}numActive(){return Object.keys(this.active).length}}jy.workerCount=2;class bx{constructor(s,l,p="Worker",m=jy.workerCount){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=rt();const _=this.workerPool.acquire(this.id,m);for(let v=0;v<_.length;v++){const w=new bx.Actor(_[v],l,this.id);w.name=`${p} ${v}`,this.actors.push(w)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(s,l,p){Re(this.actors,(m,_)=>{m.send(s,l,_)},p=p||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(s=>{s.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Fw,QD;function K2(){return Fw||(Fw=new jy),Fw}bx.Actor=fU;class phe{constructor(s){this.module=s}createIntArray(s){const l=new Int32Array(s),p=this.module.malloc(l.length*l.BYTES_PER_ELEMENT);return this.module.heap32.set(l,p/l.BYTES_PER_ELEMENT),p}createFloatArray(s){const l=new Float32Array(s),p=this.module.malloc(l.length*l.BYTES_PER_ELEMENT);return this.module.heapF32.set(l,p/l.BYTES_PER_ELEMENT),p}createStringBuffer(s){const l=this.module.malloc(s.length+1);for(let p=0;p<s.length;++p)this.module.heapU8[l+p]=s.charCodeAt(p);return this.module.heapU8[l+s.length]=0,l}readStringBuffer(s){let l="";for(;this.module.heapU8[s]!==0;)l+=String.fromCharCode(this.module.heapU8[s]),++s;return l}setStyle(s){const l=s.entranceColorRgb,p=s.facadeGlazingColorRgb,m=s.roofColorRgb,_=s.wallColorRgb,v=s.normalScale;this.module.setStyle(l[0],l[1],l[2],p[0],p[1],p[2],m[0],m[1],m[2],_[0],_[1],_[2],v[0],v[1],v[2],s.tileToMeters)}setAOOptions(s,l){this.module.setAOOptions(s?1:0,l)}setMetricOptions(s,l){this.module.setMetricOptions(s?1:0,l)}setStructuralOptions(s){this.module.setStructuralOptions(s?1:0)}setFacadeOptions(s,l){this.module.setFacadeOptions(s,l?1:0)}setFauxFacadeOptions(s,l,p){this.module.setFauxFacadeOptions(s?1:0,l?1:0,p)}setFacadeClassifierOptions(s){this.module.setFacadeClassifierOptions(s)}generateMesh(s,l){for(const w of s){const A=this.createStringBuffer(w.roofType),k=[0],R=[];for(const U of w.coordinates)if(Array.isArray(U)){for(const q of U)R.push(q.x),R.push(q.y);k.push(R.length)}const j=this.createIntArray(k),z=this.createFloatArray(R);this.module.addFeature(w.id,w.sourceId,w.minHeight,w.height,A,w.roofType.length,z,j,k.length-1),this.module.free(A),this.module.free(j),this.module.free(z)}for(const w of l){let A;A=w.entrances?JSON.parse(w.entrances):[];const k=this.createFloatArray(A),R=[];for(const z of w.coordinates)R.push(z.x),R.push(z.y);const j=this.createFloatArray(R);this.module.addFacade(w.sourceId,w.crossPerc,w.distanceToRoad,k,A.length,j,R.length),this.module.free(k),this.module.free(j)}if(!this.module.generateMesh()){const w=this.module.getLastError();return this.readStringBuffer(w)}
821const p=this.module.getMeshCount(),m=new Array(p);for(let w=0;w<p;w++){const A=this.module.getPositionsPtr(w),k=this.module.getPositionsLength(w),R=new Float32Array(this.module.heapF32.buffer,A,k),j=this.module.getNormalsPtr(w),z=this.module.getNormalsLength(w),U=new Float32Array(this.module.heapF32.buffer,j,z),q=this.module.getColorsPtr(w),X=this.module.getColorsLength(w),Q=new Uint8Array(this.module.heapU8.buffer,q,X),ee=this.module.getAOPtr(w),oe=this.module.getAOLength(w),le=new Float32Array(this.module.heapF32.buffer,ee,oe),de=this.module.getUVPtr(w),Ae=this.module.getUVLength(w),xe=new Float32Array(this.module.heapF32.buffer,de,Ae),Me=this.module.getFauxFacadePtr(w),Le=this.module.getFauxFacadeLength(w),Be=new Uint8Array(this.module.heapU8.buffer,Me,Le),ut=this.module.getIndicesPtr(w),Xe=this.module.getIndicesLength(w),ht=new Int32Array(this.module.heap32.buffer,ut,Xe),_t=this.module.getBuildingPart(w),bt=this.readStringBuffer(_t);m[w]={positions:R,normals:U,colors:Q,ao:le,uv:xe,isFauxFacade:Be,indices:ht,buildingPart:bt}}const _=this.module.getRingCount(),v=[];for(let w=0;w<_;w++){const A=this.module.getRingPtr(w),k=this.module.getRingLength(w),R=new Float32Array(this.module.heapF32.buffer,A,k);v.push(R)}return{meshes:m,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:v}}}let Bw,JD,rd,wx,eR,Sx=null,Tx=null,mU=null,Z2=null;function gU(){return Zr(self)&&self.worker.dracoUrl?self.worker.dracoUrl:JD||Vr.DRACO_URL}function yU(){if(Zr(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(wx)return wx;const u=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 wx=WebAssembly.validate(u)?Vr.MESHOPT_SIMD_URL:Vr.MESHOPT_URL,wx}function fhe(){return Z2}const X2={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},mhe={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Uw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function _U(u,s,l){const p=l.json.bufferViews.length,m=l.buffers.length;s.bufferView=p,l.json.bufferViews[p]={buffer:m,byteLength:u.byteLength},l.buffers[m]=u}const tR="KHR_draco_mesh_compression";function ghe(u,s){const l=u.extensions&&u.extensions[tR];if(!l)return;const p=new rd.Decoder,m=wU(s,l.bufferView),_=new rd.Mesh;if(!p.DecodeArrayToMesh(m,m.byteLength,_))throw new Error("Failed to decode Draco mesh");const v=s.json.accessors[u.indices],w=X2[v.componentType],A=v.count*w.BYTES_PER_ELEMENT,k=rd._malloc(A);w===Uint16Array?p.GetTrianglesUInt16Array(_,A,k):p.GetTrianglesUInt32Array(_,A,k),_U(rd.memory.buffer.slice(k,k+A),v,s),rd._free(k);for(const R of Object.keys(l.attributes)){const j=p.GetAttributeByUniqueId(_,l.attributes[R]),z=s.json.accessors[u.attributes[R]],U=mhe[z.componentType],q=z.count*Uw[z.type]*X2[z.componentType].BYTES_PER_ELEMENT,X=rd._malloc(q);p.GetAttributeDataArrayForAllPoints(_,j,rd[U],q,X),_U(rd.memory.buffer.slice(X,X+q),z,s),rd._free(X)}p.destroy(),_.destroy(),delete u.extensions[tR]}const Y2="EXT_meshopt_compression";function yhe(u,s){if(!u.extensions||!u.extensions[Y2])return;const l=u.extensions[Y2],p=new Uint8Array(s.buffers[l.buffer],l.byteOffset||0,l.byteLength||0),m=new Uint8Array(l.count*l.byteStride);eR.decodeGltfBuffer(m,l.count,l.byteStride,p,l.mode,l.filter),u.buffer=s.buffers.length,u.byteOffset=0,s.buffers[u.buffer]=m.buffer,delete u.extensions[Y2]}const vU=1179937895,xU=new TextDecoder("utf8");function bU(u,s){return new URL(u,s).href}function _he(u,s,l,p){return fetch(bU(u.uri,p)).then(m=>m.arrayBuffer()).then(m=>{s.buffers[l]=m})}function wU(u,s){const l=u.json.bufferViews[s];return new Uint8Array(u.buffers[l.buffer],l.byteOffset||0,l.byteLength)}function vhe(u,s,l,p){if(u.uri){const m=bU(u.uri,p);return fetch(m).then(_=>_.blob()).then(_=>createImageBitmap(_)).then(_=>{s.images[l]=_})}if(u.bufferView!==void 0){const m=wU(s,u.bufferView),_=new Blob([m],{type:u.mimeType});return createImageBitmap(_).then(v=>{s.images[l]=v})}}function SU(u,s=0,l){const p={json:null,images:[],buffers:[]};
vendor: 8,548 bytes, line 821
821if(new Uint32Array(u,s,1)[0]===vU){const R=new Uint32Array(u,s);let j=2;const z=(R[j++]>>2)-3,U=R[j++]>>2;if(j++,p.json=JSON.parse(xU.decode(R.subarray(j,j+U))),j+=U,j<z){const q=R[j++];j++;const X=s+(j<<2);p.buffers[0]=u.slice(X,X+q)}}else p.json=JSON.parse(xU.decode(new Uint8Array(u,s)));const{buffers:m,images:_,meshes:v,extensionsUsed:w,bufferViews:A}=p.json;let k=Promise.resolve();if(m){const R=[];for(let j=0;j<m.length;j++){const z=m[j];z.uri?R.push(_he(z,p,j,l)):p.buffers[j]||(p.buffers[j]=null)}k=Promise.all(R)}return k.then(()=>{const R=[],j=w&&w.includes(tR),z=w&&w.includes(Y2);if(j&&R.push(function(){if(!rd)return Bw??(Bw=function(U){let q,X=null;function Q(){q=new Uint8Array(X.buffer)}function ee(){throw new Error("Unexpected Draco error.")}const oe={a:{a:ee,d:function(le,de,Ae){return q.copyWithin(le,de,de+Ae)},c:function(le){const de=q.length,Ae=Math.max(le>>>0,Math.ceil(1.2*de)),xe=Math.ceil((Ae-de)/65536);try{return X.grow(xe),Q(),!0}catch{return!1}},b:ee}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(U,oe):U.then(le=>le.arrayBuffer()).then(le=>WebAssembly.instantiate(le,oe))).then(le=>{const{Rb:de,Qb:Ae,P:xe,T:Me,X:Le,Ja:Be,La:ut,Qa:Xe,Va:ht,Wa:_t,eb:bt,jb:zt,f:Et,e:vt,yb:Ct,zb:at,Ab:st,Bb:St,Db:Dt,Gb:xt}=le.instance.exports;X=vt;const ni=(()=>{let ai=0,Qt=0,Ht=0,Zi=0;return Kt=>{Ht&&(de(Zi),de(ai),Qt+=Ht,Ht=ai=0),ai||(Qt+=128,ai=Ae(Qt));const Ii=Kt.length+7&-8;let tn=ai;Ii>=Qt&&(Ht=Ii,tn=Zi=Ae(Ii));for(let yn=0;yn<Kt.length;yn++)q[tn+yn]=Kt[yn];return tn}})();return Q(),Et(),{memory:vt,_free:de,_malloc:Ae,Mesh:class{constructor(){this.ptr=xe()}destroy(){Me(this.ptr)}},Decoder:class{constructor(){this.ptr=Be()}destroy(){zt(this.ptr)}DecodeArrayToMesh(ai,Qt,Ht){const Zi=ni(ai),Kt=ut(this.ptr,Zi,Qt,Ht.ptr);return!!Le(Kt)}GetAttributeByUniqueId(ai,Qt){return{ptr:Xe(this.ptr,ai.ptr,Qt)}}GetTrianglesUInt16Array(ai,Qt,Ht){ht(this.ptr,ai.ptr,Qt,Ht)}GetTrianglesUInt32Array(ai,Qt,Ht){_t(this.ptr,ai.ptr,Qt,Ht)}GetAttributeDataArrayForAllPoints(ai,Qt,Ht,Zi,Kt){bt(this.ptr,ai.ptr,Qt.ptr,Ht,Zi,Kt)}},DT_INT8:Ct(),DT_UINT8:at(),DT_INT16:st(),DT_UINT16:St(),DT_UINT32:Dt(),DT_FLOAT32:xt()}})}(fetch(gU())),Bw.then(U=>{rd=U,Bw=void 0}))}()),z&&R.push(function(){if(eR)return;const U=function(q){let X;const Q=WebAssembly.instantiateStreaming(q,{}).then(le=>{X=le.instance,X.exports.__wasm_call_ctors()}),ee={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},oe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Q,supported:!0,decodeGltfBuffer(le,de,Ae,xe,Me,Le){(function(Be,ut,Xe,ht,_t,bt,zt){const Et=Be.exports.sbrk,vt=ht+3&-4,Ct=Et(vt*_t),at=Et(bt.length),st=new Uint8Array(Be.exports.memory.buffer);st.set(bt,at);const St=ut(Ct,ht,_t,at,bt.length);if(St===0&&zt&&zt(Ct,vt,_t),Xe.set(st.subarray(Ct,Ct+ht*_t)),Et(Ct-Et(0)),St!==0)throw new Error(`Malformed buffer data: ${St}`)})(X,X.exports[oe[Me]],le,de,Ae,xe,X.exports[ee[Le]])}}}(fetch(yU()));return U.ready.then(()=>{eR=U})}()),_)for(let U=0;U<_.length;U++)R.push(vhe(_[U],p,U,l));return(R.length?Promise.all(R):Promise.resolve()).then(()=>{if(j&&v)for(const{primitives:U}of v)for(const q of U)ghe(q,p);if(z&&v&&A)for(const U of A)yhe(U,p);return p})})}function TU(u){return fetch(u).then(s=>s.arrayBuffer()).then(s=>SU(s,0,u))}function iR(u){switch(u){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 nR(u){switch(u){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 rR{constructor(s,l,p,m){this.context=s,this.format=p,this.useMipmap=m&&m.useMipmap,this.texture=s.gl.createTexture(),this.update(l,{premultiply:m&&m.premultiply})}update(s,l){const p=s&&s instanceof HTMLVideoElement&&s.width===0?s.videoWidth:s.width,m=s&&s instanceof HTMLVideoElement&&s.height===0?s.videoHeight:s.height,{context:_}=this,{gl:v}=_,{x:w,y:A}=l&&l.position?l.position:{x:0,y:0},k=w+p,R=A+m;!this.size||this.size[0]===k&&this.size[1]===R||(v.bindTexture(v.TEXTURE_2D,null),v.deleteTexture(this.texture),this.texture=v.createTexture(),this.size=null),v.bindTexture(v.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA8&&(!l||l.premultiply!==!1));const j=s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||ImageBitmap&&s instanceof ImageBitmap;if(!this.size&&k>0&&R>0){const z=this.useMipmap?Math.floor(Math.log2(Math.max(k,R)))+1:1;v.texStorage2D(v.TEXTURE_2D,z,this.format,k,R),this.size=[k,R]}this.size&&(j?v.texSubImage2D(v.TEXTURE_2D,0,w,A,iR(this.format),nR(this.format),s):"data"in s&&s.data&&v.texSubImage2D(v.TEXTURE_2D,0,w,A,p,m,iR(this.format),nR(this.format),s.data)),this.useMipmap&&v.generateMipmap(v.TEXTURE_2D)}bind(s,l,p=!1){const{context:m}=this,{gl:_}=m;_.bindTexture(_.TEXTURE_2D,this.texture),s!==this.minFilter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,s),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,this.useMipmap&&!p?s===_.NEAREST?_.NEAREST_MIPMAP_NEAREST:_.LINEAR_MIPMAP_LINEAR:s),this.minFilter=s),l!==this.wrapS&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,l),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,l),this.wrapS=l)}bindExtraParam(s,l,p,m,_){const{context:v}=this,{gl:w}=v;w.bindTexture(w.TEXTURE_2D,this.texture),l!==this.magFilter&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MAG_FILTER,l),this.magFilter=l),s!==this.minFilter&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,this.useMipmap?s===w.NEAREST?w.NEAREST_MIPMAP_NEAREST:w.LINEAR_MIPMAP_LINEAR:s),this.minFilter=s),p!==this.wrapS&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,p),this.wrapS=p),m!==this.wrapT&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,m),this.wrapT=m),_!==this.compareMode&&(_?(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_COMPARE_MODE,w.COMPARE_REF_TO_TEXTURE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_COMPARE_FUNC,_)):w.texParameteri(w.TEXTURE_2D,w.TEXTURE_COMPARE_MODE,w.NONE),this.compareMode=_)}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}class Vw{constructor(s,l){this.context=s,this.texture=l}bind(s,l){const{context:p}=this,{gl:m}=p;m.bindTexture(m.TEXTURE_2D,this.texture),s!==this.minFilter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,s),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,s),this.minFilter=s),l!==this.wrapS&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,l),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,l),this.wrapS=l)}}const xhe=wn([{name:"a_pos_3f",components:3,type:"Float32"}]),bhe=wn([{name:"a_color_3f",components:3,type:"Float32"}]),whe=wn([{name:"a_color_4f",components:4,type:"Float32"}]),She=wn([{name:"a_uv_2f",components:2,type:"Float32"}]),The=wn([{name:"a_normal_3f",components:3,type:"Float32"}]),Che=wn([{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"}]),Ehe=wn([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function CU(u,s){const l=Q2(u.projection,u.zoom,u.width,u.height),p=function(_,v,w,A,k){const R=new H(w.lng-180*nm,w.lat),j=new H(w.lng+180*nm,w.lat),z=_.project(R.lng,R.lat),U=_.project(j.lng,j.lat),q=-Math.atan2(U.y-z.y,U.x-z.x),X=Ke.fromLngLat(w);X.y=re(X.y,-1+nm,1-nm);const Q=X.toLngLat(),ee=_.project(Q.lng,Q.lat),oe=Ke.fromLngLat(Q);oe.x+=nm;const le=oe.toLngLat(),de=_.project(le.lng,le.lat),Ae=AU(de.x-ee.x,de.y-ee.y,q),xe=Ke.fromLngLat(Q);xe.y+=nm;const Me=xe.toLngLat(),Le=_.project(Me.lng,Me.lat),Be=AU(Le.x-ee.x,Le.y-ee.y,q),ut=Math.abs(Ae.x)/Math.abs(Be.y),Xe=W([]);we(Xe,Xe,-q*(1-(k?0:A)));const ht=W([]);return ce(ht,ht,[1,1-(1-ut)*A,1]),ht[4]=-Be.x/Be.y*A,we(ht,ht,q),G(ht,Xe,ht),ht}
vendor: 4,154 bytes, line 821
821(u.projection,0,u.center,l,s),m=EU(u);return ce(p,p,[m,m,1]),p}function EU(u){const s=u.projection,l=Q2(u.projection,u.zoom,u.width,u.height),p=sR(s,u.center),m=sR(s,H.convert(s.center));return Math.pow(2,p*l+(1-l)*m)}function Q2(u,s,l,p,m=1/0){const _=u.range;if(!_)return 0;const v=Math.min(m,Math.max(l,p)),w=Math.log2(v/1024);return ge(_[0]+w,_[1]+w,s)}const nm=1/4e4;function sR(u,s){const l=re(s.lat,-me,me),p=new H(s.lng-180*nm,l),m=new H(s.lng+180*nm,l),_=u.project(p.lng,l),v=u.project(m.lng,l),w=Ke.fromLngLat(p),A=Ke.fromLngLat(m),k=v.x-_.x,R=v.y-_.y,j=A.x-w.x,z=A.y-w.y,U=Math.sqrt((j*j+z*z)/(k*k+R*R));return Math.log2(U)}function AU(u,s,l){const p=Math.cos(l),m=Math.sin(l);return{x:u*p-s*m,y:u*m+s*p}}function IU(u,s,l){W(u),we(u,u,Pn(s[2])),_e(u,u,Pn(s[0])),Te(u,u,Pn(s[1])),ce(u,u,l),G(u,u,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function J2(u,s,l,p,m,_,v,w){const A=[l[0]-s[0],l[1]-s[1],0],k=[p[0]-s[0],p[1]-s[1],0];if(qt(A)<1e-12||qt(k)<1e-12)return wi(u);const R=Xi([],A,k);Ei(R,R),lt(k,p,s),A[2]=(_-m)*w,k[2]=(v-m)*w;const j=A;return Xi(j,A,k),Ei(j,j),ta(u,R,j)}function eA(u,s,l=!1){const p=em(s.zoom),m=function(_,v,w){const A=v.worldSize,k=[_[12],_[13],_[14]],R=ue(k[1]/A),j=fe(k[0]/A),z=W([]),U=ae(1,R)*A,q=ae(1,0)*A*Se(R,v.zoom),X=1/RD(A);let Q=q*X;if(w){const de=Q2(v.projection,v.zoom,v.width,v.height,1024);Q=X*v.projection.pixelSpaceConversion(v.center.lat,A,de)}const ee=M(R,j);Fe(ee,ee,Ot([],Ei([],ee),U*Q*k[2]));const oe=function(de){const Ae=[de[0],de[1],de[2]];let xe=[0,1,0];const Me=Xi([],xe,Ae);return Xi(xe,Ae,Me),si(xe)===0&&(xe=[0,1,0],Xi(Me,Ae,xe)),Ei(Me,Me),Ei(xe,xe),Ei(Ae,Ae),[Me[0],Me[1],Me[2],0,xe[0],xe[1],xe[2],0,Ae[0],Ae[1],Ae[2],0,de[0],de[1],de[2],1]}(ee);ce(z,z,[Q,Q,Q*U]),te(z,z,[-k[0],-k[1],-k[2]]);const le=G([],v.globeMatrix,oe);return G(le,le,z),G(le,le,_),le}(u,s,l);if(p>0){const _=function(v,w){const A=w.worldSize,k=ae(1,0)*A*Se(w.center.lat,w.zoom)/RD(A),R=ae(1,w.center.lat)*A,j=W([]);Te(j,j,Pn(w.center.lng)),_e(j,j,Pn(w.center.lat)),te(j,j,[0,0,Ja]),ce(j,j,[k,k,k*R]);const z=w.point;return te(j,j,[-z.x,-z.y,0]),G(j,j,v),G(j,w.globeMatrix,j)}(u,s);return function(v,w,A){const k=(q,X,Q)=>{const ee=qt(q),oe=qt(X),le=vp(q,X,Q);return Ot(le,le,1/qt(le)*Vi(ee,oe,Q))},R=k([v[0],v[1],v[2]],[w[0],w[1],w[2]],A),j=k([v[4],v[5],v[6]],[w[4],w[5],w[6]],A),z=k([v[8],v[9],v[10]],[w[8],w[9],w[10]],A),U=vp([v[12],v[13],v[14]],[w[12],w[13],w[14]],A);return[R[0],R[1],R[2],0,j[0],j[1],j[2],0,z[0],z[1],z[2],0,U[0],U[1],U[2],1]}(m,_,p)}return m}function oR(u,s,l,p){const m=gn.projectAabbCorners(p,l);let _=Number.MAX_VALUE;for(let w=0;w<m.length;++w){const A=m[w];A[0]=(.5*A[0]+.5)*s.width,A[1]=(.5-.5*A[1])*s.height,A[2]<_&&(_=A[2])}const v=function(w){const A=[];let k=0;for(let U=1;U<w.length;U++)(w[U][0]<w[k][0]||w[U][0]===w[k][0]&&w[U][1]<w[k][1])&&(k=U);let R,j=k;const z=new Uint8Array(w.length);do{if(z[j])break;A.push(new Tt(w[j][0],w[j][1])),z[j]=1,R=(j+1)%w.length;for(let U=0;U<w.length;U++){if(w[U][0]===w[R][0]&&w[U][1]===w[R][1]||w[U][0]===w[j][0]&&w[U][1]===w[j][1])continue;const q=[w[U][0]-w[j][0],w[U][1]-w[j][1]],X=[w[R][0]-w[j][0],w[R][1]-w[j][1]],Q=q[0]*X[1]-q[1]*X[0];(Q>0||Q===0&&q[0]*X[0]+q[1]*X[1]>=0&&q[0]*q[0]+q[1]*q[1]>X[0]*X[0]+X[1]*X[1])&&(R=U)}j=R}while(j!==k);return A.length>0&&A.push(A[0]),A}(m);if(Ps(u,v))return _}const zy=64,Cx={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function tA(u,s,l,p,m,_,v,w,A,k=!1){const R=l.zoom,j=l.project(p),z=Se(p.lat,R),U=1/z;W(u),te(u,u,[j.x+v[0]*U,j.y+v[1]*U,v[2]]);let q=1,X=1;const Q=l.worldSize;if(k){if(l.projection.name==="mercator"){let de=0;l.elevation&&(de=l.elevation.getAtPointOrZero(new Ke(j.x/Q,j.y/Q),0));const Ae=$t([],[j.x,j.y,de,1],l.projMatrix)[3]/l.cameraToCenterDistance;q=Ae,X=Ae*Se(l.center.lat,R)}else if(l.projection.name==="globe"){const de=eA(u,l),Ae=[0,0,0,1];$t(Ae,Ae,G([],l.projMatrix,de));const xe=Ae[3]/l.cameraToCenterDistance,Me=em(R),Le=l.projection.pixelsPerMeter(p.lat,Q)*Se(p.lat,R),Be=l.projection.pixelsPerMeter(l.center.lat,Q)*Se(l.center.lat,R);q=xe/Vi(Le,Ie(l.center.lat),Me),X=xe*z/Le,q*=Be,X*=Be}}else q=U;ce(u,u,[q,q,X]);const ee=[...u],oe=s.orientation,le=[];
vendor: 20,329 bytes, line 821
821if(IU(le,[oe[0]+(m?m[0]:0),oe[1]+(m?m[1]:0),oe[2]+(m?m[2]:0)],_),G(u,ee,le),w&&l.elevation){let de=0;const Ae=[];if(A&&l.elevation){de=function(Me,Le,Be,ut,Xe){const ht=Le.elevation;if(!ht)return 0;const _t=gn.projectAabbCorners(Be,ut),bt=ae(1,Xe.lat)*Le.worldSize,zt=function(Qt,Ht){const Zi=[0,0,1],Kt=[{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 Ii of Kt){const tn=Qt[Ii.corners[0]],yn=Qt[Ii.corners[1]],Un=Qt[Ii.corners[2]],sn=[yn[0]-tn[0],yn[1]-tn[1],Ht*(yn[2]-tn[2])],Qn=Xi(sn,sn,[Un[0]-tn[0],Un[1]-tn[1],Ht*(Un[2]-tn[2])]);Ei(Qn,Qn),Ii.dotProductWithUp=Ai(Qn,Zi)}return Kt.sort((Ii,tn)=>Ii.dotProductWithUp-tn.dotProductWithUp),Kt[0].corners}(_t,bt),Et=_t[zt[0]],vt=_t[zt[1]],Ct=_t[zt[2]],at=_t[zt[3]],st=ht.getAtPointOrZero(new Ke(Et[0]/Le.worldSize,Et[1]/Le.worldSize),0),St=ht.getAtPointOrZero(new Ke(vt[0]/Le.worldSize,vt[1]/Le.worldSize),0),Dt=ht.getAtPointOrZero(new Ke(Ct[0]/Le.worldSize,Ct[1]/Le.worldSize),0),xt=ht.getAtPointOrZero(new Ke(at[0]/Le.worldSize,at[1]/Le.worldSize),0),ni=(st+xt)/2,ai=(St+Dt)/2;return ni>ai?St<Dt?J2(Me,vt,at,Et,St,xt,st,bt):J2(Me,Ct,Et,at,Dt,st,xt,bt):st<xt?J2(Me,Et,vt,Ct,st,St,Dt,bt):J2(Me,at,Ct,vt,xt,Dt,St,bt),Math.max(ni,ai)}(Ae,l,s.aabb,u,p);const xe=G([],De([],Ae),le);G(u,ee,xe)}else de=l.elevation.getAtPointOrZero(new Ke(j.x/Q,j.y/Q),0);de!==0&&(u[14]+=de)}}class kU{constructor(s,l,p,m,_){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=s,this.uri=l,this.position=p!=null?new H(p[0],p[1]):new H(0,0),this.orientation=m??[0,0,0],this.nodes=_,this.uploaded=!1,this.aabb=new gn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(s,l){G(s.globalMatrix,l,s.localMatrix);const p=this.nodeOverrides.get(s.name);if(p!==void 0){const v=[];_=p.orientation,W(m=v),Te(m,m,Pn(_[1])),we(m,m,Pn(_[2])),_e(m,m,Pn(_[0])),G(s.globalMatrix,s.globalMatrix,v)}var m,_;if(s.meshes)for(const v of s.meshes){const w=gn.applyTransformFast(v.aabb,s.globalMatrix);this.aabb.encapsulate(w)}if(s.children)for(const v of s.children)this._applyTransformations(v,s.globalMatrix)}computeBoundsAndApplyParent(){const s=W([]);this.aabb=new gn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const l of this.nodes)this._applyTransformations(l,s)}computeModelMatrix(s,l,p,m,_,v,w=!1){tA(this.matrix,this,s.transform,this.position,l,p,m,_,v,w)}upload(s){if(!this.uploaded){for(const l of this.nodes)aR(l,s);for(const l of this.nodes)iA(l);this.uploaded=!0}}destroy(){for(const s of this.nodes)lR(s)}}function $w(u,s,l=!1){u.uploaded||(u.gfxTexture=new rR(s,u.image,l?s.gl.R8:s.gl.RGBA8,{useMipmap:u.sampler.minFilter>=s.gl.NEAREST_MIPMAP_NEAREST}),u.uploaded=!0,u.image=null)}function Ahe(u,s,l){u.indexBuffer=s.createIndexBuffer(u.indexArray,!1,!0),u.vertexBuffer=s.createVertexBuffer(u.vertexArray,xhe.members,!1,!0),u.normalArray&&(u.normalBuffer=s.createVertexBuffer(u.normalArray,The.members,!1,!0)),u.texcoordArray&&(u.texcoordBuffer=s.createVertexBuffer(u.texcoordArray,She.members,!1,!0)),u.colorArray&&(u.colorBuffer=s.createVertexBuffer(u.colorArray,(u.colorArray.bytesPerElement===12?bhe:whe).members,!1,!0)),u.featureArray&&(u.pbrBuffer=s.createVertexBuffer(u.featureArray,Ehe.members,!0)),u.segments=ls.simpleSegment(0,0,u.vertexArray.length,u.indexArray.length);const p=u.material;p.pbrMetallicRoughness.baseColorTexture&&$w(p.pbrMetallicRoughness.baseColorTexture,s),p.pbrMetallicRoughness.metallicRoughnessTexture&&$w(p.pbrMetallicRoughness.metallicRoughnessTexture,s),p.normalTexture&&$w(p.normalTexture,s),p.occlusionTexture&&$w(p.occlusionTexture,s,l),p.emissionTexture&&$w(p.emissionTexture,s)}function aR(u,s,l){if(u.meshes)for(const p of u.meshes)Ahe(p,s,l);if(u.children)for(const p of u.children)aR(p,s,l)}function iA(u){if(u.meshes)for(const s of u.meshes)s.indexArray.destroy(),s.vertexArray.destroy(),s.colorArray&&s.colorArray.destroy(),s.normalArray&&s.normalArray.destroy(),s.texcoordArray&&s.texcoordArray.destroy(),s.featureArray&&s.featureArray.destroy();if(u.children)for(const s of u.children)iA(s)}function lR(u){if(u.meshes)for(const l of u.meshes)l.vertexBuffer&&(l.vertexBuffer.destroy(),l.indexBuffer.destroy(),l.normalBuffer&&l.normalBuffer.destroy(),l.texcoordBuffer&&l.texcoordBuffer.destroy(),l.colorBuffer&&l.colorBuffer.destroy(),l.pbrBuffer&&l.pbrBuffer.destroy(),l.segments.destroy(),l.material&&((s=l.material).pbrMetallicRoughness.baseColorTexture&&s.pbrMetallicRoughness.baseColorTexture.gfxTexture&&s.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),s.pbrMetallicRoughness.metallicRoughnessTexture&&s.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&s.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),s.normalTexture&&s.normalTexture.gfxTexture&&s.normalTexture.gfxTexture.destroy(),s.emissionTexture&&s.emissionTexture.gfxTexture&&s.emissionTexture.gfxTexture.destroy(),s.occlusionTexture&&s.occlusionTexture.gfxTexture&&s.occlusionTexture.gfxTexture.destroy()));var s;if(u.children)for(const l of u.children)lR(l)}function Ly(u,s){const l=u.json.bufferViews[s.bufferView],p=X2[s.componentType];return new p(u.buffers[l.buffer],(s.byteOffset||0)+(l.byteOffset||0),s.count*(l.byteStride&&l.byteStride!==Uw[s.type]*p.BYTES_PER_ELEMENT?l.byteStride/p.BYTES_PER_ELEMENT:Uw[s.type]))}function cR(u,s,l,p){const m=X2[s.componentType],_=function(R){switch(R){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(m),v=u.json.bufferViews[s.bufferView],w=v.byteStride?v.byteStride/m.BYTES_PER_ELEMENT:Uw[s.type],A=l.float32,k=A.length/l.capacity;for(let R=0,j=0;R<s.count*w;R+=w,j+=k)for(let z=0;z<k;z++)A[j+z]=p[R+z]*_;l._trim()}function Ihe(u,s,l){const p=u.indices,m=u.attributes,_={};_.indexArray=new Xr;const v=s.json.accessors[p],w=v.count/3;_.indexArray.reserve(w);const A=Ly(s,v);for(let z=0;z<w;z++)_.indexArray.emplaceBack(A[3*z],A[3*z+1],A[3*z+2]);_.indexArray._trim(),_.vertexArray=new Ll;const k=s.json.accessors[m.POSITION];_.vertexArray.reserve(k.count);const R=Ly(s,k);for(let z=0;z<k.count;z++)_.vertexArray.emplaceBack(R[3*z],R[3*z+1],R[3*z+2]);if(_.vertexArray._trim(),_.aabb=new gn(k.min,k.max),_.centroid=function(z,U){const q=[0,0,0],X=z.length;if(X>0){for(let Q=0;Q<X;Q++){const ee=3*z[Q];q[0]+=U[ee],q[1]+=U[ee+1],q[2]+=U[ee+2]}q[0]/=X,q[1]/=X,q[2]/=X}return q}(A,R),m.COLOR_0!==void 0){const z=s.json.accessors[m.COLOR_0],U=Uw[z.type],q=Ly(s,z);_.colorArray=U===3?new Ll:new oh,_.colorArray.resize(z.count),cR(s,z,_.colorArray,q)}if(m.NORMAL!==void 0){_.normalArray=new Ll;const z=s.json.accessors[m.NORMAL];_.normalArray.resize(z.count);const U=Ly(s,z);cR(s,z,_.normalArray,U)}if(m.TEXCOORD_0!==void 0&&l.length>0){_.texcoordArray=new ah;const z=s.json.accessors[m.TEXCOORD_0];_.texcoordArray.resize(z.count);const U=Ly(s,z);cR(s,z,_.texcoordArray,U)}if(m._FEATURE_ID_RGBA4444!==void 0){const z=s.json.accessors[m._FEATURE_ID_RGBA4444];s.json.extensionsUsed&&s.json.extensionsUsed.includes("EXT_meshopt_compression")&&(_.featureData=Ly(s,z))}m._FEATURE_RGBA4444!==void 0&&(_.featureData=new Uint32Array(Ly(s,s.json.accessors[m._FEATURE_RGBA4444]).buffer));const j=u.material;return _.material=function(z,U){const{emissiveFactor:q=[0,0,0],alphaMode:X="OPAQUE",alphaCutoff:Q=.5,normalTexture:ee,occlusionTexture:oe,emissiveTexture:le,doubleSided:de,name:Ae}=z,{baseColorFactor:xe=[1,1,1,1],metallicFactor:Me=1,roughnessFactor:Le=1,baseColorTexture:Be,metallicRoughnessTexture:ut}=z.pbrMetallicRoughness||{},Xe=oe?U[oe.index]:void 0;if(oe&&oe.extensions&&oe.extensions.KHR_texture_transform&&Xe){const ht=oe.extensions.KHR_texture_transform;Xe.offsetScale=[ht.offset[0],ht.offset[1],ht.scale[0],ht.scale[1]]}return{name:Ae,pbrMetallicRoughness:{baseColorFactor:new lr(...xe),metallicFactor:Me,roughnessFactor:Le,baseColorTexture:Be?U[Be.index]:void 0,metallicRoughnessTexture:ut?U[ut.index]:void 0},doubleSided:de,emissiveFactor:new lr(...q),alphaMode:X,alphaCutoff:Q,normalTexture:ee?U[ee.index]:void 0,occlusionTexture:Xe,emissionTexture:le?U[le.index]:void 0,defined:z.defined===void 0}}(j!==void 0?s.json.materials[j]:{defined:!1},l),_}function PU(u,s,l){const{matrix:p,rotation:m,translation:_,scale:v,mesh:w,extras:A,children:k,name:R}=u,j={};if(j.name=R,j.localMatrix=p||function(z,U,q,X){var Q=U[0],ee=U[1],oe=U[2],le=U[3],de=Q+Q,Ae=ee+ee,xe=oe+oe,Me=Q*de,Le=Q*Ae,Be=Q*xe,ut=ee*Ae,Xe=ee*xe,ht=oe*xe,_t=le*de,bt=le*Ae,zt=le*xe,Et=X[0],vt=X[1],Ct=X[2];return z[0]=(1-(ut+ht))*Et,z[1]=(Le+zt)*Et,z[2]=(Be-bt)*Et,z[3]=0,z[4]=(Le-zt)*vt,z[5]=(1-(Me+ht))*vt,z[6]=(Xe+_t)*vt,z[7]=0,z[8]=(Be+bt)*Ct,z[9]=(Xe-_t)*Ct,z[10]=(1-(Me+ut))*Ct,z[11]=0,z[12]=q[0],z[13]=q[1],z[14]=q[2],z[15]=1,z}([],m||[0,0,0,1],_||[0,0,0],v||[1,1,1]),j.globalMatrix=B(j.localMatrix),w!==void 0){j.meshes=l[w];const z=j.anchor=[0,0];for(const U of j.meshes){const{min:q,max:X}=U.aabb;z[0]+=q[0]+X[0],z[1]+=q[1]+X[1]}z[0]=Math.floor(z[0]/j.meshes.length/2),z[1]=Math.floor(z[1]/j.meshes.length/2)}if(A&&(A.id&&(j.id=A.id),A.lights&&(j.lights=function(z){if(!z.length)return[];const U=function(oe){const le=atob(oe),de=new Uint8Array(le.length);for(let Ae=0;Ae<le.length;Ae++)de[Ae]=le.codePointAt(Ae);return de}(z),q=[],X=U.length/24,Q=new Uint16Array(U.buffer),ee=new Float32Array(U.buffer);for(let oe=0;oe<X;oe++){const le=Q[2*oe*6]/30,de=Q[2*oe*6+1]/30,Ae=Q[2*oe*6+10]/100,xe=ee[6*oe+1],Me=ee[6*oe+2],Le=ee[6*oe+3],Be=ee[6*oe+4],ut=Le-xe,Xe=Be-Me,ht=Math.hypot(ut,Xe);q.push({pos:[xe+.5*ut,Me+.5*Xe,de],normal:[Xe/ht,-ut/ht,0],width:ht,height:le,depth:Ae,points:[xe,Me,Le,Be]})}return q}(A.lights)),A.MAPBOX_geometry_bloom&&(j.isGeometryBloom=A.MAPBOX_geometry_bloom)),k){const z=[];for(const U of k)z.push(PU(s.json.nodes[U],s,l));j.children=z}return j}function khe(u){if(u.vertices.length===0||u.indices.length===0)return null;const s=new V2(u.vertices,u.indices,8,256),[l,p]=[s.min.clone(),s.max.clone()];return{vertices:u.vertices,indices:u.indices,grid:s,min:l,max:p}}function Phe(u){if(!u.extras||!u.extras.ground)return null;const s=u.extras.ground;if(!s||!Array.isArray(s)||s.length===0)return null;const l=s[0];if(!l||!Array.isArray(l)||l.length===0)return null;const p=[];for(const v of l){if(!Array.isArray(v)||v.length!==2)continue;const w=v[0],A=v[1];typeof w=="number"&&typeof A=="number"&&p.push(new Tt(w,A))}if(p.length<3)return null;p.length>1&&p[p.length-1].equals(p[0])&&p.pop();let m=0;for(let v=0;v<p.length;v++){const w=p[v],A=p[(v+1)%p.length],k=p[(v+2)%p.length];m+=(w.x-A.x)*(k.y-A.y)-(k.x-A.x)*(w.y-A.y)}m>0&&p.reverse();const _=vx(p.flatMap(v=>[v.x,v.y]),[]);return _.length===0?null:{vertices:p,indices:_}}function Nhe(u,s){const l=[],p=[];let m=0;const _=[];for(const v of u){m=l.length;const w=v.vertexArray.float32,A=v.indexArray.uint16;for(let k=0;k<v.vertexArray.length;k++)_[0]=w[3*k+0],_[1]=w[3*k+1],_[2]=w[3*k+2],zi(_,_,s),l.push(new Tt(_[0],_[1]));for(let k=0;k<3*v.indexArray.length;k++)p.push(A[k]+m)}if(p.length%3!=0)return null;for(let v=0;v<p.length;v+=3){const w=l[p[v+0]],A=l[p[v+1]],k=l[p[v+2]];(w.x-A.x)*(k.y-A.y)-(k.x-A.x)*(w.y-A.y)>0&&([p[v+1],p[v+2]]=[p[v+2],p[v+1]])}return{vertices:l,indices:p}}function uR(u){const s=function(A,k){const R=[],j=WebGL2RenderingContext;if(A.json.textures)for(const z of A.json.textures){const U={magFilter:j.LINEAR,minFilter:j.NEAREST,wrapS:j.REPEAT,wrapT:j.REPEAT};z.sampler!==void 0&&Object.assign(U,A.json.samplers[z.sampler]),R.push({image:k[z.source],sampler:U,uploaded:!1})}return R}(u,u.images),l=function(A,k){const R=[];for(const j of A.json.meshes){const z=[];for(const U of j.primitives)z.push(Ihe(U,A,k));R.push(z)}return R}(u,s),{scenes:p,scene:m,nodes:_}=u.json,v=p?p[m||0].nodes:[..._.keys()],w=[];for(const A of v)w.push(PU(_[A],u,l));return function(A,k,R){const j={},z=new Set;for(let U=0;U<A.length;U++){const q=R[k[U]];if(!q.extras)continue;const X=q.extras["mapbox:footprint:version"],Q=q.extras["mapbox:footprint:id"];(X||Q)&&z.add(U),X==="1.0.0"&&Q&&(j[Q]=U)}for(let U=0;U<A.length;U++){if(z.has(U))continue;const q=A[U],X=R[k[U]];if(!X.extras)continue;let Q=null;q.id in j&&(Q=Nhe(A[j[q.id]].meshes,q.localMatrix)),Q||(Q=Phe(X)),Q&&(q.footprint=khe(Q))}if(z.size>0){const U=Array.from(z.values()).sort((q,X)=>q-X);for(let q=U.length-1;q>=0;q--)A.splice(U[q],1)}}(w,v,u.json.nodes),w}function Mhe(u){u.heightmap=new Float32Array(4096),u.heightmap.fill(-1);const s=u.vertexArray.float32,l=u.aabb.min[0]-1,p=u.aabb.min[1]-1,m=zy/(u.aabb.max[0]-l+2),_=zy/(u.aabb.max[1]-p+2);for(let v=0;v<s.length;v+=3){const w=s[v+2],A=(s[v+0]-l)*m|0,k=(s[v+1]-p)*_|0;w>u.heightmap[k*zy+A]&&(u.heightmap[k*zy+A]=w)}}function NU(u,s,l,p,m){l.reserve(l.length+4*u.length),p.reserve(p.length+10*u.length),m.reserve(m.length+10*u.length);let _=p.length;for(const v of u){const w=Math.min(10,Math.max(4,1.3*v.height))*s,A=[-v.normal[1],v.normal[0],0],k=Math.min(.29,.1*v.width/v.depth),R=v.width-2*v.depth*s*(k+.01),j=Ci([],v.pos,A,R/2),z=Ci([],v.pos,A,-R/2),U=[j[0],j[1],j[2]+v.height],q=[z[0],z[1],z[2]+v.height],X=Ci([],v.normal,A,k);Ot(X,X,w);const Q=Ci([],v.normal,A,-k);Ot(Q,Q,w),Fe(X,j,X),Fe(Q,z,Q),j[2]+=.1,z[2]+=.1,p.emplaceBack(X[0],X[1],X[2]),p.emplaceBack(Q[0],Q[1],Q[2]),p.emplaceBack(j[0],j[1],j[2]),p.emplaceBack(z[0],z[1],z[2]),p.emplaceBack(U[0],U[1],U[2]),p.emplaceBack(q[0],q[1],q[2]),p.emplaceBack(j[0],j[1],j[2]),p.emplaceBack(z[0],z[1],z[2]),p.emplaceBack(X[0],X[1],X[2]),p.emplaceBack(Q[0],Q[1],Q[2]);const ee=R/w/2;m.emplaceBack(-ee-k,-1,ee,.8),m.emplaceBack(ee+k,-1,ee,.8),m.emplaceBack(-ee,0,ee,1.3),m.emplaceBack(ee,0,ee,1.3),m.emplaceBack(ee+k,-.8,ee,.7),m.emplaceBack(ee+k,-.8,ee,.7),m.emplaceBack(0,0,ee,1.3),m.emplaceBack(0,0,ee,1.3),m.emplaceBack(ee+k,-1.2,ee,.8),m.emplaceBack(ee+k,-1.2,ee,.8),l.emplaceBack(6+_,4+_,8+_),l.emplaceBack(7+_,9+_,5+_),l.emplaceBack(0+_,1+_,2+_),l.emplaceBack(1+_,3+_,2+_),_+=10}}function Dhe(u,s){const l={};l.indexArray=new Xr,l.vertexArray=new Ll,l.colorArray=new oh,NU(u,s,l.indexArray,l.vertexArray,l.colorArray);const p={defined:!0};p.emissiveFactor=lr.black;const m={};return m.baseColorFactor=lr.white,p.pbrMetallicRoughness=m,l.material=p,l.aabb=new gn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),l}const MU=wn([{name:"a_pos_3f",components:3,type:"Float32"}]),Rhe=wn([{name:"a_normal_3",components:3,type:"Int16"}]),jhe=wn([{name:"a_centroid_3",components:3,type:"Int16"}]),DU=wn([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),zhe=wn([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),Lhe=wn([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),Ohe=wn([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),Fhe=wn([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Bhe=wn([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),RU=wt.types,nA=32767;function Uhe(u,s){const l=Ft+s;for(const p of u)for(const m of p)if(m.x<-s||m.x>l||m.y<-s||m.y>l)return!1;return!0}class jU{constructor(){this.layoutVertexArray=new Ll,this.layoutAttenuationArray=new oh,this.layoutColorArray=new Sc,this.indexArray=new Xr,this.indexArrayForConflation=new Xr,this.segmentsBucket=new ls}}class dR{constructor(){this.layoutVertexArray=new Ll,this.layoutNormalArray=new mp,this.layoutCentroidArray=new mp,this.layoutColorArray=new Sc,this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.layoutFloodLightDataArray=new cx,this.layoutAOArray=new ed,this.indexArray=new Xr,this.indexArrayForConflation=new Xr,this.segmentsBucket=new ls,this.entranceBloom=new jU}}class zU{constructor(s){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.buildingWithoutFacade=new dR,this.buildingWithFacade=new dR,this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.footprintLookup={},this.zoom=s.zoom,this.canonical=s.canonical,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.worldview=s.worldview,this.lut=s.lut,this.buildingWithFacade.layoutFacadePaintArray=new Sc,this.buildingWithFacade.layoutFacadeDataArray=new gp,this.buildingWithFacade.layoutFacadeVerticalRangeArray=new Sc,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut}),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.projection=s.projection,this.groundEffect=new ZD(s),this.groundEffect.groundRadiusArray=new ed,this.hasAppearances=null}updateFootprints(s,l){for(const p of this.footprints)l.push({footprint:p,id:s})}updateAppearances(s,l,p,m){}prepare(){return function(){if(Z2!=null||mU!=null)return null;if(Tx!=null)return Tx;const s=fetch(Vr.BUILDING_GEN_URL);return Tx=function(l){let p,m,_,v;function w(){p=new Uint8Array(v.buffer),m=new Int32Array(v.buffer),_=new Float32Array(v.buffer)}function A(){throw new Error("Unexpected BuildingGen error.")}const k=()=>{},R={a:{a:A,f:function(j){const z=p.length,U=Math.max(j>>>0,Math.ceil(1.2*z)),q=Math.ceil((U-z)/65536);try{return v.grow(q),w(),!0}catch{return!1}},g:A,b:k,c:k,d:k,e:k}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(l,R):l.then(j=>j.arrayBuffer()).then(j=>WebAssembly.instantiate(j,R))).then(j=>{const z=j.instance.exports;return(0,z.g)(),v=z.f,w(),new phe({setStyle:z.h,setAOOptions:z.i,setMetricOptions:z.j,setStructuralOptions:z.k,setFacadeOptions:z.l,setFauxFacadeOptions:z.m,setFacadeClassifierOptions:z.n,addFeature:z.o,addFacade:z.p,generateMesh:z.q,getLastError:z.r,getOuterRingLength:z.s,getMeshCount:z.t,getPositionsPtr:z.u,getPositionsLength:z.v,getNormalsPtr:z.w,getNormalsLength:z.x,getColorsPtr:z.y,getColorsLength:z.z,getAOPtr:z.A,getAOLength:z.B,getUVPtr:z.C,getUVLength:z.D,getFauxFacadePtr:z.E,getFauxFacadeLength:z.F,getIndicesPtr:z.G,getIndicesLength:z.H,getBuildingPart:z.I,getRingCount:z.J,getRingPtr:z.K,getRingLength:z.L,free:z.M,malloc:z.N,heapU8:p,heap32:m,heapF32:_})})}(s).then(l=>(Tx=null,Z2=l,Z2)).catch(l=>{di("Could not load building-gen"),Tx=null,mU=l}),Tx}()}populate(s,l,p,m){const _=fhe();if(!_)return;const v=ke(p);this.tileToMeter=v,this.brightness=l.brightness,_.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,v],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:v,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),_.setAOOptions(!1,.3),_.setMetricOptions(!1,16),_.setStructuralOptions(!0),_.setFacadeClassifierOptions(3);const w=new Map,A=new Map;for(const{feature:k}of s){if(RU[k.type]!=="LineString"){w.set(k.id,k.properties.source_id);continue}const R=this.layers[0]._featureFilter.needGeometry,j=nt(k,R);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),j,p))continue;const z=R?j.geometry:yt(k,p,m),U=[];for(const ee of z)for(const oe of ee)U.push({x:oe.x,y:oe.y});const q={coordinates:U,crossPerc:k.properties.cross_perc,distanceToRoad:k.properties.distance_to_road,entrances:k.properties.entrances,sourceId:0},X=k.properties.source_id;let Q=A.get(X);Q||(Q=[],A.set(X,Q)),Q.push(q)}this.maxHeight=0;for(const{feature:k,id:R,index:j,sourceLayerIndex:z}of s){if(RU[k.type]==="LineString")continue;const U=this.layers[0]._featureFilter.needGeometry,q=nt(k,U);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom),q,p))continue;const X=U?q.geometry:yt(k,p,m),Q=Mw(X,500);if(!Uhe(X,163))continue;const ee=this.layers[0],oe=ee.layout.get("building-roof-shape").evaluate(k,{},p);if(oe==="flat")continue;const le=ee.layout.get("building-base").evaluate(k,{},p),de=ee.layout.get("building-height").evaluate(k,{},p),Ae=ee.layout.get("building-flood-light-ground-radius").evaluate(k,{},p),xe=ee.paint.get("building-ambient-occlusion-intensity"),Me=Ae/this.tileToMeter;let Le=ee.layout.get("building-flood-light-wall-radius").evaluate(k,{},p);Le=re(Le,0,2048);const Be=Le/2048*nA,ut=w.get(R);let Xe;Xe=A.has(ut)?A.get(ut):[];const ht=Xe.length!==0&&ee.layout.get("building-facade").evaluate(k,{},p);_.setFacadeOptions(4,!0),_.setFauxFacadeOptions(ht,!1,1);let _t=0,bt=0,zt=0,Et=0,vt=0,Ct=0;
821if(ht){let mt=Math.round(ee.layout.get("building-facade-floors").evaluate(k,{},p));if(le===0){mt=Math.max(1,mt-(Xe.length>0?1:0));let yi=4;if(de>100){const fi=[10,13,15];yi=fi[k.id?k.id%fi.length:0],_.setFacadeOptions(yi,!0)}vt=1.6803*yi/v}else vt=le/v;Ct=de/v,vt=Math.min(vt,Ct),zt=ee.layout.get("building-facade-unit-width").evaluate(k,{},p)/v,Et=(Ct-vt)/mt,_.setFauxFacadeOptions(!0,!0,zt);const Gt=ee.layout.get("building-facade-window").evaluate(k,{},p);_t=Gt[0],bt=Gt[1]}const at=[],st=new Tt(1/0,1/0),St=new Tt(-1/0,-1/0),Dt=new Tt(0,0);let xt=0;for(const mt of Q)if(mt.length>0){const Gt=[];for(const yi of mt){const fi=[];for(let cn=yi.length-1;cn>=0;cn--){const Fi=yi[cn];fi.push({x:Fi.x,y:Fi.y}),st.x=Math.min(st.x,Fi.x),st.y=Math.min(st.y,Fi.y),St.x=Math.max(St.x,Fi.x),St.y=Math.max(St.y,Fi.y),Dt.x+=Fi.x,Dt.y+=Fi.y,xt++}Gt.push(fi)}at.push({id:k.id?k.id:0,height:de,minHeight:le,sourceId:0,roofType:oe,coordinates:Gt})}Dt.x/=xt||1,Dt.y/=xt||1;const ni=_.generateMesh(at,Xe);if(typeof ni=="string"){di(`Unable to generate building ${k.id}: ${ni}`);continue}if(ni.meshes.length===0||ni.modifiedPolygonRings.length===0)continue;let ai=0;for(const mt of ni.meshes)ai+=mt.positions.length/3;const Qt=ht?this.buildingWithFacade:this.buildingWithoutFacade,Ht=Qt.segmentsBucket.prepareSegment(ai,Qt.layoutVertexArray,Qt.indexArray),Zi=[];let Kt=null,Ii=0,tn=-1;const yn=Qt.layoutVertexArray.length,Un=Qt.indexArray.length;let sn=0;for(const mt of ni.meshes){const Gt=Qt.layoutVertexArray.length;if(mt.buildingPart==="entrance"){const ui=new Array;for(let On=0;On<mt.positions.length;On+=12){const Er=mt.positions[On+0],cr=mt.positions[On+1],ys=mt.positions[On+3],qr=mt.positions[On+4],Nr=mt.positions[On+2],mr=mt.positions[On+8]-Nr,er=1,un=ys-Er,tr=qr-cr,Mr=Math.hypot(un,tr);ui.push({pos:[Er+.5*un,cr+.5*tr,Nr],normal:[tr/Mr,-un/Mr,0],width:Mr,height:mr,depth:er,points:[Er,cr,ys,qr]})}const Kn=Qt.entranceBloom.segmentsBucket.prepareSegment(10*ui.length,Qt.entranceBloom.layoutVertexArray,Qt.entranceBloom.indexArray),Cr=Qt.entranceBloom.layoutVertexArray.length;Ii=Qt.entranceBloom.indexArray.length,NU(ui,.5/this.tileToMeter,Qt.entranceBloom.indexArray,Qt.entranceBloom.layoutVertexArray,Qt.entranceBloom.layoutAttenuationArray);const Ui=Qt.entranceBloom.layoutVertexArray.length-Cr;tn=Qt.entranceBloom.indexArray.length-Ii;for(let On=0;On<Ui;On++)Qt.entranceBloom.layoutColorArray.emplaceBack(65535,65535);Kn.vertexLength+=Ui,Kn.primitiveLength+=tn,Kt={part:mt.buildingPart,vertexOffset:Cr,vertexLength:Ui}}for(let ui=0;ui<mt.positions.length;ui+=3)sn=Math.max(sn,mt.positions[ui+2]),Qt.layoutVertexArray.emplaceBack(mt.positions[ui],mt.positions[ui+1],mt.positions[ui+2]);const yi=Math.floor(Dt.x),fi=Math.floor(Dt.y),cn=Math.floor(sn);for(let ui=0;ui<mt.positions.length;ui+=3)Qt.layoutCentroidArray.emplaceBack(yi,fi,cn),Qt.layoutFloodLightDataArray.emplaceBack(mt.buildingPart==="wall"?Be:0);for(let ui=0;ui<mt.normals.length;ui+=3)Qt.layoutNormalArray.emplaceBack(mt.normals[ui+0]*nA,mt.normals[ui+1]*nA,mt.normals[ui+2]*nA);for(let ui=0;ui<mt.ao.length;ui++)Qt.layoutAOArray.emplaceBack(mt.ao[ui]);for(let ui=0;ui<mt.colors.length;ui+=3){const Kn=1+(mt.ao[ui/3]-1)*xe;Qt.layoutColorArray.emplaceBack(mt.colors[ui]*Kn<<8|mt.colors[ui+1]*Kn,mt.colors[ui+2]*Kn<<8)}if(ht){for(let ui=0;ui<mt.positions.length;ui+=3)Qt.layoutFacadePaintArray.emplaceBack(65535,255);for(let ui=0;ui<mt.isFauxFacade.length;ui++)if(mt.isFauxFacade[ui]){const Kn=1|Math.min(65535,Math.floor(mt.uv[2*ui]*ni.outerRingLength)),Cr=Math.floor(255*_t)<<8|Math.floor(255*bt),Ui=Math.floor(65535*Math.min(1,zt/Ft)),On=Math.floor(65535*Math.min(1,Et/Ft));Qt.layoutFacadeDataArray.emplaceBack(Kn,Cr,Ui,On);const Er=Math.floor(65535*Math.min(1,vt/Ft)),cr=Math.floor(65535*Math.min(1,Ct/Ft));Qt.layoutFacadeVerticalRangeArray.emplaceBack(Er,cr)}else Qt.layoutFacadeDataArray.emplaceBack(0,0,0,0),Qt.layoutFacadeVerticalRangeArray.emplaceBack(0,0)}const Fi=Ht.vertexLength;for(let ui=0;ui<mt.indices.length;ui+=3)Qt.indexArray.emplaceBack(Fi+mt.indices[ui],Fi+mt.indices[ui+1],Fi+mt.indices[ui+2]);Ht.vertexLength+=mt.positions.length/3,Ht.primitiveLength+=mt.indices.length/3,(mt.buildingPart==="roof"||mt.buildingPart==="wall"||mt.buildingPart==="facade_glazing"||mt.buildingPart==="entrance")&&Zi.push({part:mt.buildingPart,vertexOffset:Gt,vertexLength:mt.positions.length/3})}this.maxHeight=Math.max(this.maxHeight,sn),this.buildingFeatures.push({promoteId:R,feature:q,hasFauxFacade:ht,segment:Ht,parts:Zi,buildingBloom:Kt});const Qn=Qt.indexArray.length-Un,Jn=[],is=[],be=new Tt(1/0,1/0),ye=new Tt(-1/0,-1/0),ft=this.groundEffect.vertexArray.length;for(const mt of ni.modifiedPolygonRings){const Gt=[],yi=new Tt(1/0,1/0),fi=new Tt(-1/0,-1/0);for(let cn=0;cn<mt.length;cn+=2){const Fi=mt.length-cn-2;yi.x=Math.min(yi.x,mt[Fi]),yi.y=Math.min(yi.y,mt[Fi+1]),fi.x=Math.max(fi.x,mt[Fi]),fi.y=Math.max(fi.y,mt[Fi+1]);const ui=new Tt(mt[Fi],mt[Fi+1]);
vendor: 11,755 bytes, line 821
821Gt.push(ui),Jn.push(ui.x,ui.y),is.push(ui.clone())}be.x=Math.min(be.x,yi.x),be.y=Math.min(be.y,yi.y),ye.x=Math.max(ye.x,fi.x),ye.y=Math.max(ye.y,fi.y),this.groundEffect.addData(Gt,[yi,fi],Me)}const Ut=this.groundEffect.vertexArray.length-ft;for(let mt=0;mt<Ut;mt++)this.groundEffect.groundRadiusArray.emplaceBack(Ae);(st.x<0||St.x>Ft||st.y<0||St.y>Ft)&&this.featuresOnBorder.push({featureId:k.id,footprintIndex:this.footprints.length});{const mt=vx(Jn,null,2),Gt=new V2(is,mt,8,256);let yi=k.id;k.properties&&k.properties.hasOwnProperty("building_id")&&(yi=k.properties.building_id);const fi={vertices:is,indices:mt,grid:Gt,min:be,max:ye,buildingId:yi,hiddenFlags:0,indicesOffset:Un,indicesLength:Qn,bloomIndicesOffset:Ii,bloomIndicesLength:tn,groundEffectVertexOffset:ft,groundEffectVertexLength:Ut,hasFauxFacade:ht,segment:Ht,height:sn};k.id!==void 0&&this.featureFootprintLookup.set(k.id,this.footprints.length),this.footprints.push(fi)}this.programConfigurations.populatePaintArrays(Qt.layoutVertexArray.length,k,j,{},l.availableImages,p,l.brightness),this.groundEffect.addPaintPropertiesData(k,j,{},l.availableImages,p,l.brightness),l.featureIndex.insert(k,X,j,z,this.index,yn)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0],{})}update(s,l,p,m,_,v,w){this.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w),this.groundEffect.update(s,l,_,p,m,v,w),this.evaluate(this.layers[0],s),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(s){const l=p=>{p.layoutVertexBuffer=s.createVertexBuffer(p.layoutVertexArray,MU.members),p.layoutNormalBuffer=s.createVertexBuffer(p.layoutNormalArray,Rhe.members),p.layoutCentroidBuffer=s.createVertexBuffer(p.layoutCentroidArray,jhe.members),p.layoutFloodLightDataBuffer=s.createVertexBuffer(p.layoutFloodLightDataArray,Bhe.members),p.layoutFacadeDataArray&&p.layoutFacadeDataArray.length&&(p.layoutFacadeDataBuffer=s.createVertexBuffer(p.layoutFacadeDataArray,Lhe.members)),p.layoutFacadeVerticalRangeArray&&p.layoutFacadeVerticalRangeArray.length&&(p.layoutFacadeVerticalRangeBuffer=s.createVertexBuffer(p.layoutFacadeVerticalRangeArray,Ohe.members)),p.entranceBloom.layoutVertexArray.length&&(p.entranceBloom.layoutVertexBuffer=s.createVertexBuffer(p.entranceBloom.layoutVertexArray,MU.members),p.entranceBloom.layoutAttenuationBuffer=s.createVertexBuffer(p.entranceBloom.layoutAttenuationArray,Fhe.members)),this.uploadUpdatedColorBuffer(s),this.uploadUpdatedIndexBuffer(s)};this.uploaded||(l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.groundEffect.upload(s)),this.groundEffect.uploadPaintProperties(s),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){const s=l=>{l.layoutVertexBuffer&&(l.layoutVertexBuffer.destroy(),l.layoutNormalBuffer.destroy(),l.layoutColorBuffer.destroy(),l.segmentsBucket.destroy(),l.indexBuffer&&l.indexBuffer.destroy(),l.entranceBloom.layoutVertexBuffer&&(l.entranceBloom.layoutVertexBuffer.destroy(),l.entranceBloom.layoutColorBuffer.destroy(),l.entranceBloom.layoutAttenuationBuffer.destroy(),l.entranceBloom.indexBuffer.destroy(),l.entranceBloom.segmentsBucket.destroy()))};s(this.buildingWithoutFacade),s(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(s,l,p=!0){let m=!1;const _=p?l:0,v=0|(p?-1:~l);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const w of s){const A=this.footprints[w],k=A.hiddenFlags&v|_;A.hiddenFlags!==k&&(A.hiddenFlags=k,m=!0,this.groundEffect.updateHiddenByLandmarkRange(A.groundEffectVertexOffset,A.groundEffectVertexLength,A.hiddenFlags!==0))}return m&&(this.indexArrayForConflationUploaded=!1),m}uploadUpdatedIndexBuffer(s){if(this.groundEffect.uploadHiddenByLandmark(s),this.indexArrayForConflationUploaded)return;const l=m=>{m.indexArray.length!==0&&(m.indexArrayForConflation.resize(m.indexArray.length),m.indexArrayForConflation.uint16.set(m.indexArray.uint16),m.entranceBloom.indexArrayForConflation.resize(m.entranceBloom.indexArray.length),m.entranceBloom.indexArrayForConflation.uint16.set(m.entranceBloom.indexArray.uint16))};l(this.buildingWithoutFacade),l(this.buildingWithFacade);for(const m of this.footprints){const _=m.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,v=m.indicesOffset+m.indicesLength;if(m.hiddenFlags!==0){for(let A=m.indicesOffset;A<v;A++)_.indexArrayForConflation.uint16[3*A+0]=0,_.indexArrayForConflation.uint16[3*A+1]=0,_.indexArrayForConflation.uint16[3*A+2]=0;const w=m.bloomIndicesOffset+m.bloomIndicesLength;for(let A=m.bloomIndicesOffset;A<w;A++)_.entranceBloom.indexArrayForConflation.uint16[3*A+0]=0,_.entranceBloom.indexArrayForConflation.uint16[3*A+1]=0,_.entranceBloom.indexArrayForConflation.uint16[3*A+2]=0}}const p=m=>{m.indexArray.length!==0&&(m.indexBuffer?m.indexBuffer.updateData(m.indexArrayForConflation):m.indexBuffer=s.createIndexBuffer(m.indexArrayForConflation,!0),m.entranceBloom.indexBuffer?m.entranceBloom.indexBuffer.updateData(m.entranceBloom.indexArrayForConflation):m.entranceBloom.indexBuffer=s.createIndexBuffer(m.entranceBloom.indexArrayForConflation,!0))};p(this.buildingWithoutFacade),p(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(s){const l=p=>{p.layoutColorBuffer?p.layoutColorBuffer.updateData(p.layoutColorArray):p.layoutColorBuffer=s.createVertexBuffer(p.layoutColorArray,DU.members,!0),p.layoutFacadePaintArray&&(p.layoutFacadePaintBuffer?p.layoutFacadePaintBuffer.updateData(p.layoutFacadePaintArray):p.layoutFacadePaintBuffer=s.createVertexBuffer(p.layoutFacadePaintArray,zhe.members,!0)),p.entranceBloom.layoutColorBuffer?p.entranceBloom.layoutColorBuffer.updateData(p.entranceBloom.layoutColorArray):p.entranceBloom.layoutColorBuffer=s.createVertexBuffer(p.entranceBloom.layoutColorArray,DU.members,!0)};l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(s,l){const p=s.paint.get("building-ambient-occlusion-intensity");for(const m of this.buildingFeatures){const _=l[m.promoteId],v=m.feature;v.properties["building-part"]="roof";const w=s.paint.get("building-color").evaluate(v,_,this.canonical).toPremultipliedRenderColor(this.lut),A=s.paint.get("building-emissive-strength").evaluate(v,_,this.canonical);v.properties["building-part"]="wall";const k=s.paint.get("building-color").evaluate(v,_,this.canonical).toPremultipliedRenderColor(this.lut),R=s.paint.get("building-emissive-strength").evaluate(v,_,this.canonical);v.properties["building-part"]="window";const j=s.paint.get("building-color").evaluate(v,_,this.canonical).toPremultipliedRenderColor(this.lut),z=s.paint.get("building-emissive-strength").evaluate(v,_,this.canonical);v.properties["building-part"]="door";const U=s.paint.get("building-color").evaluate(v,_,this.canonical).toPremultipliedRenderColor(this.lut),q=s.paint.get("building-emissive-strength").evaluate(v,_,this.canonical),X=m.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const ee of m.parts){let oe,le=w;ee.part==="roof"?(le=w,oe=A):ee.part==="wall"?(le=k,oe=R):ee.part==="facade_glazing"?(le=j,oe=z):ee.part==="entrance"&&(le=U,oe=q),oe=re(oe,0,1);for(let de=0;de<ee.vertexLength;de++){const Ae=ee.vertexOffset+de,xe=1+(X.layoutAOArray.float32[Ae]-1)*p;X.layoutColorArray.emplace(Ae,le.r*xe*255<<8|le.g*xe*255,le.b*xe*255<<8|255*oe),m.hasFauxFacade&&X.layoutFacadePaintArray.emplace(Ae,255*j.r<<8|255*j.g,255*j.b<<8|255*z)}}const Q=m.buildingBloom;if(Q)for(let ee=0;ee<Q.vertexLength;ee++)X.entranceBloom.layoutColorArray.emplace(Q.vertexOffset+ee,255*U.r<<8|255*U.g,255*U.b<<8|51*q)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(s,l,p){if(l.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=l.updateTime;const m=l.getReplacementRegionsForTile(s.toUnwrapped());if(q2(this.activeReplacements,m))return;this.activeReplacements=m;for(const v of this.footprints)v.hiddenFlags&=-2;const _=[];for(const v of this.activeReplacements){if(v.order<=L5)continue;const w=Math.max(1,Math.pow(2,v.footprintTileId.canonical.z-s.canonical.z));for(const A of this.footprints)A.min.x>v.max.x||A.max.x<v.min.x||A.min.y>v.max.y||A.max.y<v.min.y||(_.length=0,Vhe(A.vertices,0,A.vertices.length,v.footprintTileId.canonical,s.canonical,_),HD(v.footprint,_,A.indices,0,A.indices.length,0,-w)&&(A.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const v of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(v.groundEffectVertexOffset,v.groundEffectVertexLength,v.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(s){if(s.id!==void 0){const l=this.featureFootprintLookup.get(s.id);return this.footprints[l]}return null}getHeightAtTileCoord(s,l){let p=Number.NEGATIVE_INFINITY,m=!0;const _=4*(s+Ft)*Ft+(l+Ft);if(this.footprintLookup.hasOwnProperty(_)){const w=this.footprintLookup[_];return w?{height:w.height,hidden:w.hiddenFlags!==0}:void 0}const v=new Tt(s,l);for(const w of this.footprints)s>w.max.x||w.min.x>s||l>w.max.y||w.min.y>l||w.height<=p||GD(v,w)&&(p=w.height,this.footprintLookup[_]=w,m=w.hiddenFlags!==0);if(p!==Number.NEGATIVE_INFINITY)return{height:p,hidden:m};this.footprintLookup[_]=void 0}}function Vhe(u,s,l,p,m,_){const v=Math.pow(2,p.z-m.z);for(let w=0;w<l;w++){let A=u[w+s].x,k=u[w+s].y;A=(A+m.x*Ft)*v-p.x*Ft,k=(k+m.y*Ft)*v-p.y*Ft,_.push(new Tt(A,k))}}let LU,OU;ri(zU,"BuildingBucket",{omit:["layers"]}),ri(dR,"BuildingGeometry"),ri(jU,"BuildingBloomGeometry");const $he=wn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),qhe=wn([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:Hhe}=$he,Ghe=wn([{name:"a_packed",components:3,type:"Float32"}]),{members:Whe}=Ghe,Khe=wn([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Zhe}=Khe;class FU{constructor(s,l){this.width=s,this.height=l,this.nextRow=0,this.image=new tm({width:s,height:l}),this.positions={},this.uploaded=!1}getDash(s,l){const p=this.getKey(s,l);return this.positions[p]}trim(){const s=this.width,l=this.height=He(this.nextRow);this.image.resize({width:s,height:l})}getKey(s,l){return s.join(",")+l}getDashRanges(s,l,p){const m=[];let _=s.length%2==1?-s[s.length-1]*p:0,v=s[0]*p,w=!0;m.push({left:_,right:v,isDash:w,zeroLength:s[0]===0});let A=s[0];for(let k=1;k<s.length;k++){w=!w;const R=s[k];_=A*p,A+=R,v=A*p,m.push({left:_,right:v,isDash:w,zeroLength:R===0})}return m}addRoundDash(s,l,p){const m=l/2;for(let _=-p;_<=p;_++){const v=this.width*(this.nextRow+p+_);let w=0,A=s[w];for(let k=0;k<this.width;k++){k/A.right>1&&(A=s[++w]);const R=Math.abs(k-A.left),j=Math.abs(k-A.right),z=Math.min(R,j);let U;const q=_/p*(m+1);if(A.isDash){const X=m-Math.abs(q);U=Math.sqrt(z*z+X*X)}else U=m-Math.sqrt(z*z+q*q);this.image.data[v+k]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(s,l){for(let A=s.length-1;A>=0;--A){const k=s[A],R=s[A+1];k.zeroLength?s.splice(A,1):R&&R.isDash===k.isDash&&(R.left=k.left,s.splice(A,1))}const p=s[0],m=s[s.length-1];p.isDash===m.isDash&&(p.left=m.left-this.width,m.right=p.right+this.width);const _=this.width*this.nextRow;let v=0,w=s[v];for(let A=0;A<this.width;A++){A/w.right>1&&(w=s[++v]);const k=Math.abs(A-w.left),R=Math.abs(A-w.right),j=Math.min(k,R);this.image.data[_+A]=Math.max(0,Math.min(255,(w.isDash?j:-j)+l+128))}}
821addDash(s,l){const p=this.getKey(s,l);if(this.positions[p])return this.positions[p];const m=l==="round",_=m?7:0,v=2*_+1;if(this.nextRow+v>this.height)return di("LineAtlas out of space"),null;s.length===0&&s.push(1);let w=0;for(let R=0;R<s.length;R++)s[R]<0&&(di("Negative value is found in line dasharray, replacing values with 0"),s[R]=0),w+=s[R];if(w!==0){const R=this.width/w,j=this.getDashRanges(s,this.width,R);m?this.addRoundDash(j,R,_):this.addRegularDash(j,l==="square"?.5*R:0)}const A=this.nextRow+_;this.nextRow+=v;const k={tl:[A,_],br:[w,0]};return this.positions[p]=k,k}}ri(FU,"LineAtlas");const Xhe=wt.types,Yhe=Math.cos(Math.PI/180*37.5),Qhe=Math.cos(Math.PI/180*5);class hR{constructor(s){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=s.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=s.overscaling,this.pixelRatio=s.pixelRatio,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.projection=s.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(l=>{this.gradients[l.id]={}}),this.layoutVertexArray=new sx,this.layoutVertexArray2=new Ll,this.patternVertexArray=new Ll,this.indexArray=new Xr,this.programConfigurations=new Gc(s.layers,{zoom:s.zoom,lut:s.lut}),this.segments=new ls,this.maxLineLength=0,this.zOffsetVertexArray=new Ll,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.tessellationStep=s.tessellationStep?s.tessellationStep:Ft/64,this.worldview=s.worldview,this.hasAppearances=null}updateFootprints(s,l){}updateAppearances(s,l,p,m){}populate(s,l,p,m){this.hasPattern=FD("line",this.layers,this.pixelRatio,l);const _=this.layers[0].layout.get("line-sort-key");this.tileToMeter=ke(p);const v=this.layers[0].layout.get("line-elevation-reference");if(v==="hd-road-markup")this.elevationType="road";else{const z=this.layers[0].layout.get("line-z-offset"),U=z.isConstant()&&!z.constantOr(0);this.elevationType=v!=="sea"&&v!=="ground"&&U?"none":"offset",this.elevationType==="offset"&&v==="none"&&di(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const w=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&w!==void 0;const A=[];for(const{feature:z,id:U,index:q,sourceLayerIndex:X}of s){const Q=this.layers[0]._featureFilter.needGeometry,ee=nt(z,Q);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),ee,p))continue;const oe=_?_.evaluate(ee,{},p):void 0,le={id:U,properties:z.properties,type:z.type,sourceLayerIndex:X,index:q,geometry:Q?ee.geometry:yt(z,p,m),patterns:{},sortKey:oe};A.push(le)}_&&A.sort((z,U)=>z.sortKey-U.sortKey);const{lineAtlas:k,featureIndex:R}=l,j=this.addConstantDashes(k);for(const z of A){const{geometry:U,index:q,sourceLayerIndex:X}=z;if(j&&this.addFeatureDashes(z,k),this.hasPattern){const Q=BD("line",this.layers,z,this.zoom,this.pixelRatio,l);this.patternFeatures.push(Q)}else this.addFeature(z,U,q,p,k.positions,l.availableImages,l.brightness,l.elevationFeatures);R.insert(s[q].feature,U,q,X,this.index)}}addConstantDashes(s){let l=!1;for(const p of this.layers){const m=p.paint.get("line-dasharray").value,_=p.layout.get("line-cap").value;if(m.kind!=="constant"||_.kind!=="constant")l=!0;else{const v=_.value,w=m.value;if(!w)continue;s.addDash(w,v)}}return l}addFeatureDashes(s,l){const p=this.zoom;for(const m of this.layers){const _=m.paint.get("line-dasharray").value,v=m.layout.get("line-cap").value;if(_.kind==="constant"&&v.kind==="constant")continue;let w,A;if(_.kind==="constant"){if(w=_.value,!w)continue}else w=_.evaluate({zoom:p},s);A=v.kind==="constant"?v.value:v.evaluate({zoom:p},s),l.addDash(w,A),s.patterns[m.id]=[l.getKey(w,A)]}}update(s,l,p,m,_,v,w,A){this.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,A)}addFeatures(s,l,p,m,_,v){for(const w of this.patternFeatures)this.addFeature(w,w.geometry,w.index,l,p,m,v)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,Whe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=s.createVertexBuffer(this.patternVertexArray,Zhe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=s.createVertexBuffer(this.zOffsetVertexArray,qhe.members,!0)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Hhe),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s,l){let p,m;if(l&&l>0?(p=`mapbox_clip_start_${l}`,m=`mapbox_clip_end_${l}`):(p="mapbox_clip_start",m="mapbox_clip_end"),s.properties&&s.properties.hasOwnProperty(p)&&s.properties.hasOwnProperty(m))return{start:+s.properties[p],end:+s.properties[m]}}addFeature(s,l,p,m,_,v,w,A){const k=this.layers[0].layout,R=k.get("line-join").evaluate(s,{}),j=k.get("line-cap").evaluate(s,{}),z=k.get("line-miter-limit"),U=k.get("line-round-limit");this.lineClips=this.lineFeatureClips(s),this.lineFeature=s;const q=!(!s.properties||!s.properties.hasOwnProperty("mapbox_line_metrics"))&&s.properties.mapbox_line_metrics;this.zOffsetValue=k.get("line-z-offset").value;const X=this.layers[0].paint.get("line-width").value;if(X.kind!=="constant"&&X.isLineProgressConstant===!1&&(this.variableWidthValue=X),this.elevationType==="road"){const Q=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(s,l,m,A,R,j,z,U)){const[ee,oe]=this.clipRuntimeLinesToTile(l,1);for(let le=0;le<ee.length;le++){const de=ee[le],Ae=oe[le],xe={progress:{min:Ae.progress.min,max:Ae.progress.max},nextDir:this.computeSegNextDir(Ae,de),prevDir:this.computeSegPrevDir(Ae,de)};this.addLine(de,s,m,R,j,z,U,xe,q&&Ae.parentIndex>0?Ae.parentIndex:null)}this.fillNonElevatedRoadSegment(Q)}}else for(let Q=0;Q<l.length;Q++)this.addLine(l[Q],s,m,R,j,z,U,void 0,q&&Q>0?Q:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,_,v,m,w,void 0,this.worldview)}computeSegNextDir(s,l){return s.nextPoint.sub(l.at(-2)).unit()}computeSegPrevDir(s,l){return l[1].sub(s.prevPoint).unit()}clipLinesToTile(s,l){return W2(s,-l,-l,Ft+l,Ft+l)}clipRuntimeLinesToTile(s,l){const p=[];return[W2(s,-l,-l,Ft+l,Ft+l,p),p]}addElevatedRoadFeature(s,l,p,m,_,v,w,A){const k=[],R=Ki.getElevationFeature(s,m);if(R){const j=this.clipLinesToTile(l,1),z=this.prepareElevatedLines(j,R,p);for(const U of z)k.push({geometry:U,elevation:R,elevationTileID:p,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(k.length===0)return!1;for(const j of k){const z=this.layoutVertexArray.length;this.addLine(j.geometry,s,p,_,v,w,A);const U=new Bn(p,j.elevationTileID);if(j.elevation)for(let q=z;q<this.layoutVertexArray.length;q++){const X=new Tt(this.layoutVertexArray.int16[6*q]>>1,this.layoutVertexArray.int16[6*q+1]>>1),Q=U.pointElevation(X,j.elevation,.05);this.updateHeightRange(Q),this.zOffsetVertexArray.emplaceBack(Q,0,0)}else this.fillNonElevatedRoadSegment(z)}return!0}prepareElevatedLines(s,l,p){if(l.constantHeight!=null)return s;const m=[],_=1/ke(p);for(const v of s)uhe(v,new Or(l,_),0,m);return m}fillNonElevatedRoadSegment(s){for(let l=s;l<this.layoutVertexArray.length;l++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(s){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,s),this.heightRange.max=Math.max(this.heightRange.max,s)):this.heightRange={min:s,max:s}}addLine(s,l,p,m,_,v,w,A,k){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
vendor: 8,419 bytes, line 821
821oFar=0,this.currentVertex=void 0,this.lineClips=k?this.lineFeatureClips(l,k):this.lineClips;const R=m==="none";this.patternJoinNone=this.hasPattern&&R,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const j=A&&A.progress.min>0,z=A&&A.progress.max<1;if(this.lineClips){let Be={min:this.lineClips.start,max:this.lineClips.end},ut=1;if(A){const _t=this.lineClips.end-this.lineClips.start;Be=function(bt,zt,Et){return{min:Tr(bt.min,zt,Et),max:Tr(bt.max,zt,Et)}}(A.progress,{min:0,max:1},Be),_t>0&&(ut=(Be.max-Be.min)/_t)}const Xe=+l.properties.mapbox_clip_feature_len,ht=+l.properties.mapbox_clip_seg_len;if(Number.isNaN(Xe)||Number.isNaN(ht)){for(let bt=0;bt<s.length-1;bt++)this.totalDistance+=s[bt].dist(s[bt+1]);const _t=this.totalDistance/(Be.max-Be.min);this.totalFeatureLength=Number.isFinite(_t)?_t:0,this.lineClips.start=Be.min,this.lineClips.end=Be.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Xe,this.distance=ht*ut,this.lineClips.start=Be.min,this.lineClips.end=Be.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const U=Xhe[l.type]==="Polygon";let q=s.length;for(;q>=2&&s[q-1].equals(s[q-2]);)q--;let X=0;for(;X<q-1&&s[X].equals(s[X+1]);)X++;if(q<(U?3:2))return;m==="bevel"&&(v=1.05);const Q=this.segments.prepareSegment(10*q,this.layoutVertexArray,this.indexArray);let ee,oe,le,de,Ae,xe,Me,Le;A&&A.prevDir&&(xe=A.prevDir.perp()),A&&A.nextDir&&(Me=A.nextDir.perp()),this.e1=this.e2=-1,U&&(ee=s[q-2],Ae=s[X].sub(ee)._unit()._perp());for(let Be=X;Be<q;Be++){if(le=Be===q-1?U?s[X+1]:void 0:s[Be+1],le&&s[Be].equals(le))continue;Ae&&(de=Ae),ee&&(oe=ee),ee=s[Be],Le=this.evaluateLineProgressFeatures(oe?oe.dist(ee):0),Ae=le?le.sub(ee)._unit()._perp():de,de=de||Ae;const ut=oe&≤let Xe=ut?m:U||R?"butt":_;const ht=de.x*Ae.x+de.y*Ae.y;if(R){const st=function(St){if(St.patternJoinNone){const Dt=St.segmentPoints.length/2,xt=St.lineSoFar-St.segmentStart;for(let ni=0;ni<Dt;++ni){const ai=St.segmentPoints[2*ni+1],Qt=Math.round(St.segmentPoints[2*ni])+.5+.25*ai;St.patternVertexArray.emplaceBack(Qt,xt,St.segmentStart),St.patternVertexArray.emplaceBack(Qt,xt,St.segmentStart)}St.segmentPoints.length=0}St.e1=St.e2=-1};if(ut&&ht<Qhe){this.updateDistance(oe,ee),this.addCurrentVertex(ee,de,1,1,Q,Le),st(this),this.addCurrentVertex(ee,Ae,-1,-1,Q,Le);continue}if(oe){if(!le){this.updateDistance(oe,ee),this.addCurrentVertex(ee,de,1,1,Q,Le),st(this);continue}Xe="miter"}}let _t=de.add(Ae);_t.x===0&&_t.y===0||_t._unit();const bt=_t.x*Ae.x+_t.y*Ae.y,zt=bt!==0?1/bt:1/0,Et=2*Math.sqrt(2-2*bt),vt=bt<Yhe&&oe&&le,Ct=de.x*Ae.y-de.y*Ae.x>0,at=this.overscaling<=16?15*Ft/(512*this.overscaling):0;if(ut&&Xe==="round"){if(zt<w)Xe="miter";else if(zt<=2){const st=pR(ee,-10,Ft+10);Xe=this.elevationType==="offset"&&(st||this.hasCrossSlope)?"miter":"fakeround"}}if(Xe==="miter"&&zt>v&&(Xe="bevel"),Xe==="bevel"&&(zt>2&&(Xe="flipbevel"),zt<v&&(Xe="miter")),oe&&!(Xe==="miter"&&vt)&&this.updateDistance(oe,ee),Xe==="miter")if(vt){const st=ee.dist(oe);if(st>2*at){const Dt=ee.sub(ee.sub(oe)._mult(at/st)._round());this.updateDistance(oe,Dt),this.addCurrentVertex(Dt,de,0,0,Q,Le),oe=Dt}this.updateDistance(oe,ee),_t._mult(zt),this.addCurrentVertex(ee,_t,0,0,Q,Le);const St=ee.dist(le);if(St>2*at){const Dt=ee.add(le.sub(ee)._mult(at/St)._round());this.updateDistance(ee,Dt),this.addCurrentVertex(Dt,Ae,0,0,Q,Le),ee=Dt}}else _t._mult(zt),this.addCurrentVertex(ee,_t,0,0,Q,Le);else if(Xe==="flipbevel"){if(zt>100)_t=Ae.mult(-1);else{const st=zt*de.add(Ae).mag()/de.sub(Ae).mag();_t._perp()._mult(st*(Ct?-1:1))}this.addCurrentVertex(ee,_t,0,0,Q,Le),this.addCurrentVertex(ee,_t.mult(-1),0,0,Q,Le)}else if(Xe==="bevel"||Xe==="fakeround"){Le!=null&&oe&&this.addCurrentVertex(ee,Me||de,-1,-1,Q,Le);const st=ee.dist(oe)<=2*at&&Xe!=="bevel",St=_t.mult(Ct?1:-1);St._mult(zt);const Dt=Ae.mult(Ct?-1:1),xt=de.mult(Ct?-1:1),ni=this.evaluateLineProgressFeatures(this.distance);if(Le==null&&(this.addHalfVertex(ee,St.x,St.y,!1,!Ct,0,Q,ni),st||this.addHalfVertex(ee,St.x+2*xt.x,St.y+2*xt.y,!1,Ct,0,Q,ni)),Xe==="fakeround"){const ai=Math.round(180*Et/Math.PI/20);this.addHalfVertex(ee,xt.x,xt.y,!1,Ct,0,Q,ni);for(let Qt=0;Qt<ai;Qt++){let Ht=Qt/ai;if(Ht!==.5){const Kt=Ht-.5;Ht+=Ht*Kt*(Ht-1)*((1.0904+ht*(ht*(3.55645-1.43519*ht)-3.2452))*Kt*Kt+(.848013+ht*(.215638*ht-1.06021)))}const Zi=Dt.sub(xt)._mult(Ht)._add(xt)._unit();this.addHalfVertex(ee,Zi.x,Zi.y,!1,Ct,0,Q,ni)}this.addHalfVertex(ee,Dt.x,Dt.y,!1,Ct,0,Q,ni)}st||Le!=null||this.addHalfVertex(ee,St.x+2*Dt.x,St.y+2*Dt.y,!1,Ct,0,Q,ni),Le!=null&&le&&this.addCurrentVertex(ee,xe||Ae,1,1,Q,Le)}else if(Xe==="butt")this.addCurrentVertex(ee,_t,0,0,Q,Le);else if(Xe==="square"){if(!oe){const st=j?0:-1;this.addCurrentVertex(ee,_t,st,st,Q,Le)}if(this.addCurrentVertex(ee,_t,0,0,Q,Le),oe){const st=z?0:1;this.addCurrentVertex(ee,_t,st,st,Q,Le)}}else if(Xe==="round"){if(oe){const st=!ut&&Me?Me:de;this.addCurrentVertex(ee,st,0,0,Q,Le),!ut&&z||this.addCurrentVertex(ee,st,1,1,Q,Le,!0)}if(le){const st=!ut&&xe?xe:Ae;!ut&&j||this.addCurrentVertex(ee,st,-1,-1,Q,Le,!0),this.addCurrentVertex(ee,st,0,0,Q,Le)}}}}addVerticesTo(s,l,p,m,_,v,w,A,k,R){const j=(l.w-s.w)/this.tessellationStep|0;let z=0;const U=this.scaledDistance;if(j>1){this.lineSoFar=s.w;const X=(l.x-s.x)/j,Q=(l.y-s.y)/j,ee=(l.z-s.z)/j,oe=(l.w-s.w)/j;for(let le=1;le<j;++le){s.x+=X,s.y+=Q,s.z+=ee,this.lineSoFar+=oe,z+=oe;const de=this.evaluateLineProgressFeatures(this.prevDistance+z);this.scaledDistance=(this.prevDistance+z)/this.totalDistance,this.addHalfVertex(s,p,m,R,!1,w,k,de),this.addHalfVertex(s,_,v,R,!0,-A,k,de)}}this.lineSoFar=l.w,this.scaledDistance=U;const q=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(l,p,m,R,!1,w,k,q),this.addHalfVertex(l,_,v,R,!0,-A,k,q)}evaluateLineProgressFeatures(s){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+s)/this.totalFeatureLength):di(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let l=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(l=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:l}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:l}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:l}}addCurrentVertex(s,l,p,m,_,v,w=!1){const A=l.x+l.y*p,k=l.y-l.x*p,R=l.y*m-l.x,j=-l.y-l.x*m;if(v!=null){const z=this.elevationType==="offset",U=-10,q=Ft+10,X=v.zOffset,Q=new oU(s.x,s.y,X,this.lineSoFar),ee=!!z&&pR(s,U,q),oe=this.lineSoFar,le=this.distance;if(this.currentVertex)if(ee){const de=this.currentVertexIsOutside,Ae=this.currentVertex,xe=new oU(s.x,s.y,X,this.lineSoFar);if(lU(Ae,xe,U,q),!pR(xe,U,q)){if(de){this.e1=this.e2=-1,this.distance-=Ae.dist(Q),this.lineSoFar=Ae.w;const Me=this.evaluateLineProgressFeatures(Ae.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(Ae,A,k,w,!1,p,_,Me),this.addHalfVertex(Ae,R,j,w,!0,-m,_,Me),this.prevDistance=this.distance}this.distance=this.prevDistance+Ae.dist(xe),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(Ae,xe,A,k,R,j,p,m,_,w),this.distance=le,this.scaledDistance=this.distance/this.totalDistance}}else{const de=this.currentVertex;if(this.currentVertexIsOutside){lU(de,Q,U,q),this.e1=this.e2=-1,this.distance-=de.dist(Q),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=de.w;const Ae=this.evaluateLineProgressFeatures(de.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(de,A,k,w,!1,p,_,Ae),this.addHalfVertex(de,R,j,w,!0,-m,_,Ae),this.prevDistance=this.distance,this.distance=le,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(de,Q,A,k,R,j,p,m,_,w)}else ee||(this.addHalfVertex(s,A,k,w,!1,p,_,v),this.addHalfVertex(s,R,j,w,!0,-m,_,v));this.currentVertex=Q,this.currentVertexIsOutside=ee,this.lineSoFar=oe}else this.addHalfVertex(s,A,k,w,!1,p,_,v),this.addHalfVertex(s,R,j,w,!0,-m,_,v)}addHalfVertex({x:s,y:l},p,m,_,v,w,A,k){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineS
821oFar,this.segmentStartf32=Math.fround(this.lineSoFar)),v||this.segmentPoints.push(this.lineSoFar-this.segmentStart,w)),this.layoutVertexArray.emplaceBack((s<<1)+(_?1:0),(l<<1)+(v?1:0),Math.round(63*p)+128,Math.round(63*m)+128,1+(w===0?0:w<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const j=Vi(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,j)}const R=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),A.primitiveLength++),v?this.e2=R:this.e1=R,k!=null&&this.zOffsetVertexArray.emplaceBack(k.zOffset,k.variableWidth,k.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(s,l){this.prevDistance=this.distance,this.distance+=s.dist(l),this.updateScaledDistance()}}function pR(u,s,l){return u.x<s||u.x>l||u.y<s||u.y>l}let BU,UU;function VU(u,s,l){return s*(Ft/(u.tileSize*Math.pow(2,l-u.tileID.overscaledZ)))}ri(hR,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const $U=(u,s,l)=>(1-l)*u+l*s;function qU(u,s){return 1/VU(u,1,s.tileZoom)}function HU(u,s,l,p){return u.translatePosMatrix(p||s.tileID.projMatrix,s,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}const GU=u=>{const s=[];WU(u)&&s.push("RENDER_LINE_DASH"),u.paint.get("line-gradient")&&s.push("RENDER_LINE_GRADIENT");const l=u.paint.get("line-trim-offset");l[0]===0&&l[1]===0||s.push("RENDER_LINE_TRIM_OFFSET"),u.paint.get("line-border-width").constantOr(1)!==0&&s.push("RENDER_LINE_BORDER");const p=u.layout.get("line-join").constantOr("miter")==="none",m=!!u.paint.get("line-pattern").constantOr(1);return p&&m&&s.push("LINE_JOIN_NONE"),s};function WU(u){const s=u.paint.get("line-dasharray").value;return s.kind!=="constant"||s.value}let fR;const KU=()=>fR||(fR={layout:BU||(BU=new bs({"line-cap":new Zt(Ze.layout_line["line-cap"]),"line-join":new Zt(Ze.layout_line["line-join"]),"line-miter-limit":new Nt(Ze.layout_line["line-miter-limit"]),"line-round-limit":new Nt(Ze.layout_line["line-round-limit"]),"line-sort-key":new Zt(Ze.layout_line["line-sort-key"]),"line-z-offset":new Zt(Ze.layout_line["line-z-offset"]),"line-elevation-reference":new Nt(Ze.layout_line["line-elevation-reference"]),"line-cross-slope":new Nt(Ze.layout_line["line-cross-slope"]),visibility:new Nt(Ze.layout_line.visibility),"line-width-unit":new Nt(Ze.layout_line["line-width-unit"])})),paint:UU||(UU=new bs({"line-opacity":new Zt(Ze.paint_line["line-opacity"]),"line-color":new Zt(Ze.paint_line["line-color"]),"line-translate":new Nt(Ze.paint_line["line-translate"]),"line-translate-anchor":new Nt(Ze.paint_line["line-translate-anchor"]),"line-width":new Zt(Ze.paint_line["line-width"]),"line-gap-width":new Zt(Ze.paint_line["line-gap-width"]),"line-offset":new Zt(Ze.paint_line["line-offset"]),"line-blur":new Zt(Ze.paint_line["line-blur"]),"line-dasharray":new Zt(Ze.paint_line["line-dasharray"]),"line-pattern":new Zt(Ze.paint_line["line-pattern"]),"line-pattern-cross-fade":new Nt(Ze.paint_line["line-pattern-cross-fade"]),"line-gradient":new Ff(Ze.paint_line["line-gradient"]),"line-trim-offset":new Nt(Ze.paint_line["line-trim-offset"]),"line-trim-fade-range":new Nt(Ze.paint_line["line-trim-fade-range"]),"line-trim-color":new Nt(Ze.paint_line["line-trim-color"]),"line-emissive-strength":new Nt(Ze.paint_line["line-emissive-strength"]),"line-border-width":new Zt(Ze.paint_line["line-border-width"]),"line-border-color":new Zt(Ze.paint_line["line-border-color"]),"line-occlusion-opacity":new Nt(Ze.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},fR);class Jhe extends Zt{possiblyEvaluate(s,l){return l=new Rr(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,transition:l.transition,worldview:l.worldview}),super.possiblyEvaluate(s,l)}evaluate(s,l,p,m){return l=Object.assign({},l,{zoom:Math.floor(l.zoom)}
vendor: 12,585 bytes, line 821
821),super.evaluate(s,l,p,m)}}let qw;function ZU(u,s){return s>0?s+2*u:u}const epe=wn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tpe=wn([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),ipe=wn([{name:"a_projected_pos",components:4,type:"Float32"}],4);wn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const npe=wn([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),rpe=wn([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),spe=wn([{name:"a_texb",components:2,type:"Uint16"}]),ope=wn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),ape=wn([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);wn([{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 XU=wn([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lpe=wn([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);wn([{name:"triangle",components:3,type:"Uint16"}]),wn([{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"}]),wn([{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"}]),wn([{type:"Float32",name:"offsetX"}]),wn([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var zo=24;function cpe(u,s,l){return u.sections.forEach(p=>{p.text=function(m,_,v){const w=_.layout.get("text-transform").evaluate(v,{});return w==="uppercase"?m=m.toLocaleUpperCase():w==="lowercase"&&(m=m.toLocaleLowerCase()),gl.applyArabicShaping&&(m=gl.applyArabicShaping(m)),m}(p.text,s,l)}),u}const Hw={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function upe(u){return u==="︶"||u==="ï¹"||u==="︸"||u==="ï¹"||u==="ï¹"||u==="︾"||u==="︼"||u==="︺"||u==="ï¸"||u==="ï¹"||u==="ï¸"||u==="ï¸"||u==="ï¸"||u==="ï½"||u==="ï¿£"||u==="ï¸"||u==="ï¸"}function dpe(u){return u==="︵"||u==="ï¹"||u==="︷"||u==="ï¹"||u==="ï¹"||u==="︽"||u==="︻"||u==="︹"||u==="ï¸"||u==="︿"}const mR=4294967296,YU=1/mR,QU=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let rA=class{constructor(u=new Uint8Array(16)){this.buf=ArrayBuffer.isView(u)?u:new Uint8Array(u),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(u,s,l=this.length){for(;this.pos<l;){const p=this.readVarint(),m=p>>3,_=this.pos;this.type=7&p,u(m,s,this),this.pos===_&&this.skip(p)}return s}readMessage(u,s){return this.readFields(u,s,this.readVarint()+this.pos)}readFixed32(){const u=this.dataView.getUint32(this.pos,!0);return this.pos+=4,u}readSFixed32(){const u=this.dataView.getInt32(this.pos,!0);return this.pos+=4,u}readFixed64(){const u=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*mR;return this.pos+=8,u}readSFixed64(){const u=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*mR;return this.pos+=8,u}readFloat(){const u=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,u}readDouble(){const u=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,u}readVarint(u){const s=this.buf;let l,p;return p=s[this.pos++],l=127&p,p<128?l:(p=s[this.pos++],l|=(127&p)<<7,p<128?l:(p=s[this.pos++],l|=(127&p)<<14,p<128?l:(p=s[this.pos++],l|=(127&p)<<21,p<128?l:(p=s[this.pos],l|=(15&p)<<28,function(m,_,v){const w=v.buf;let A,k;if(k=w[v.pos++],A=(112&k)>>4,k<128||(k=w[v.pos++],A|=(127&k)<<3,k<128)||(k=w[v.pos++],A|=(127&k)<<10,k<128)||(k=w[v.pos++],A|=(127&k)<<17,k<128)||(k=w[v.pos++],A|=(127&k)<<24,k<128)||(k=w[v.pos++],A|=(1&k)<<31,k<128))return Ex(m,A,_);throw new Error("Expected varint not more than 10 bytes")}(l,u,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const u=this.readVarint();return u%2==1?(u+1)/-2:u/2}readBoolean(){return!!this.readVarint()}readString(){const u=this.readVarint()+this.pos,s=this.pos;return this.pos=u,u-s>=12&&QU?QU.decode(this.buf.subarray(s,u)):function(l,p,m){let _="",v=p;for(;v<m;){const w=l[v];let A,k,R,j=null,z=w>239?4:w>223?3:w>191?2:1;if(v+z>m)break;z===1?w<128&&(j=w):z===2?(A=l[v+1],(192&A)==128&&(j=(31&w)<<6|63&A,j<=127&&(j=null))):z===3?(A=l[v+1],k=l[v+2],(192&A)==128&&(192&k)==128&&(j=(15&w)<<12|(63&A)<<6|63&k,(j<=2047||j>=55296&&j<=57343)&&(j=null))):z===4&&(A=l[v+1],k=l[v+2],R=l[v+3],(192&A)==128&&(192&k)==128&&(192&R)==128&&(j=(15&w)<<18|(63&A)<<12|(63&k)<<6|63&R,(j<=65535||j>=1114112)&&(j=null))),j===null?(j=65533,z=1):j>65535&&(j-=65536,_+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),_+=String.fromCharCode(j),v+=z}return _}(this.buf,s,u)}readBytes(){const u=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,u);return this.pos=u,s}readPackedVarint(u=[],s){const l=this.readPackedEnd();for(;this.pos<l;)u.push(this.readVarint(s));return u}readPackedSVarint(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readSVarint());return u}readPackedBoolean(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readBoolean());return u}readPackedFloat(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readFloat());return u}readPackedDouble(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readDouble());return u}readPackedFixed32(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readFixed32());return u}readPackedSFixed32(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readSFixed32());return u}readPackedFixed64(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readFixed64());return u}readPackedSFixed64(u=[]){const s=this.readPackedEnd();for(;this.pos<s;)u.push(this.readSFixed64());return u}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(u){const s=7&u;if(s===0)for(;this.buf[this.pos++]>127;);else if(s===2)this.pos=this.readVarint()+this.pos;else if(s===5)this.pos+=4;else{if(s!==1)throw new Error(`Unimplemented type: ${s}`);this.pos+=8}}writeTag(u,s){this.writeVarint(u<<3|s)}realloc(u){let s=this.length||16;for(;s<this.pos+u;)s*=2;if(s!==this.length){const l=new Uint8Array(s);l.set(this.buf),this.buf=l,this.dataView=new DataView(l.buffer),this.length=s}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(u){this.realloc(4),this.dataView.setInt32(this.pos,u,!0),this.pos+=4}writeSFixed32(u){this.realloc(4),this.dataView.setInt32(this.pos,u,!0),this.pos+=4}writeFixed64(u){this.realloc(8),this.dataView.setInt32(this.pos,-1&u,!0),this.dataView.setInt32(this.pos+4,Math.floor(u*YU),!0),this.pos+=8}writeSFixed64(u){this.realloc(8),this.dataView.setInt32(this.pos,-1&u,!0),this.dataView.setInt32(this.pos+4,Math.floor(u*YU),!0),this.pos+=8}writeVarint(u){(u=+u||0)>268435455||u<0?function(s,l){let p,m;if(s>=0?(p=s%4294967296|0,m=s/4294967296|0):(p=~(-s%4294967296),m=~(-s/4294967296),4294967295^p?p=p+1|0:(p=0,m=m+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");l.realloc(10),function(_,v,w){w.buf[w.pos++]=127&_|128,_>>>=7,w.buf[w.pos++]=127&_|128,_>>>=7,w.buf[w.pos++]=127&_|128,_>>>=7,w.buf[w.pos++]=127&_|128,w.buf[w.pos]=127&(_>>>=7)}(p,0,l),function(_,v){const w=(7&_)<<4;v.buf[v.pos++]|=w|((_>>>=3)?128:0),_&&(v.buf[v.pos++]=127&_|((_>>>=7)?128:0),_&&(v.buf[v.pos++]=127&_|((_>>>=7)?128:0),_&&(v.buf[v.pos++]=127&_|((_>>>=7)?128:0),_&&(v.buf[v.pos++]=127&_|((_>>>=7)?128:0),_&&(v.buf[v.pos++]=127&_)))))}(m,l)}(u,this):(this.realloc(4),this.buf[this.pos++]=127&u|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=127&(u>>>=7)|(u>127?128:0),u<=127||(this.buf[this.pos++]=u>>>7&127))))}writeSVarint(u){this.writeVarint(u<0?2*-u-1:2*u)}writeBoolean(u){this.writeVarint(+u)}writeString(u){u=String(u),this.realloc(4*u.length),this.pos++;const s=this.pos;this.pos=function(p,m,_){for(let v,w,A=0;A<m.length;A++){if(v=m.charCodeAt(A),v>55295&&v<57344){if(!w){v>56319||A+1===m.length?(p[_++]=239,p[_++]=191,p[_++]=189):w=v;continue}if(v<56320){p[_++]=239,p[_++]=191,p[_++]=189,w=v;continue}v=w-55296<<10|v-56320|65536,w=null}else w&&(p[_++]=239,p[_++]=191,p[_++]=189,w=null);v<128?p[_++]=v:(v<2048?p[_++]=v>>6|192:(v<65536?p[_++]=v>>12|224:(p[_++]=v>>18|240,p[_++]=v>>12&63|128),p[_++]=v>>6&63|128),p[_++]=63&v|128)}return _}(this.buf,u,this.pos);const l=this.pos-s;l>=128&&JU(s,l,this),this.pos=s-1,this.writeVarint(l),this.pos+=l}writeFloat(u){this.realloc(4),this.dataView.setFloat32(this.pos,u,!0),this.pos+=4}writeDouble(u){this.realloc(8),this.dataView.setFloat64(this.pos,u,!0),this.pos+=8}writeBytes(u){const s=u.length;this.writeVarint(s),this.realloc(s);for(let l=0;l<s;l++)this.buf[this.pos++]=u[l]}writeRawMessage(u,s){this.pos++;const l=this.pos;u(s,this);const p=this.pos-l;p>=128&&JU(l,p,this),this.pos=l-1,this.writeVarint(p),this.pos+=p}writeMessage(u,s,l){this.writeTag(u,2),this.writeRawMessage(s,l)}writePackedVarint(u,s){s.length&&this.writeMessage(u,hpe,s)}writePackedSVarint(u,s){s.length&&this.writeMessage(u,ppe,s)}
821writePackedBoolean(u,s){s.length&&this.writeMessage(u,gpe,s)}writePackedFloat(u,s){s.length&&this.writeMessage(u,fpe,s)}writePackedDouble(u,s){s.length&&this.writeMessage(u,mpe,s)}writePackedFixed32(u,s){s.length&&this.writeMessage(u,ype,s)}writePackedSFixed32(u,s){s.length&&this.writeMessage(u,_pe,s)}writePackedFixed64(u,s){s.length&&this.writeMessage(u,vpe,s)}writePackedSFixed64(u,s){s.length&&this.writeMessage(u,xpe,s)}writeBytesField(u,s){this.writeTag(u,2),this.writeBytes(s)}writeFixed32Field(u,s){this.writeTag(u,5),this.writeFixed32(s)}writeSFixed32Field(u,s){this.writeTag(u,5),this.writeSFixed32(s)}writeFixed64Field(u,s){this.writeTag(u,1),this.writeFixed64(s)}writeSFixed64Field(u,s){this.writeTag(u,1),this.writeSFixed64(s)}writeVarintField(u,s){this.writeTag(u,0),this.writeVarint(s)}writeSVarintField(u,s){this.writeTag(u,0),this.writeSVarint(s)}writeStringField(u,s){this.writeTag(u,2),this.writeString(s)}writeFloatField(u,s){this.writeTag(u,5),this.writeFloat(s)}writeDoubleField(u,s){this.writeTag(u,1),this.writeDouble(s)}writeBooleanField(u,s){this.writeVarintField(u,+s)}};function Ex(u,s,l){return l?4294967296*s+(u>>>0):4294967296*(s>>>0)+(u>>>0)}function JU(u,s,l){const p=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));l.realloc(p);for(let m=l.pos-1;m>=u;m--)l.buf[m+p]=l.buf[m]}function hpe(u,s){for(let l=0;l<u.length;l++)s.writeVarint(u[l])}function ppe(u,s){for(let l=0;l<u.length;l++)s.writeSVarint(u[l])}function fpe(u,s){for(let l=0;l<u.length;l++)s.writeFloat(u[l])}function mpe(u,s){for(let l=0;l<u.length;l++)s.writeDouble(u[l])}function gpe(u,s){for(let l=0;l<u.length;l++)s.writeBoolean(u[l])}function ype(u,s){for(let l=0;l<u.length;l++)s.writeFixed32(u[l])}function _pe(u,s){for(let l=0;l<u.length;l++)s.writeSFixed32(u[l])}function vpe(u,s){for(let l=0;l<u.length;l++)s.writeFixed64(u[l])}function xpe(u,s){for(let l=0;l<u.length;l++)s.writeSFixed64(u[l])}const gR=3;function bpe(u,s,l){s.glyphs=[],u===1&&l.readMessage(wpe,s)}function wpe(u,s,l){if(u===3){const{id:p,bitmap:m,width:_,height:v,left:w,top:A,advance:k}=l.readMessage(Spe,{});s.glyphs.push({id:p,bitmap:new tm({width:_+2*gR,height:v+2*gR},m),metrics:{width:_,height:v,left:w,top:A,advance:k}})}else u===4?s.ascender=l.readSVarint():u===5&&(s.descender=l.readSVarint())}function Spe(u,s,l){u===1?s.id=l.readVarint():u===2?s.bitmap=l.readBytes():u===3?s.width=l.readVarint():u===4?s.height=l.readVarint():u===5?s.left=l.readSVarint():u===6?s.top=l.readSVarint():u===7&&(s.advance=l.readVarint())}const eV=gR,ql={horizontal:1,vertical:2,horizontalOnly:3};class Gw{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(s,l){const p=new Gw;return p.scale=s||1,p.fontStack=l,p}static forImage(s){const l=new Gw;return l.image=s,l}}class Ax{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,l,p){const m=new Ax;for(let _=0;_<s.sections.length;_++){const v=s.sections[_];v.image?m.addImageSection(v,p):m.addTextSection(v,l)}return m}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSections(){return this.sections}getSectionIndex(s){return this.sectionIndex[s]}getCodePoint(s){return this.text.codePointAt(s)}verticalizePunctuation(s){this.text=function(l,p){let m="";for(let _=0;_<l.length;_++){const v=l.charCodeAt(_+1)||null,w=l.charCodeAt(_-1)||null;m+=!p&&(v&&X1(v)&&!Hw[l[_+1]]||w&&X1(w)&&!Hw[l[_-1]])||!Hw[l[_]]?l[_]:Hw[l[_]]}return m}(this.text,s)}trim(){let s=0;for(let p=0;p<this.text.length&&sA[this.text.charCodeAt(p)];p++)s++;let l=this.text.length;for(let p=this.text.length-1;p>=0&&p>=s&&sA[this.text.charCodeAt(p)];p--)l--;this.text=this.text.substring(s,l),this.sectionIndex=this.sectionIndex.slice(s,l)}substring(s,l){const p=new Ax;return p.text=this.text.substring(s,l),p.sectionIndex=this.sectionIndex.slice(s,l),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,l)=>Math.max(s,this.sections[l].scale),0)}addTextSection(s,l){this.text+=s.text,this.sections.push(Gw.forText(s.scale,s.fontStack||l));const p=this.sections.length-1;for(let m=0;m<s.text.length;++m)this.sectionIndex.push(p)}addImageSection(s,l){const p=s.image?s.image.getPrimary():null;if(!p)return void di("Can't add FormattedSection with an empty image.");p.scaleSelf(l);const m=this.getNextImageSectionCharCode();m?(this.text+=String.fromCodePoint(m),this.sections.push(Gw.forImage(p)),this.sectionIndex.push(this.sections.length-1)):di("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function yR(u,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X=1){const Q=Ax.fromFeature(u,m,X);j===ql.vertical&&Q.verticalizePunctuation(z);let ee=[];const oe=function(Me,Le,Be,ut,Xe,ht){if(!Me)return[];const _t=[],bt=function(Ct,at,st,St,Dt,xt){let ni=0;for(let ai=0;ai<Ct.length();ai++){const Qt=Ct.getSection(ai);ni+=tV(Ct.getCodePoint(ai),Qt,St,Dt,at,xt)}return ni/Math.max(1,Math.ceil(ni/st))}(Me,Le,Be,ut,Xe,ht),zt=Me.text.indexOf("â")>=0;let Et=0;for(let Ct=0;Ct<Me.length();Ct++){const at=Me.getSection(Ct),st=Me.getCodePoint(Ct);if(sA[st]||(Et+=tV(st,at,ut,Xe,Le,ht)),Ct<Me.length()-1){const St=!((vt=st)<11904||!(Ri["Bopomofo Extended"](vt)||Ri.Bopomofo(vt)||Ri["CJK Compatibility Forms"](vt)||Ri["CJK Compatibility Ideographs"](vt)||Ri["CJK Compatibility"](vt)||Ri["CJK Radicals Supplement"](vt)||Ri["CJK Strokes"](vt)||Ri["CJK Symbols and Punctuation"](vt)||Ri["CJK Unified Ideographs Extension A"](vt)||Ri["CJK Unified Ideographs"](vt)||Ri["Enclosed CJK Letters and Months"](vt)||Ri["Halfwidth and Fullwidth Forms"](vt)||Ri.Hiragana(vt)||Ri["Ideographic Description Characters"](vt)||Ri["Kangxi Radicals"](vt)||Ri["Katakana Phonet
821ic Extensions"](vt)||Ri.Katakana(vt)||Ri["Vertical Forms"](vt)||Ri["Yi Radicals"](vt)||Ri["Yi Syllables"](vt)));(Tpe[st]||St||at.image)&&_t.push(nV(Ct+1,Et,bt,_t,Cpe(st,Me.getCodePoint(Ct+1),St&&zt),!1))}}var vt;return rV(nV(Me.length(),Et,bt,_t,0,!0))}(Q,k,_,s,p,U),{processBidirectionalText:le,processStyledBidirectionalText:de}=gl;if(le&&Q.sections.length===1){const Me=le(Q.toString(),oe);for(const Le of Me){const Be=new Ax;Be.text=Le,Be.sections=Q.sections;for(let ut=0;ut<Le.length;ut++)Be.sectionIndex.push(0);ee.push(Be)}}else if(de){const Me=de(Q.text,Q.sectionIndex,oe);for(const Le of Me){const Be=new Ax;Be.text=Le[0],Be.sectionIndex=Le[1],Be.sections=Q.sections,ee.push(Be)}}else ee=function(Me,Le){const Be=[],ut=Me.text;let Xe=0;for(const ht of Le)Be.push(Me.substring(Xe,ht)),Xe=ht;return Xe<ut.length&&Be.push(Me.substring(Xe,ut.length)),Be}(Q,oe);const Ae=[],xe={positionedLines:Ae,text:Q.toString(),top:R[1],bottom:R[1],left:R[0],right:R[0],writingMode:j,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(Me,Le,Be,ut,Xe,ht,_t,bt,zt,Et,vt,Ct){let at=0,st=0,St=0;const Dt=bt==="right"?1:bt==="left"?0:.5;let xt=!1;for(const Kt of Xe){const Ii=Kt.getSections();for(const tn of Ii){if(tn.image)continue;const yn=Le[tn.fontStack];if(yn&&(xt=yn.ascender!==void 0&&yn.descender!==void 0,!xt))break}if(!xt)break}let ni=0;for(const Kt of Xe){Kt.trim();const Ii=Kt.getMaxScale(),tn=(Ii-1)*zo,yn={positionedGlyphs:[],lineOffset:0};Me.positionedLines[ni]=yn;const Un=yn.positionedGlyphs;let sn=0;if(!Kt.length()){st+=ht,++ni;continue}let Qn=0,Jn=0;for(let be=0;be<Kt.length();be++){const ye=Kt.getSection(be),ft=Kt.getSectionIndex(be),Ut=Kt.getCodePoint(be);let mt=ye.scale,Gt=null,yi=null,fi=null,cn=zo,Fi=0,ui=zt;ui===ql.vertical&&((ai=Ut)===12312||ai===12313||ai===12316||ai===12540||ai===12448)&&(ui=ql.horizontal);const Kn=!(ui===ql.horizontal||!vt&&!ex(Ut)||vt&&(sA[Ut]||Y1(Ut)));if(ye.image){const Cr=ut.get(ye.image.toString());if(!Cr)continue;fi=ye.image,Me.iconsInText=Me.iconsInText||!0,yi=Cr.paddedRect;const Ui=Cr.displaySize;mt=mt*zo/Ct,Gt={width:Ui[0],height:Ui[1],left:0,top:-eV,advance:Kn?Ui[1]:Ui[0],localGlyph:!1},Fi=xt?-Gt.height*mt:Ii*zo-17-Ui[1]*mt,cn=Gt.advance;const On=(Kn?Ui[0]:Ui[1])*mt-zo*Ii;On>0&&On>sn&&(sn=On)}else{const Cr=Be[ye.fontStack];if(!Cr)continue;Cr[Ut]&&(yi=Cr[Ut]);const Ui=Le[ye.fontStack];if(!Ui)continue;const On=Ui.glyphs[Ut];if(!On)continue;if(Gt=On.metrics,cn=Ut!==8203?zo:0,xt){const Er=Ui.ascender!==void 0?Math.abs(Ui.ascender):0,cr=Ui.descender!==void 0?Math.abs(Ui.descender):0,ys=(Er+cr)*mt;Qn<ys&&(Qn=ys,Jn=(Er-cr)/2*mt),Fi=-Er*mt}else Fi=(Ii-mt)*zo-17}Kn?(Me.verticalizable=!0,Un.push({glyph:Ut,image:fi,x:at,y:st+Fi,vertical:Kn,scale:mt,localGlyph:Gt.localGlyph,fontStack:ye.fontStack,sectionIndex:ft,metrics:Gt,rect:yi}),at+=cn*mt+Et):(Un.push({glyph:Ut,image:fi,x:at,y:st+Fi,vertical:Kn,scale:mt,localGlyph:Gt.localGlyph,fontStack:ye.fontStack,sectionIndex:ft,metrics:Gt,rect:yi}),at+=Gt.advance*mt+Et)}Un.length!==0&&(St=Math.max(at-Et,St),xt?sV(Un,Dt,sn,Jn,ht*Ii/2):sV(Un,Dt,sn,0,ht/2)),at=0;const is=ht*Ii+sn;yn.lineOffset=Math.max(sn,tn),st+=is,++ni}var ai;const Qt=st,{horizontalAlign:Ht,verticalAlign:Zi}=_R(_t);(function(Kt,Ii,tn,yn,Un,sn){const Qn=(Ii-tn)*Un,Jn=-sn*yn;for(const is of Kt)for(const be of is.positionedGlyphs)be.x+=Qn,be.y+=Jn})(Me.positionedLines,Dt,Ht,Zi,St,Qt),Me.top+=-Zi*Qt,Me.bottom=Me.top+Qt,Me.left+=-Ht*St,Me.right=Me.left+St,Me.hasBaseline=xt}(xe,s,l,p,ee,v,w,A,j,k,z,q),!function(Me){for(const Le of Me)if(Le.positionedGlyphs.length!==0)return!1;return!0}(Ae))return xe}const sA={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Tpe={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 tV(u,s,l,p,m,_){if(s.image){const v=p.get(s.image.toString());return v?v.displaySize[0]*s.scale*zo/_+m:0}{const v=l[s.fontStack],w=v&&v.glyphs[u];return w?w.metrics.advance*s.scale+m:0}}function iV(u,s,l,p){const m=Math.pow(u-s,2);return p?u<s?m/2:2*m:m+Math.abs(l)*l}function Cpe(u,s,l){let p=0;return u===10&&(p-=1e4),l&&(p+=150),u!==40&&u!==65288||(p+=50),s!==41&&s!==65289||(p+=50),p}function nV(u,s,l,p,m,_){let v=null,w=iV(s,l,m,_);for(const A of p){const k=iV(s-A.x,l,m,_)+A.badness;k<=w&&(v=A,w=k)}return{index:u,x:s,priorBreak:v,badness:w}}function rV(u){return u?rV(u.priorBreak).concat(u.index):[]}function _R(u){let s=.5,l=.5;switch(u){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(u){case"bottom":case"bottom-right":case"bottom-left":l=1;break;case"top":case"top-right":case"top-left":l=0}return{horizontalAlign:s,verticalAlign:l}}function sV(u,s,l,p,m){if(!(s||l||p||m))return;const _=u.length-1,v=u[_],w=(v.x+v.metrics.advance*v.scale)*s;for(let A=0;A<=_;A++)u[A].x-=w,u[A].y+=l+p+m}function oV(u){return u.imagePrimary!==void 0&&u.top!==void 0&&u.bottom!==void 0&&u.left!==void 0&&u.right!==void 0}function oA(u,s,l,p){const{horizontalAlign:m,verticalAlign:_}=_R(p),v=l[0]-u.displaySize[0]*m,w=l[1]-u.displaySize[1]*_;return{imagePrimary:u,imageSecondary:s,top:w,bottom:w+u.displaySize[1],left:v,right:v+u.displaySize[0]}}function vR(u,s,l,p,m,_){const v=u.imagePrimary;let w;if(v.content){const Q=v.content,ee=v.pixelRatio||1;w=[Q[0]/ee,Q[1]/ee,v.displaySize[0]-Q[2]/ee,v.displaySize[1]-Q[3]/ee]}const A=s.left*_,k=s.right*_;let R,j,z,U;l==="width"||l==="both"?(U=m[0]+A-p[3],j=m[0]+k+p[1]):(U=m[0]+(A+k-v.displaySize[0])/2,j=U+v.displaySize[0]);const q=s.top*_,X=s.bottom*_;return l==="height"||l==="both"?(R=m[1]+q-p[0],z=m[1]+X+p[2]):(R=m[1]+(q+X-v.displaySize[1])/2,z=R+v.displaySize[1]),{imagePrimary:v,imageSecondary:void 0,top:R,right:j,bottom:z,left:U,collisionPadding:w}}function aV(u){return!u.imagePrimary.stretchX}function lV(u){return!u.imagePrimary.stretchY}function cV(u){return{width:u.right-u.left,height:u.bottom-u.top}}const sd=128;function Ix(u,s,l){const{expression:p}=s;
vendor: 9,317 bytes, line 821
821if(p.kind==="constant")return{kind:"constant",layoutSize:p.evaluate(new Rr(u+1,{worldview:l}))};if(p.kind==="source")return{kind:"source"};{const{zoomStops:m,interpolationType:_}=p;let v=0;for(;v<m.length&&m[v]<=u;)v++;v=Math.max(0,v-1);let w=v;for(;w<m.length&&m[w]<u+1;)w++;w=Math.min(m.length-1,w);const A=m[v],k=m[w];return p.kind==="composite"?{kind:"composite",minZoom:A,maxZoom:k,interpolationType:_}:{kind:"camera",minZoom:A,maxZoom:k,minSize:p.evaluate(new Rr(A,{worldview:l})),maxSize:p.evaluate(new Rr(k,{worldview:l})),interpolationType:_}}}function xR(u,{uSize:s,uSizeT:l},{lowerSize:p,upperSize:m}){return u.kind==="source"?p/sd:u.kind==="composite"?Vi(p/sd,m/sd,l):s}function kx(u,s,l=1){let p=0,m=0;if(u.kind==="constant")m=u.layoutSize*l;else if(u.kind!=="source"){const{interpolationType:_,minZoom:v,maxZoom:w}=u,A=_?re(jl.interpolationFactor(_,s,v,w),0,1):0;u.kind==="camera"?m=Vi(u.minSize,u.maxSize,A)*l:p=A*l}return{uSizeT:p,uSize:m}}class bp extends Tt{constructor(s,l,p,m,_){super(s,l),this.angle=m,this.z=p,_!==void 0&&(this.segment=_)}clone(){return new bp(this.x,this.y,this.z,this.angle,this.segment)}}function uV(u,s,l,p,m){if(s.segment===void 0)return!0;let _=s,v=s.segment+1,w=0;for(;w>-l/2;){if(v--,v<0)return!1;w-=u[v].dist(_),_=u[v]}w+=u[v].dist(u[v+1]),v++;const A=[];let k=0;for(;w<l/2;){const R=u[v],j=u[v+1];if(!j)return!1;let z=u[v-1].angleTo(R)-R.angleTo(j);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:w,angleDelta:z}),k+=z;w-A[0].distance>p;)k-=A.shift().angleDelta;if(k>m)return!1;v++,w+=R.dist(j)}return!0}function dV(u){let s=0;for(let l=0;l<u.length-1;l++)s+=u[l].dist(u[l+1]);return s}function hV(u,s,l){return u?.6*s*l:0}function pV(u,s){return Math.max(u?u.right-u.left:0,s?s.right-s.left:0)}function Epe(u,s,l,p,m,_){const v=hV(l,m,_),w=pV(l,p)*_;let A=0;const k=dV(u)/2;for(let R=0;R<u.length-1;R++){const j=u[R],z=u[R+1],U=j.dist(z);if(A+U>k){const q=(k-A)/U,X=Vi(j.x,z.x,q),Q=Vi(j.y,z.y,q),ee=new bp(X,Q,0,z.angleTo(j),R);return!v||uV(u,ee,w,v,s)?ee:void 0}A+=U}}function Ape(u,s,l,p,m,_,v,w,A){const k=hV(p,_,v),R=pV(p,m),j=R*v,z=u[0].x===0||u[0].x===A||u[0].y===0||u[0].y===A;return s-j<s/4&&(s=j+s/4),fV(u,z?s/2*w%s:(R/2+2*_)*v*w%s,s,k,l,j,z,!1,A)}function fV(u,s,l,p,m,_,v,w,A){const k=_/2,R=dV(u);let j=0,z=s-l,U=[];for(let q=0;q<u.length-1;q++){const X=u[q],Q=u[q+1],ee=X.dist(Q),oe=Q.angleTo(X);for(;z+l<j+ee;){z+=l;const le=(z-j)/ee,de=Vi(X.x,Q.x,le),Ae=Vi(X.y,Q.y,le);if(de>=0&&de<A&&Ae>=0&&Ae<A&&z-k>=0&&z+k<=R){const xe=new bp(de,Ae,0,oe,q);p&&!uV(u,xe,_,p,m)||U.push(xe)}}j+=ee}return w||U.length||v||(U=fV(u,j/2,l,p,m,_,v,!0,A)),U}function mV(u){let s=0,l=0;for(const v of u)s+=v.w*v.h,l=Math.max(l,v.w);u.sort((v,w)=>w.h-v.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),l),h:1/0}];let m=0,_=0;for(const v of u)for(let w=p.length-1;w>=0;w--){const A=p[w];if(!(v.w>A.w||v.h>A.h)){if(v.x=A.x,v.y=A.y,_=Math.max(_,v.y+v.h),m=Math.max(m,v.x+v.w),v.w===A.w&&v.h===A.h){const k=p.pop();k&&w<p.length&&(p[w]=k)}else v.h===A.h?(A.x+=v.w,A.w-=v.w):v.w===A.w?(A.y+=v.h,A.h-=v.h):(p.push({x:A.x+v.w,y:A.y,w:A.w-v.w,h:v.h}),A.y+=v.h,A.h-=v.h);break}}return{w:m,h:_,fill:s/(m*_)||0}}ri(bp,"Anchor");const Oy=1;class Ww{static getImagePositionScale(s,l,p){if(l&&s&&s.options&&s.options.transform){const m=s.options.transform;return{x:m.a,y:m.d}}return{x:p,y:p}}constructor(s,l,p,m){this.paddedRect=s;const{pixelRatio:_,version:v,stretchX:w,stretchY:A,content:k,sdf:R,usvg:j}=l;this.pixelRatio=_,this.stretchX=w,this.stretchY=A,this.content=k,this.version=v,this.padding=p,this.sdf=R,this.usvg=j,this.scale=Ww.getImagePositionScale(m,j,_)}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 bR(u,s,l){const p=Ku.parse(u),m=function(_,v,w=[1,1]){return{x:0,y:0,w:(_.data?_.data.width:_.width*w[0])+2*v,h:(_.data?_.data.height:_.height*w[1])+2*v}}(s,l,[p.options.transform.a,p.options.transform.d]);return{bin:m,imagePosition:new Ww(m,s,l,p),imageVariant:p}}class gV{constructor(s,l,p){const m=new Map,_=new Map;this.haveRenderCallbacks=[];const v=[];this.addImages(s,m,Oy,v),this.addImages(l,_,2,v);const{w,h:A}=mV(v),k=new oa({width:w||1,height:A||1});for(const[R,j]of s.entries()){const z=m.get(R).paddedRect;oa.copy(j.data,k,{x:0,y:0},{x:z.x+Oy,y:z.y+Oy},j.data,null,j.sdf)}for(const[R,j]of l.entries()){const z=_.get(R),U=z.paddedRect;let q=z.padding;const X=U.x+q,Q=U.y+q,ee=j.data.width,oe=j.data.height;q=q>1?q-1:q,oa.copy(j.data,k,{x:0,y:0},{x:X,y:Q},j.data,p),oa.copy(j.data,k,{x:0,y:oe-q},{x:X,y:Q-q},{width:ee,height:q},p),oa.copy(j.data,k,{x:0,y:0},{x:X,y:Q+oe},{width:ee,height:q},p),oa.copy(j.data,k,{x:ee-q,y:0},{x:X-q,y:Q},{width:q,height:oe},p),oa.copy(j.data,k,{x:0,y:0},{x:X+ee,y:Q},{width:q,height:oe},p),oa.copy(j.data,k,{x:ee-q,y:oe-q},{x:X-q,y:Q-q},{width:q,height:q},p),oa.copy(j.data,k,{x:0,y:oe-q},{x:X+ee,y:Q-q},{width:q,height:q},p),oa.copy(j.data,k,{x:0,y:0},{x:X+ee,y:Q+oe},{width:q,height:q},p),oa.copy(j.data,k,{x:ee-q,y:0},{x:X-q,y:Q+oe},{width:q,height:q},p)}this.lut=p,this.image=k,this.iconPositions=m,this.patternPositions=_}addImages(s,l,p,m){for(const[_,v]of s.entries()){const{bin:w,imagePosition:A,imageVariant:k}=bR(_,v,p);l.set(_,A),m.push(w),v.hasRenderCallback&&this.haveRenderCallbacks.push(k.id)}}patchUpdatedImages(s,l,p){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(m=>s.hasImage(m,p)),s.dispatchRenderCallbacks(this.haveRenderCallbacks,p);for(const m of s.getUpdatedImages(p)){for(const _ of this.iconPositions.keys()){const v=Ku.parse(_);if(no.isEqual(v.id,m)){const w=s.getImage(m,p);this.patchUpdatedImage(this.iconPositions.get(_),w,l,null)}}for(const _ of this.patternPositions.keys()){const v=Ku.parse(_);if(no.isEqual(v.id,m)){const w=s.getImage(m,p);this.patchUpdatedImage(this.patternPositions.get(_),w,l,this.lut)}}}}patchUpdatedImage(s,l,p,m=null){if(!s||!l||s.version===l.version)return;s.version=l.version;const[_,v]=s.tl,w=s.sdf;if(this.lut||w){const A={width:l.data.width,height:l.data.height},k=new oa(A);oa.copy(l.data,k,{x:0,y:0},{x:0,y:0},A,m,w),p.update(k,{position:{x:_,y:v}})}else p.update(l.data,{position:{x:_,y:v}})}}ri(Ww,"ImagePosition"),ri(gV,"ImageAtlas");const Kw=1e20;function yV(u,s,l,p,m,_,v,w,A){for(let k=s;k<s+p;k++)_V(u,l*_+k,_,m,v,w,A);for(let k=l;k<l+m;k++)_V(u,k*_+s,1,p,v,w,A)}function _V(u,s,l,p,m,_,v){_[0]=0,v[0]=-Kw,v[1]=Kw,m[0]=u[s];for(let w=1,A=0,k=0;w<p;w++){m[w]=u[s+w*l];const R=w*w;do{const j=_[A];k=(m[w]-m[j]+R-j*j)/(w-j)/2}while(k<=v[A]&&--A>-1);A++,_[A]=w,v[A]=k,v[A+1]=Kw}for(let w=0,A=0;w<p;w++){for(;v[A+1]<w;)A++;const k=_[A],R=w-k;u[s+w*l]=m[k]+R*R}}const od=2,wR={none:0,ideographs:1,all:2};class Px{constructor(s,l,p){this.requestManager=s,this.localGlyphMode=l,this.localFontFamily=p,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(s){this.url=s}getGlyphs(s,l){const p=[],m=this.url||Vr.GLYPHS_URL;for(const _ in s)for(const v of s[_])p.push({stack:_,id:v});Re(p,({stack:_,id:v},w)=>{let A=this.entries[_];A||(A=this.entries[_]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let k=A.glyphs[v];if(k!==void 0)return void w(null,{stack:_,id:v,glyph:k});if(k=this._tinySDF(A,_,v),k)return A.glyphs[v]=k,void w(null,{stack:_,id:v,glyph:k});const R=Math.floor(v/256);if(256*R>65535)return di("glyphs > 65535 not supported"),void w(null,{stack:_,id:v,glyph:k});if(A.ranges[R])return void w(null,{stack:_,id:v,glyph:k});let j=A.requests[R];j||(j=A.requests[R]=[],Px.loadGlyphRange(_,R,m,this.requestManager,(z,U)=>{if(U){A.ascender=U.ascender,A.descender=U.descender;for(const q in U.glyphs)this._doesCharSupportLocalGlyph(+q)||(A.glyphs[+q]=U.glyphs[+q]);A.ranges[R]=!0}for(const q of j)q(z,U);delete A.requests[R]})),j.push((z,U)=>{z?w(z):U&&w(null,{stack:_,id:v,glyph:U.glyphs[v]||null})})},(_,v)=>{if(_)l(_);else if(v){const w={};for(const{stack:A,id:k,glyph:R}of v)w[A]===void 0&&(w[A]={}),w[A].glyphs===void 0&&(w[A].glyphs={}),w[A].glyphs[k]=R&&{id:R.id,bitmap:R.bitmap.clone(),metrics:R.metrics},w[A].ascender=this.entries[A].ascender,w[A].descender=this.entries[A].descender;l(null,w)}})}_doesCharSupportLocalGlyph(s){return this.localGlyphMode!==wR.none&&(this.localGlyphMode===wR.all?!!this.localFontFamily:!!this.localFontFamily&&(Ri["CJK Unified Ideographs"](s)||Ri["Hangul Syllables"](s)||Ri.Hiragana(s)||Ri.Katakana(s)||Ri["CJK Symbols and Punctuation"](s)||Ri["CJK Unified Ideographs Extension A"](s)||Ri["CJK Unified Ideographs Extension B"](s)||Ri.Osage(s)))}_tinySDF(s,l,p){const m=this.localFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=s.tinySDF;if(!_){let X="400";/bold/i.test(l)?X="900":/medium/i.test(l)?X="500":/light/i.test(l)&&(X="200"),_=s.tinySDF=new Px.TinySDF({fontFamily:m,fontWeight:X,fontSize:24*od,buffer:3*od,radius:8*od}),_.fontWeight=X}if(this.localGlyphs[_.fontWeight][p])return this.localGlyphs[_.fontWeight][p];const v=String.fromCodePoint(p),{data:w,width:A,height:k,glyphWidth:R,glyphHeight:j,glyphLeft:z,glyphTop:U,glyphAdvance:q}=_.draw(v);return this.localGlyphs[_.fontWeight][p]={id:p,bitmap:new tm({width:A,height:k}
821,w),metrics:{width:R/od,height:j/od,left:z/od,top:U/od-27,advance:q/od,localGlyph:!0}}}}Px.loadGlyphRange=function(u,s,l,p,m){const _=256*s,v=_+255,w=p.transformRequest(p.normalizeGlyphsURL(l).replace("{fontstack}",u).replace("{range}",`${_}-${v}`),tp.Glyphs);yf(w,(A,k)=>{if(A)m(A);else if(k){const R={},j=function(z){return new rA(z).readFields(bpe,{})}(k);for(const z of j.glyphs)R[z.id]=z;m(null,{glyphs:R,ascender:j.ascender,descender:j.descender})}})},Px.TinySDF=class{constructor({fontSize:u=24,buffer:s=3,radius:l=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:v="normal",lang:w=null}={}){this.buffer=s,this.cutoff=p,this.radius=l,this.lang=w;const A=this.size=u+4*s,k=this._createCanvas(A),R=this.ctx=k.getContext("2d",{willReadFrequently:!0});R.font=`${v} ${_} ${u}px ${m}`,R.textBaseline="alphabetic",R.textAlign="left",R.fillStyle="black",this.gridOuter=new Float64Array(A*A),this.gridInner=new Float64Array(A*A),this.f=new Float64Array(A),this.z=new Float64Array(A+1),this.v=new Uint16Array(A)}_createCanvas(u){const s=document.createElement("canvas");return s.width=s.height=u,s}draw(u){const{width:s,actualBoundingBoxAscent:l,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(u),v=Math.ceil(l),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),A=Math.min(this.size-this.buffer,v+Math.ceil(p)),k=w+2*this.buffer,R=A+2*this.buffer,j=Math.max(k*R,0),z=new Uint8ClampedArray(j),U={data:z,width:k,height:R,glyphWidth:w,glyphHeight:A,glyphTop:v,glyphLeft:0,glyphAdvance:s};if(w===0||A===0)return U;const{ctx:q,buffer:X,gridInner:Q,gridOuter:ee}=this;this.lang&&(q.lang=this.lang),q.clearRect(X,X,w,A),q.fillText(u,X,X+v);const oe=q.getImageData(X,X,w,A);ee.fill(Kw,0,j),Q.fill(0,0,j);for(let le=0;le<A;le++)for(let de=0;de<w;de++){const Ae=oe.data[4*(le*w+de)+3]/255;if(Ae===0)continue;const xe=(le+X)*k+de+X;if(Ae===1)ee[xe]=0,Q[xe]=Kw;else{const Me=.5-Ae;ee[xe]=Me>0?Me*Me:0,Q[xe]=Me<0?Me*Me:0}}yV(ee,0,0,k,R,k,this.f,this.v,this.z),yV(Q,X,X,w,A,k,this.f,this.v,this.z);for(let le=0;le<j;le++){const de=Math.sqrt(ee[le])-Math.sqrt(Q[le]);z[le]=Math.round(255-255*(de/this.radius+this.cutoff))}return U}};const uh=Oy;function vV(u,s){return u+s[1]-s[0]}function SR(u,s,l,p,m=1){const _=[],v=u.imagePrimary,w=v.pixelRatio,A=v.paddedRect.w-2*uh,k=v.paddedRect.h-2*uh,R=(u.right-u.left)*m,j=(u.bottom-u.top)*m,z=v.stretchX||[[0,A]],U=v.stretchY||[[0,k]],q=z.reduce(vV,0),X=U.reduce(vV,0),Q=A-q,ee=k-X;let oe=0,le=q,de=0,Ae=X,xe=0,Me=Q,Le=0,Be=ee;if(v.content&&p){const Xe=v.content;oe=aA(z,0,Xe[0]),de=aA(U,0,Xe[1]),le=aA(z,Xe[0],Xe[2]),Ae=aA(U,Xe[1],Xe[3]),xe=Xe[0]-oe,Le=Xe[1]-de,Me=Xe[2]-Xe[0]-le,Be=Xe[3]-Xe[1]-Ae}const ut=(Xe,ht,_t,bt)=>{const zt=lA(Xe.stretch-oe,le,R,u.left*m),Et=cA(Xe.fixed-xe,Me,Xe.stretch,q),vt=lA(ht.stretch-de,Ae,j,u.top*m),Ct=cA(ht.fixed-Le,Be,ht.stretch,X),at=lA(_t.stretch-oe,le,R,u.left*m),st=cA(_t.fixed-xe,Me,_t.stretch,q),St=lA(bt.stretch-de,Ae,j,u.top*m),Dt=cA(bt.fixed-Le,Be,bt.stretch,X),xt=new Tt(zt,vt),ni=new Tt(at,vt),ai=new Tt(at,St),Qt=new Tt(zt,St),Ht=new Tt(Et/w,Ct/w),Zi=new Tt(st/w,Dt/w),Kt=s*Math.PI/180;if(Kt){const Qn=Math.sin(Kt),Jn=Math.cos(Kt),is=[Jn,-Qn,Qn,Jn];xt._matMult(is),ni._matMult(is),Qt._matMult(is),ai._matMult(is)}const Ii=Xe.stretch+Xe.fixed,tn=_t.stretch+_t.fixed,yn=ht.stretch+ht.fixed,Un=bt.stretch+bt.fixed,sn=u.imageSecondary;return{tl:xt,tr:ni,bl:Qt,br:ai,texPrimary:{x:v.paddedRect.x+uh+Ii,y:v.paddedRect.y+uh+yn,w:tn-Ii,h:Un-yn},texSecondary:sn?{x:sn.paddedRect.x+uh+Ii,y:sn.paddedRect.y+uh+yn,w:tn-Ii,h:Un-yn}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ht,pixelOffsetBR:Zi,minFontScaleX:Me/w/R,minFontScaleY:Be/w/j,isSDF:l}};if(p&&(v.stretchX||v.stretchY)){const Xe=xV(z,Q,q),ht=xV(U,ee,X);for(let _t=0;_t<Xe.length-1;_t++){const bt=Xe[_t],zt=Xe[_t+1];for(let Et=0;Et<ht.length-1;Et++)_.push(ut(bt,ht[Et],zt,ht[Et+1]))}}else _.push(ut({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:A+1},{fixed:0,stretch:k+1}));return _}function Ipe(u,s){const l=u.stretchY||[[0,u.paddedRect.h-2*uh]];return s&&(u.stretchX||u.stretchY)?bV(u.stretchX||[[0,u.paddedRect.w-2*uh]])*bV(l):1}function aA(u,s,l){let p=0;for(const m of u)p+=Math.max(s,Math.min(l,m[1]))-Math.max(s,Math.min(l,m[0]));return p}function xV(u,s,l){const p=[{fixed:-uh,stretch:0}];for(const[m,_]of u){const v=p[p.length-1];
821p.push({fixed:m-v.stretch,stretch:v.stretch}),p.push({fixed:m-v.stretch,stretch:v.stretch+(_-m)})}return p.push({fixed:s+uh,stretch:l}),p}function bV(u){return 2*u.length+1}function lA(u,s,l,p){return u/s*l+p}function cA(u,s,l,p){return u-s*l/p}function kpe(u,s,l,p){const m=s+u.positionedLines[p].lineOffset;return p===0?l+m/2:l+(m+(s+u.positionedLines[p-1].lineOffset))/2}function Ppe(u,s=1,l=!1){let p=1/0,m=1/0,_=-1/0,v=-1/0;const w=u[0];for(let U=0;U<w.length;U++){const q=w[U];(!U||q.x<p)&&(p=q.x),(!U||q.y<m)&&(m=q.y),(!U||q.x>_)&&(_=q.x),(!U||q.y>v)&&(v=q.y)}const A=Math.min(_-p,v-m);let k=A/2;const R=new Ev([],Npe);if(A===0)return new Tt(p,m);for(let U=p;U<_;U+=A)for(let q=m;q<v;q+=A)R.push(new Nx(U+k,q+k,k,u));let j=function(U){let q=0,X=0,Q=0;const ee=U[0];for(let oe=0,le=ee.length,de=le-1;oe<le;de=oe++){const Ae=ee[oe],xe=ee[de],Me=Ae.x*xe.y-xe.x*Ae.y;X+=(Ae.x+xe.x)*Me,Q+=(Ae.y+xe.y)*Me,q+=3*Me}return new Nx(X/q,Q/q,0,U)}(u),z=R.length;for(;R.length;){const U=R.pop();(U.d>j.d||!j.d)&&(j=U,l&&console.log("found best %d after %d probes",Math.round(1e4*U.d)/1e4,z)),U.max-j.d<=s||(k=U.h/2,R.push(new Nx(U.p.x-k,U.p.y-k,k,u)),R.push(new Nx(U.p.x+k,U.p.y-k,k,u)),R.push(new Nx(U.p.x-k,U.p.y+k,k,u)),R.push(new Nx(U.p.x+k,U.p.y+k,k,u)),z+=4)}return l&&(console.log(`num probes: ${z}`),console.log(`best distance: ${j.d}`)),j.p}function Npe(u,s){return s.max-u.max}class Nx{constructor(s,l,p,m){this.p=new Tt(s,l),this.h=p,this.d=function(_,v){let w=!1,A=1/0;for(let k=0;k<v.length;k++){const R=v[k];for(let j=0,z=R.length,U=z-1;j<z;U=j++){const q=R[j],X=R[U];q.y>_.y!=X.y>_.y&&_.x<(X.x-q.x)*(_.y-q.y)/(X.y-q.y)+q.x&&(w=!w),A=Math.min(A,Fl(_,q,X))}}return(w?1:-1)*Math.sqrt(A)}(this.p,m),this.max=this.d+this.h*Math.SQRT2}}const Mpe=Object.keys,TR=Number.POSITIVE_INFINITY,Dpe=Math.sqrt(2);function uA(u,s,l,p){const m=u.collisionPadding||[0,0,0,0],_={top:u.top-m[1],bottom:u.bottom+m[3],left:u.left-m[0],right:u.right+m[2],scaled:!1};return p!==void 0&&function(v,w){v.top*=w,v.bottom*=w,v.left*=w,v.right*=w,v.scaled=!0}(_,p),l&&function(v,w){if(!w)return;const A=Pn(w),k=new Tt(v.left,v.top),R=new Tt(v.right,v.top),j=new Tt(v.left,v.bottom),z=new Tt(v.right,v.bottom);k._rotateAround(A,new Tt(0,0)),R._rotateAround(A,new Tt(0,0)),j._rotateAround(A,new Tt(0,0)),z._rotateAround(A,new Tt(0,0)),v.left=Math.min(k.x,R.x,j.x,z.x),v.right=Math.max(k.x,R.x,j.x,z.x),v.top=Math.min(k.y,R.y,j.y,z.y),v.bottom=Math.max(k.y,R.y,j.y,z.y)}(_,l),s?{top:Math.min(s.top,_.top),bottom:Math.max(s.bottom,_.bottom),left:Math.min(s.left,_.left),right:Math.max(s.right,_.right),scaled:s.scaled||_.scaled}:_}function wV(u,[s,l]){let p=0,m=0;if(l===TR){s<0&&(s=0);const _=s/Dpe;switch(u){case"top-right":case"top-left":m=_-7;break;case"bottom-right":case"bottom-left":m=7-_;break;case"bottom":m=7-s;break;case"top":m=s-7}switch(u){case"top-right":case"bottom-right":p=-_;break;case"top-left":case"bottom-left":p=_;break;case"left":p=s;break;case"right":p=-s}}else{switch(s=Math.abs(s),l=Math.abs(l),u){case"top-right":case"top-left":case"top":m=l-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-l}switch(u){case"top-right":case"bottom-right":case"right":p=-s;break;case"top-left":case"bottom-left":case"left":p=s}}return[p,m]}function Rpe(u,s,l,p,m,_,v,w,A,k,R){const j=u.layers[0],z=j.appearances;if(z.length===0)return{iconBBox:null,iconVerticalBBox:null};let U=null,q=null;const X=p.get("icon-rotate").evaluate(m,{},_);s&&(U=uA(s,U,X,v),l)&&(q=uA(l,q,X+90,v));const[Q,ee]=p.get("icon-size-scale-range"),oe=re(1,Q,ee);for(const le of z){const de=le.getUnevaluatedProperties(),Ae=de._values["icon-image"].value!==void 0,xe=de._values["icon-size"].value!==void 0,Me=de._values["icon-offset"].value!==void 0,Le=de._values["icon-rotate"].value!==void 0;if(Ae||xe||Me||Le){const Be=Me?j.getAppearanceValueAndResolveTokens(le,"icon-offset",m,_,[]):null,ut=Be&&Array.isArray(Be)?Be:w,Xe=Le?j.getAppearanceValueAndResolveTokens(le,"icon-rotate",m,_,[]):null,ht=typeof Xe=="number"?Xe:X,_t=xe?j.getAppearanceValueAndResolveTokens(le,"icon-size",m,_,[]):null,bt=typeof _t=="number"?_t*A.iconScaleFactor:v;let zt=null,Et=null,vt=null;if(Ae){const Ct=j.getAppearanceValueAndResolveTokens(le,"icon-image",m,_,[]);if(Ct){const at=u.getResolvedImageFromTokens(Ct),st=de._values["icon-size"],St=Zw(at,Ix(u.zoom,st,u.worldview),st,_,u.zoom,m,u.pixelRatio,oe,u.worldview);vt=k.get(St.iconPrimary.toString())}}else s&&(vt=s.imagePrimary);vt&&(zt=oA(vt,null,ut,R),u.allowVerticalPlacement&&(Et=oA(vt,null,ut,R))),zt&&(U=uA(zt,U,ht,bt)),Et&&(q=uA(Et,q,ht+90,bt))}}return{iconBBox:U,iconVerticalBBox:q}}function dA(u,s,l,p,m,_,v,w,A){if(!s||!s.usvg)return;const k=cV(p),R=cV(m),j=_!=="both"&&_!=="width"||!aV(p)?1:R.width/k.width,z=_!=="both"&&_!=="height"||!lV(p)?1:R.height/k.height;l.scaleSelf(j,z);const U=l.toString();v.set(U,l),w.set(U,s);const{imagePosition:q}=bR(U,s,Oy);A.set(U,q)}function SV(u,s,l,p,m,_,v,w,A){if(!u)return;const k=function(R,j,z,U,q,X){if(R.kind==="camera")return R.maxSize;if(R.kind==="composite"){const Q=j.possiblyEvaluate(new Rr(R.maxZoom,{worldview:X}),z).evaluate(q,{},z),ee=j.possiblyEvaluate(new Rr(R.minZoom,{worldview:X}),z).evaluate(q,{},z);return Math.max(Q,ee)}return j.possiblyEvaluate(new Rr(U,{worldview:X})).evaluate(q,{},z)}(s,l,p,m,_,A);return u.scaleSelf(k*w*v)}function Zw(u,s,l,p,m,_,v,w,A){return{iconPrimary:SV(u.getPrimary(),s,l,p,m,_,v,w,A),iconSecondary:SV(u.getSecondary(),s,l,p,m,_,v,w,A)}}function jpe(u,s,l){if(!s)return;const p=l.get(u.toString()),m=l.get(s.toString());p&&m&&(p.paddedRect.w===m.paddedRect.w&&p.paddedRect.h===m.paddedRect.h||di(`Mismatch in icon variant sizes: ${u.toString()} and ${s.toString()}`),p.usvg!==m.usvg&&di(`Mismatch in icon variant image types: ${u.id} and ${s.id}`))}function TV(u,s,l,p){if(!u)return;const m=s.get(l.toString());if(u.imagePrimary=m,p){const _=s.get(p.toString());u.imageSecondary=_}}function zpe(u,s){for(const l in u.horizontal)CV(u.horizontal[l],s);CV(u.vertical,s)}
821function CV(u,s){if(u){for(const l of u.positionedLines)for(const p of l.positionedGlyphs)if(p.image!==null){const m=p.image.toString();p.rect=s.get(m).paddedRect}}}function CR(u){switch(u){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Lpe(u,s,l,p,m,_,v,w,A){const k=ER(_.horizontal)||_.vertical,R=l.get("icon-text-fit-padding").evaluate(p,{},m);let j,z=s;return s&&A!=="none"&&(u.allowVerticalPlacement&&_.vertical&&(j=vR(s,_.vertical,A,R,w,v)),k&&(z=vR(s,k,A,R,w,v))),{defaultShapedIcon:z,verticallyShapedIcon:j}}function Ope(u,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe,le,de,Ae){let xe=v.textMaxSize.evaluate(s,{},z);xe===void 0?xe=w*v.textScaleFactor:xe*=v.textScaleFactor;const Me=u.layers[0].layout,Le=zo,Be=w*v.textScaleFactor/Le,ut=ER(l.horizontal)||l.vertical;if(Q!=="none"&&u.appearanceFeatureData&&s.index<u.appearanceFeatureData.length){const xt=u.appearanceFeatureData[s.index];xt&&(xt.textShaping=ut,xt.iconTextFitPadding=Me.get("icon-text-fit-padding").evaluate(s,{},z),xt.fontScale=Be)}const Xe=U.name==="globe",ht=u.tilePixelRatio*xe/Le,_t=(at=u.overscaling,u.zoom>18&&at>2&&(at>>=1),Math.max(Ft/(512*at),1)*Me.get("symbol-spacing")),bt=Me.get("text-padding")*u.tilePixelRatio,zt=Me.get("icon-padding")*u.tilePixelRatio,Et=Pn(Me.get("text-max-angle")),vt=Me.get("icon-rotation-alignment")==="map"&&le!=="point",Ct=_t/2;var at;u.hasAnyIconTextFit===!1&&Q!=="none"&&(u.hasAnyIconTextFit=!0);const st=s.properties?+s.properties[Yt]:null,St=st&&u.elevationFeatureIdToIndex?u.elevationFeatureIdToIndex.get(st):65535,Dt=(xt,ni,ai)=>{if(ni.x<0||ni.x>=Ft||ni.y<0||ni.y>=Ft)return;let Qt=null;if(Xe){const{x:Ht,y:Zi,z:Kt}=U.projectTilePoint(ni.x,ni.y,ai);Qt={anchor:new bp(Ht,Zi,Kt,0,void 0),up:U.upVector(ai,ni.x,ni.y)}}(function(Ht,Zi,Kt,Ii,tn,yn,Un,sn,Qn,Jn,is,be,ye,ft,Ut,mt,Gt,yi,fi,cn,Fi,ui,Kn,Cr,Ui,On,Er,cr,ys,qr,Nr){const mr=Ht.addToLineVertexArray(Zi,Ii);let er,un,tr,Mr,Bi,Vn,Hr,As=0,js=0,eo=0,Gr=0,Hs=-1,yl=-1;const Gs={};let Hl=Jg("");const aa=Kt?Kt.anchor:Zi,Kc=cr!=="none";let _l=0,Gl=0;if(Qn._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Lo=Qn.layout.get("text-offset").evaluate(Fi,{},Ui);_l=Lo[0]*zo,Gl=Lo[1]*zo}else _l=Qn.layout.get("text-radial-offset").evaluate(Fi,{},Ui)*zo,Gl=TR;if(Ht.allowVerticalPlacement&&tn.vertical){const Lo=tn.vertical;if(Ut)Vn=AR(Lo),sn&&(Hr=AR(sn));else{const Da=Qn.layout.get("text-rotate").evaluate(Fi,{},Ui)+90;tr=hA(Jn,aa,Zi,is,be,ye,Lo,ft,Da,mt),sn&&(Mr=hA(Jn,aa,Zi,is,be,ye,sn,yi,Da,null,Nr))}}if(yn){const Lo=Ht.iconSizeData,Da=Qn.layout.get("icon-rotate").evaluate(Fi,{},Ui),dh=SR(yn,Da,Kn,Kc,ui.iconScaleFactor),om=sn?SR(sn,Da,Kn,Kc,ui.iconScaleFactor):void 0;un=hA(Jn,aa,Zi,is,be,ye,yn,yi,Da,null,qr);const Ox=function(hh,kA,Fx,Yfe,q6,H6,Qfe,Jfe){const G6=hh.layers[0],W6=G6.appearances;let Bx=kA.length;if(Fx&&(Bx=Math.max(Bx,Fx.length)),W6.length===0)return Bx;const[eme,tme]=Yfe.get("icon-size-scale-range"),ime=re(1,eme,tme);for(const K6 of W6){const Z6=K6.getUnevaluatedProperties();if(Z6._values["icon-image"].value!==void 0){const X6=G6.getAppearanceValueAndResolveTokens(K6,"icon-image",q6,H6,[]);if(X6){const Y6=hh.getResolvedImageFromTokens(X6);if(Y6){const Q6=Z6._values["icon-size"],nme=Zw(Y6,Ix(hh.zoom,Q6,hh.worldview),Q6,H6,hh.zoom,q6,hh.pixelRatio,ime,hh.worldview),rme=Qfe.get(nme.iconPrimary.toString());Bx=Math.max(Bx,Ipe(rme,Jfe))}}}}return Bx}(Ht,dh,om,Qn.layout,Fi,Ui,Ht.iconAtlasPositions,Kc);As=4*Ox;let am=null;Lo.kind==="source"?(am=[sd*Qn.layout.get("icon-size").evaluate(Fi,{},Ui)*ui.iconScaleFactor],am[0]>wp&&di(`${Ht.layerIds[0]}: Value for "icon-size" is >= ${Xw}. Reduce your "icon-size".`)):Lo.kind==="composite"&&(am=[sd*ui.compositeIconSizes[0].evaluate(Fi,{},Ui)*ui.iconScaleFactor,sd*ui.compositeIconSizes[1].evaluate(Fi,{},Ui)*ui.iconScaleFactor],(am[0]>wp||am[1]>wp)&&di(`${Ht.layerIds[0]}: Value for "icon-size" is >= ${Xw}. Reduce your "icon-size".`)),Ht.addSymbols(Ht.icon,dh,am,cn,fi,Fi,void 0,Kt,Zi,mr.lineStartIndex,mr.lineLength,-1,Cr,Ui,On,Er,Ht.symbolInstances.length,Ox),Hs=Ht.icon.placedSymbolArray.length-1,om&&(js=4*Ox,Ht.addSymbols(Ht.icon,om,am,cn,fi,Fi,ql.vertical,Kt,Zi,mr.lineStartIndex,mr.lineLength,-1,Cr,Ui,On,Er,Ht.symbolInstances.length,Ox),yl=Ht.icon.placedSymbolArray.length-1)}for(const Lo in tn.horizontal){const Da=Lo,dh=tn.horizontal[Da];er||(Hl=Jg(dh.text),Ut?Bi=AR(dh):er=hA(Jn,aa,Zi,is,be,ye,dh,ft,Qn.layout.get("text-rotate").evaluate(Fi,{},Ui),mt));const om=dh.positionedLines.length===1;if(eo+=EV(Ht,Kt,Zi,dh,Un,Qn,Ut,Fi,mt,mr,tn.vertical?ql.horizontal:ql.horizontalOnly,om?Mpe(tn.horizontal):[Da],Gs,Hs,ui,Cr,Ui,Ht.symbolInstances.length,On),om)break}tn.vertical&&(Gr+=EV(Ht,Kt,Zi,tn.vertical,Un,Qn,Ut,Fi,mt,mr,ql.vertical,["vertical"],Gs,yl,ui,Cr,Ui,Ht.symbolInstances.length,On));let la=-1;const Wl=(Lo,Da)=>Lo?Math.max(Lo,Da):Da;la=Wl(Bi,la),la=Wl(Vn,la),la=Wl(Hr,la);const Zc=la>-1?1:0;Ht.glyphOffsetArray.length>=65535&&di("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Fi.sortKey!==void 0&&Ht.addToSortKey
821Ranges(Ht.symbolInstances.length,Fi.sortKey),Ht.symbolInstances.emplaceBack(Zi.x,Zi.y,aa.x,aa.y,aa.z,Gs.right>=0?Gs.right:-1,Gs.center>=0?Gs.center:-1,Gs.left>=0?Gs.left:-1,Gs.vertical>=0?Gs.vertical:-1,Hs,yl,Hl,er!==void 0?er:Ht.collisionBoxArray.length,er!==void 0?er+1:Ht.collisionBoxArray.length,tr!==void 0?tr:Ht.collisionBoxArray.length,tr!==void 0?tr+1:Ht.collisionBoxArray.length,un!==void 0?un:Ht.collisionBoxArray.length,un!==void 0?un+1:Ht.collisionBoxArray.length,Mr||Ht.collisionBoxArray.length,Mr?Mr+1:Ht.collisionBoxArray.length,is,eo,Gr,As,js,Zc,0,_l,Gl,la,0,Kc?1:0,ys)})(u,ni,Qt,xt,l,p,_,m,u.layers[0],u.collisionBoxArray,s.index,s.sourceLayerIndex,u.index,bt,oe,k,0,zt,vt,ee,s,v,R,j,z,q,X,Q,St,de,Ae)};if(le==="line")for(const xt of W2(s.geometry,0,0,Ft,Ft)){const ni=Ape(xt,_t,Et,l.vertical||ut,p,Le,ht,u.overscaling,Ft);for(const ai of ni)ut&&Fpe(u,ut.text,Ct,ai)||Dt(xt,ai,z)}else if(le==="line-center"){for(const xt of s.geometry)if(xt.length>1){const ni=Epe(xt,Et,l.vertical||ut,p,Le,ht);ni&&Dt(xt,ni,z)}}else if(s.type==="Polygon")for(const xt of Mw(s.geometry,0)){const ni=Ppe(xt,16);Dt(xt[0],new bp(ni.x,ni.y,0,0,void 0),z)}else if(s.type==="LineString")for(const xt of s.geometry)Dt(xt,new bp(xt[0].x,xt[0].y,0,0,void 0),z);else if(s.type==="Point")for(const xt of s.geometry)for(const ni of xt)Dt([ni],new bp(ni.x,ni.y,0,0,void 0),z)}const Xw=255,wp=Xw*sd;function EV(u,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe){const le=function(xe,Me,Le,Be,ut,Xe,ht,_t){const bt=[];if(Me.positionedLines.length===0)return bt;const zt=Be.layout.get("text-rotate").evaluate(Xe,{})*Math.PI/180,Et=function(St){const Dt=St[0],xt=St[1],ni=Dt*xt;return ni>0?[Dt,-xt]:ni<0?[-Dt,xt]:Dt===0?[xt,Dt]:[xt,-Dt]}(Le);let vt=Math.abs(Me.top-Me.bottom);for(const St of Me.positionedLines)vt-=St.lineOffset;const Ct=Me.positionedLines.length,at=vt/Ct;let st=Me.top-Le[1];for(let St=0;St<Ct;++St){const Dt=Me.positionedLines[St];st=kpe(Me,at,st,St);for(const xt of Dt.positionedGlyphs){if(!xt.rect)continue;const ni=xt.rect||{};let ai=eV+1,Qt=!0,Ht=1,Zi=0;if(xt.image){const fi=ht.get(xt.image.toString());if(!fi)continue;if(fi.sdf){di("SDF images are not supported in formatted text and will be ignored.");continue}Qt=!1,Ht=fi.pixelRatio,ai=Oy/Ht}const Kt=(ut||_t)&&xt.vertical,Ii=xt.metrics.advance*xt.scale/2,tn=xt.metrics,yn=xt.rect;if(yn===null)continue;_t&&Me.verticalizable&&(Zi=xt.image?Ii-xt.metrics.width*xt.scale/2:0);const Un=ut?[xt.x+Ii,xt.y]:[0,0];let sn=[0,0],Qn=[0,0],Jn=!1;ut||(Kt?(Qn=[xt.x+Ii+Et[0],xt.y+Et[1]-Zi],Jn=!0):sn=[xt.x+Ii+Le[0],xt.y+Le[1]-Zi]);const is=yn.w*xt.scale/(Ht*(xt.localGlyph?od:1)),be=yn.h*xt.scale/(Ht*(xt.localGlyph?od:1));let ye,ft,Ut,mt;if(Kt){const fi=xt.y-st,cn=new Tt(-Ii,Ii-fi),Fi=-Math.PI/2,ui=new Tt(...Qn);ye=new Tt(-Ii+sn[0],sn[1]),ye._rotateAround(Fi,cn)._add(ui),ye.x+=-fi+Ii,ye.y-=(tn.left-ai)*xt.scale;const Kn=xt.image?tn.advance*xt.scale:zo*xt.scale,Cr=String.fromCodePoint(xt.glyph);upe(Cr)?ye.x+=(1-ai)*xt.scale:dpe(Cr)?ye.x+=Kn-tn.height*xt.scale+(-ai-1)*xt.scale:ye.x+=xt.image||tn.width+2*ai===yn.w&&tn.height+2*ai===yn.h?(Kn-be)/2:(Kn-(tn.height+2*ai)*xt.scale)/2,ft=new Tt(ye.x,ye.y-is),Ut=new Tt(ye.x+be,ye.y),mt=new Tt(ye.x+be,ye.y-is)}else{const fi=(tn.left-ai)*xt.scale-Ii+sn[0],cn=(-tn.top-ai)*xt.scale+sn[1],Fi=fi+is,ui=cn+be;ye=new Tt(fi,cn),ft=new Tt(Fi,cn),Ut=new Tt(fi,ui),mt=new Tt(Fi,ui)}if(zt){let fi;fi=ut?new Tt(0,0):Jn?new Tt(Et[0],Et[1]):new Tt(Le[0],Le[1]),ye._rotateAround(zt,fi),ft._rotateAround(zt,fi),Ut._rotateAround(zt,fi),mt._rotateAround(zt,fi)}const Gt=new Tt(0,0),yi=new Tt(0,0);bt.push({tl:ye,tr:ft,bl:Ut,br:mt,texPrimary:ni,texSecondary:void 0,writingMode:Me.writingMode,glyphOffset:Un,sectionIndex:xt.sectionIndex,isSDF:Qt,pixelOffsetTL:Gt,pixelOffsetBR:yi,minFontScaleX:0,minFontScaleY:0})}}return bt}(0,p,A,_,v,w,m,u.allowVerticalPlacement),de=u.textSizeData;let Ae=null;de.kind==="source"?(Ae=[sd*_.layout.get("text-size").evaluate(w,{},Q)*q.textScaleFactor],Ae[0]>wp&&di(`${u.layerIds[0]}: Value for "text-size" is >= ${Xw}. Reduce your "text-size".`)):de.kind==="composite"&&(Ae=[sd*q.compositeTextSizes[0].evaluate(w,{},Q)*q.textScaleFactor,sd*q.compositeTextSizes[1].evaluate(w,{}
vendor: 20,885 bytes, line 821
821,Q)*q.textScaleFactor],(Ae[0]>wp||Ae[1]>wp)&&di(`${u.layerIds[0]}: Value for "text-size" is >= ${Xw}. Reduce your "text-size".`)),u.addSymbols(u.text,le,Ae,A,v,w,R,s,l,k.lineStartIndex,k.lineLength,U,X,Q,oe,!1,ee,le.length);for(const xe of j)z[xe]=u.text.placedSymbolArray.length-1;return 4*le.length}function ER(u){for(const s in u)return u[s];return null}function hA(u,s,l,p,m,_,v,w,A,k,R){let j,z,U,q;if(j=R?R.top:v.top,z=R?R.bottom:v.bottom,U=R?R.left:v.left,q=R?R.right:v.right,oV(v)&&v.collisionPadding){const X=v.collisionPadding;U-=X[0],j-=X[1],q+=X[2],z+=X[3]}if(A){const X=new Tt(U,j),Q=new Tt(q,j),ee=new Tt(U,z),oe=new Tt(q,z),le=Pn(A);let de=new Tt(0,0);k&&(de=new Tt(k[0],k[1])),X._rotateAround(le,de),Q._rotateAround(le,de),ee._rotateAround(le,de),oe._rotateAround(le,de),U=Math.min(X.x,Q.x,ee.x,oe.x),q=Math.max(X.x,Q.x,ee.x,oe.x),j=Math.min(X.y,Q.y,ee.y,oe.y),z=Math.max(X.y,Q.y,ee.y,oe.y)}return u.emplaceBack(s.x,s.y,s.z,l.x,l.y,U,j,q,z,w,p,m,_),u.length-1}function AR(u){oV(u)&&u.collisionPadding&&(u.top-=u.collisionPadding[1],u.bottom+=u.collisionPadding[3]);const s=u.bottom-u.top;return s>0?Math.max(10,s):null}function Fpe(u,s,l,p){const m=u.compareText;if(s in m){const _=m[s];for(let v=_.length-1;v>=0;v--)if(p.dist(_[v])<l)return!0}else m[s]=[];return m[s].push(p),!1}function AV(u,s){const l=u.fovAboveCenter,p=u.elevation?u.elevation.getMinElevationBelowMSL()*s:0,m=(u._camera.position[2]*u.worldSize-p)/Math.cos(u._pitch),_=Math.sin(l)*m/Math.sin(Math.max(Math.PI/2-u._pitch-l,.01));let v=Math.sin(u._pitch)*_+m;const w=m*(1/u._horizonShift);if(!u.elevation||u.elevation.exaggeration()===0){let A=Math.max(u.zoom-17,0);u.isOrthographic&&(A/=10),v*=1+A}return Math.min(1.01*v,w)}function Yw(u,s){if(!s.isReprojectedInTileSpace)return{scale:1<<u.z,x:u.x,y:u.y,x2:u.x+1,y2:u.y+1,projection:s};const l=Math.pow(2,-u.z),p=u.x*l,m=(u.x+1)*l,_=u.y*l,v=(u.y+1)*l,w=fe(p),A=fe(m),k=ue(_),R=ue(v),j=s.project(w,k),z=s.project(A,k),U=s.project(A,R),q=s.project(w,R);let X=Math.min(j.x,z.x,U.x,q.x),Q=Math.min(j.y,z.y,U.y,q.y),ee=Math.max(j.x,z.x,U.x,q.x),oe=Math.max(j.y,z.y,U.y,q.y);const le=l/16;function de(xe,Me,Le,Be,ut,Xe){const ht=(Le+ut)/2,_t=(Be+Xe)/2,bt=s.project(fe(ht),ue(_t)),zt=Math.max(0,X-bt.x,Q-bt.y,bt.x-ee,bt.y-oe);X=Math.min(X,bt.x),ee=Math.max(ee,bt.x),Q=Math.min(Q,bt.y),oe=Math.max(oe,bt.y),zt>le&&(de(xe,bt,Le,Be,ht,_t),de(bt,Me,ht,_t,ut,Xe))}de(j,z,p,_,m,_),de(z,U,m,_,m,v),de(U,q,m,v,p,v),de(q,j,p,v,p,_),X-=le,Q-=le,ee+=le,oe+=le;const Ae=1/Math.max(ee-X,oe-Q);return{scale:Ae,x:X*Ae,y:Q*Ae,x2:ee*Ae,y2:oe*Ae,projection:s}}function IV(u,{x:s,y:l},p=0){return new Tt(((s-p)*u.scale-u.x)*Ft,(l*u.scale-u.y)*Ft)}const Bpe=W(new Float32Array(16));class rm{constructor(s){this.spec=s,this.name=s.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(s,l){return{x:0,y:0,z:0}}unproject(s,l){return new H(0,0)}projectTilePoint(s,l,p){return{x:s,y:l,z:0}}locationPoint(s,l,p,m=!0){return s._coordinatePoint(s.locationCoordinate(l,p),m)}pixelsPerMeter(s,l){return ae(1,s)*l}pixelSpaceConversion(s,l,p){return 1}farthestPixelDistance(s){return AV(s,s.pixelsPerMeter)}pointCoordinate(s,l,p,m){const _=s.horizonLineFromTop(!1),v=new Tt(l,Math.max(_,p));return s.rayIntersectionCoordinate(s.pointRayIntersection(v,m))}pointCoordinate3D(s,l,p){const m=new Tt(l,p);if(s.elevation)return s.elevation.pointCoordinate(m);{const _=this.pointCoordinate(s,m.x,m.y,0);return[_.x,_.y,_.z]}}isPointAboveHorizon(s,l){if(s.elevation&&s.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(s,l.x,l.y);const p=s.horizonLineFromTop();return l.y<p}createInversionMatrix(s,l){return Bpe}createTileMatrix(s,l,p){let m,_,v;const w=p.canonical,A=W(new Float64Array(16));if(this.isReprojectedInTileSpace){const k=Yw(w,this);m=1,_=k.x+p.wrap*k.scale,v=k.y,ce(A,A,[m/k.scale,m/k.scale,s.pixelsPerMeter/l])}else m=l/s.zoomScale(w.z),_=(w.x+Math.pow(2,w.z)*p.wrap)*m,v=w.y*m;return te(A,A,[_,v,0]),ce(A,A,[m/Ft,m/Ft,1]),A}upVector(s,l,p){return[0,0,1]}upVectorScale(s,l,p){return{metersToTile:1}}}class Upe extends rm{constructor(s){super(s),this.range=[4,7],this.center=s.center||[-96,37.5];const[l,p]=this.parallels=s.parallels||[29.5,45.5],m=Math.sin(Pn(l));this.n=(m+Math.sin(Pn(p)))/2,this.c=1+m*(2*this.n-m),this.r0=Math.sqrt(this.c)/this.n}project(s,l){const{n:p,c:m,r0:_}=this,v=Pn(s-this.center[0]),w=Pn(l),A=Math.sqrt(m-2*p*Math.sin(w))/p;return{x:A*Math.sin(v*p),y:A*Math.cos(v*p)-_,z:0}}unproject(s,l){const{n:p,c:m,r0:_}=this,v=_+l;let w=Math.atan2(s,Math.abs(v))*Math.sign(v);v*p<0&&(w-=Math.PI*Math.sign(s)*Math.sign(v));const A=Pn(this.center[0])*p;w=ze(w,-Math.PI-A,Math.PI-A);const k=re(Ms(w/p)+this.center[0],-180,180),R=Math.asin(re((m-(s*s+v*v)*p*p)/(2*p),-1,1)),j=re(Ms(R),-me,me);return new H(k,j)}}const Qw=1.340264,Jw=-.081106,eS=893e-6,tS=.003796,pA=Math.sqrt(3)/2;class Vpe extends rm{project(s,l){l=l/180*Math.PI,s=s/180*Math.PI;const p=Math.asin(pA*Math.sin(l)),m=p*p,_=m*m*m;return{x:.5*(s*Math.cos(p)/(pA*(Qw+3*Jw*m+_*(7*eS+9*tS*m)))/Math.PI+.5),y:1-.5*(p*(Qw+Jw*m+_*(eS+tS*m))/Math.PI+1),z:0}}unproject(s,l){s=(2*s-.5)*Math.PI;let p=l=(2*(1-l)-1)*Math.PI,m=p*p,_=m*m*m;for(let R,j,z,U=0;U<12&&(j=p*(Qw+Jw*m+_*(eS+tS*m))-l,z=Qw+3*Jw*m+_*(7*eS+9*tS*m),R=j/z,p=re(p-R,-Math.PI/3,Math.PI/3),m=p*p,_=m*m*m,!(Math.abs(R)<1e-12));++U);const v=pA*s*(Qw+3*Jw*m+_*(7*eS+9*tS*m))/Math.cos(p),w=Math.asin(Math.sin(p)/pA),A=re(180*v/Math.PI,-180,180),k=re(180*w/Math.PI,-me,me);return new H(A,k)}}class $pe extends rm{constructor(s){super(s),this.wrap=!0,this.supportsWorldCopies=!0}project(s,l){return{x:.5+s/360,y:.5-l/360,z:0}}unproject(s,l){const p=360*(s-.5),m=re(360*(.5-l),-me,me);return new H(p,m)}}const Mx=Math.PI/2;function fA(u){return Math.tan((Mx+u)/2)}class qpe extends rm{constructor(s){super(s),this.center=s.center||[0,30];const[l,p]=this.parallels=s.parallels||[30,30];let m=Pn(l),_=Pn(p);this.southernCenter=m+_<0,this.southernCenter&&(m=-m,_=-_);const v=Math.cos(m),w=fA(m);this.n=m===_?Math.sin(m):Math.log(v/Math.cos(_))/Math.log(fA(_)/w),this.f=v*Math.pow(fA(m),this.n)/this.n}project(s,l){l=Pn(l),this.southernCenter&&(l=-l),s=Pn(s-this.center[0]);const p=1e-6,{n:m,f:_}=this;_>0?l<-Mx+p&&(l=-Mx+p):l>Mx-p&&(l=Mx-p);const v=_/Math.pow(fA(l),m);let w=v*Math.sin(m*s),A=_-v*Math.cos(m*s);return w=.5*(w/Math.PI+.5),A=.5*(A/Math.PI+.5),{x:w,y:this.southernCenter?A:1-A,z:0}}unproject(s,l){s=(2*s-.5)*Math.PI,this.southernCenter&&(l=1-l),l=(2*(1-l)-.5)*Math.PI;const{n:p,f:m}=this,_=m-l,v=Math.sign(_),w=Math.sign(p)*Math.sqrt(s*s+_*_);let A=Math.atan2(s,Math.abs(_))*v;_*p<0&&(A-=Math.PI*Math.sign(s)*v);const k=re(Ms(A/p)+this.center[0],-180,180),R=re(Ms(2*Math.atan(Math.pow(m/w,1/p))-Mx),-me,me);return new H(k,this.southernCenter?-R:R)}}class kV extends rm{constructor(s){super(s),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(s,l){return{x:se(s),y:ne(l),z:0}}unproject(s,l){const p=fe(s),m=ue(l);return new H(p,m)}}const PV=Pn(me);class Hpe extends rm{project(s,l){const p=(l=Pn(l))*l,m=p*p;return{x:.5*((s=Pn(s))*(.8707-.131979*p+m*(m*(.003971*p-.001529*m)-.013791))/Math.PI+.5),y:1-.5*(l*(1.007226+p*(.015085+m*(.028874*p-.044475-.005916*m)))/Math.PI+1),z:0}}unproject(s,l){s=(2*s-.5)*Math.PI;let p=l=(2*(1-l)-1)*Math.PI,m=25,_=0,v=p*p;do{v=p*p;const k=v*v;_=(p*(1.007226+v*(.015085+k*(.028874*v-.044475-.005916*k)))-l)/(1.007226+v*(.045255+k*(.259866*v-.311325-.005916*11*k))),p=re(p-_,-PV,PV)}while(Math.abs(_)>1e-6&&--m>0);v=p*p;const w=re(Ms(s/(.8707+v*(v*(v*v*v*(.003971-.001529*v)-.013791)-.131979))),-180,180),A=Ms(p);return new H(w,A)}}const NV=Pn(me);class Gpe extends rm{project(s,l){l=Pn(l),s=Pn(s);const p=Math.cos(l),m=2/Math.PI,_=Math.acos(p*Math.cos(s/2)),v=Math.sin(_)/_,w=.5*(s*m+2*p*Math.sin(s/2)/v)||0,A=.5*(l+Math.sin(l)/v)||0;return{x:.5*(w/Math.PI+.5),y:1-.5*(A/Math.PI+1),z:0}}unproject(s,l){let p=s=(2*s-.5)*Math.PI,m=l=(2*(1-l)-1)*Math.PI,_=25;const v=1e-6;let w=0,A=0;do{const k=Math.cos(m),R=Math.sin(m),j=2*R*k,z=R*R,U=k*k,q=Math.cos(p/2),X=Math.sin(p/2),Q=2*q*X,ee=X*X,oe=1-U*q*q,le=oe?1/oe:0,de=oe?Math.acos(k*q)*Math.sqrt(1/oe):0,Ae=.5*(2*de*k*X+2*p/Math.PI)-s,xe=.5*(de*R+m)-l,Me=.5*le*(U*ee+de*k*q*z)+1/Math.PI,Le=le*(Q*j/4-de*R*X),Be=.125*le*(j*X-de*R*U*Q),ut=.5*le*(z*q+de*ee*k)+.5,Xe=Le*Be-ut*Me;w=(xe*Le-Ae*ut)/Xe,A=(Ae*Be-xe*Me)/Xe,p=re(p-w,-Math.PI,Math.PI),m=re(m-A,-NV,NV)}while((Math.abs(w)>v||Math.abs(A)>v)&&--_>0);return new H(Ms(p),Ms(m))}}class MV extends rm{constructor(s){super(s),this.center=s.center||[0,0],this.parallels=s.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Pn(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(s,l){const{scale:p,cosPhi:m}=this;return{x:Pn(s)*m*p+.5,y:-Math.sin(Pn(l))/m*p+.5,z:0}}unproject(s,l){const{scale:p,cosPhi:m}=this,_=-(l-.5)/p,v=re(Ms((s-.5)/p)/m,-180,180),w=Math.asin(re(_*m,-1,1)),A=re(Ms(w),-me,me);return new H(v,A)}}class Wpe extends kV{constructor(s){super(s),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(s,l,p){const m=Ew(s,l,p);return zi(m,m,O2(lh(p))),{x:m[0],y:m[1],z:m[2]}}locationPoint(s,l,p){const m=M(l.lat,l.lng),_=Ei([],m),v=p?s._centerAltitude+p:s.elevation?s.elevation.getAtPointOrZero(s.locationCoordinate(l),s._centerAltitude):s._centerAltitude;Ci(m,m,_,ae(1,0)*Ft*v);const w=W(new Float64Array(16));return G(w,s.pixelMatrix,s.globeMatrix),zi(m,m,w),new Tt(m[0],m[1])}pixelsPerMeter(s,l){return ae(1,0)*l}pixelSpaceConversion(s,l,p){const m=ae(1,s)*l,_=Vi(ae(1,45)*l,m,p);return this.pixelsPerMeter(s,l)/_}createTileMatrix(s,l,p){const m=DD(lh(p.canonical));return G(new Float64Array(16),s.globeMatrix,m)}createInversionMatrix(s,l){const{center:p}=s,m=O2(lh(l));return Te(m,m,Pn(p.lng)),_e(m,m,Pn(p.lat)),ce(m,m,[s._pixelsPerMercatorPixel,s._pixelsPerMercatorPixel,1]),Float32Array.from(m)}pointCoordinate(s,l,p,m){return i5(s,l,p,!0)||new Ke(0,0)}pointCoordinate3D(s,l,p){const m=this.pointCoordinate(s,l,p,0);return[m.x,m.y,m.z]}isPointAboveHorizon(s,l){return!i5(s,l.x,l.y,!1)}farthestPixelDistance(s){const l=function(m,_){const v=m.cameraToCenterDistance,w=m._centerAltitude*_,A=m._camera,k=m._camera.forward(),R=Fe([],Ot([],k,-v),[0,0,w]),j=m.worldSize/(2*Math.PI),z=[0,0,-j],U=m.width/m.height,q=Math.tan(m.fovAboveCenter),X=Ot([],A.up(),q),Q=Ot([],A.right(),q*U),ee=Ei([],Fe([],Fe([],k,X),Q)),oe=[];let le;if(new dn(R,ee).closestPointOnSphere(z,j,oe)){const de=Fe([],oe,z),Ae=Yn([],de,R);le=Math.cos(m.fovAboveCenter)*qt(Ae)}else{const de=Yn([],R,z),Ae=Yn([],z,R);Ei(Ae,Ae);const xe=qt(de)-j;le=Math.sqrt(xe*(xe+2*j));const Me=Math.acos(le/(j+xe))-Math.acos(Ai(k,Ae));le*=Math.cos(Me)}return 1.01*le}(s,this.pixelsPerMeter(s.center.lat,s.worldSize)),p=em(s.zoom);if(p>0){const m=AV(s,ae(1,s.center.lat)*s.worldSize),_=s.worldSize/(2*Math.PI),v=Math.max(s.width,s.height)/s.worldSize*Math.PI;return Vi(l,m+_*(1-Math.cos(v)),Math.pow(p,10))}return l}upVector(s,l,p){return Ew(l,p,s,1)}upVectorScale(s){return{metersToTile:j2(L2(lh(s)))}}}function DV(u){const s=u.parallels,l=!!s&&Math.abs(s[0]+s[1])<.01;switch(u.name){case"mercator":return new kV(u);case"equirectangular":return new $pe(u);case"naturalEarth":return new Hpe(u);case"equalEarth":return new Vpe(u);case"winkelTripel":return new Gpe(u);case"albers":return l?new MV(u):new Upe(u);case"lambertConformalConic":return l?new MV(u):new qpe(u);case"globe":return new Wpe(u)}throw new Error(`Invalid projection name: ${u.name}`)}const Kpe=wt.types,Zpe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function iS(u,s,l,p,m,_,v,w,A,k,R,j,z){const U=w?Math.min(wp,Math.round(w[0])):0,q=w?Math.min(wp,Math.round(w[1])):0;u.emplaceBack(s,l,Math.round(32*p),Math.round(32*m),_,v,(U<<1)+(A?1:0),0+(q<<1),16*k,16*R,256*j,256*z)}function nS(u,s,l){u.emplaceBack(s,l)}function rS(u,s,l,p,m,_,v){u.emplaceBack(s,l,p,m,_,v)}const mA=(u,s,l,p)=>{for(let m=0;m<s;m++)u.emplaceBack(l[0],l[1],l[2],p[0],p[1],p[2])};function Dx(u,s,l,p,m){u.emplaceBack(s,l,p,m),u.emplaceBack(s,l,p,m),u.emplaceBack(s,l,p,m),u.emplaceBack(s,l,p,m)}function Xpe(u){for(const s of u.sections)if(gD(s.text))return!0;return!1}class IR{constructor(s){this.layoutVertexArray=new ax,this.indexArray=new Xr,this.programConfigurations=s,this.segments=new ls,this.dynamicLayoutVertexArray=new oh,this.opacityVertexArray=new uw,this.placedSymbolArray=new Ay,this.iconTransitioningVertexArray=new Sc,this.globeExtVertexArray=new Hf,this.zOffsetVertexArray=new ed,this.orientationVertexArray=new pw,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(s,l){const p=[],m=this.layoutVertexArray.uint16;for(let _=0;_<l;++_){const v=12*(s+_);p.push(...m.slice(v,v+12))}return p}updateIconVertexData(s,l,p,m,_,v,w,A,k,R,j,z,U){const q=this.layoutVertexArray.uint16,X=12*s;q[X]=l,q[X+1]=p,q[X+2]=m,q[X+3]=_,q[X+4]=v,q[X+5]=w,q[X+6]=A,q[X+7]=k,q[X+8]=R,q[X+9]=j,q[X+10]=z,q[X+11]=U}upload(s,l,p,m,_,v){this.isEmpty()||(p&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,epe.members,!!v),this.indexBuffer=s.createIndexBuffer(this.indexArray,l),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,ipe.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,Zpe,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=s.createVertexBuffer(this.iconTransitioningVertexArray,spe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=s.createVertexBuffer(this.globeExtVertexArray,tpe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||_)&&(this.zOffsetVertexBuffer=s.createVertexBuffer(this.zOffsetVertexArray,npe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=s.createVertexBuffer(this.orientationVertexArray,rpe.members,!0)),this.opacityVertexBuffer.itemSize=1),(p||m)&&this.programConfigurations.upload(s))}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())}}ri(IR,"SymbolBuffers");class kR{constructor(s,l,p){this.layoutVertexArray=new s,this.layoutAttributes=l,this.indexArray=new p,this.segments=new ls,this.collisionVertexArray=new Wf,this.collisionVertexArrayExt=new oh}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,ope.members,!0),this.collisionVertexBufferExt=s.createVertexBuffer(this.collisionVertexArrayExt,ape.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}ri(kR,"CollisionBuffers");class gA{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(v=>v.fqid),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=W([]),this.placementViewportMatrix=W([]);const l=this.layers[0]._unevaluatedLayout._values;this.worldview=s.worldview,this.textSizeData=Ix(this.zoom,l["text-size"],this.worldview),this.iconSizeData=Ix(this.zoom,l["icon-size"],this.worldview);const p=this.layers[0].layout,m=p.get("symbol-sort-key"),_=p.get("symbol-z-order");this.lut=s.lut,this.canOverlap=p.get("text-allow-overlap")||p.get("icon-allow-overlap")||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=_!=="viewport-y"&&m.constantOr(1)!==void 0,this.sortFeaturesByY=(_==="viewport-y"||_==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=p.get("text-writing-mode").map(v=>ql[v]),this.stateDependentLayerIds=this.layers.filter(v=>v.isStateDependent()).map(v=>v.id),this.sourceID=s.sourceID,this.projection=s.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}hasAnyAppearanceProperty(s){const l=this.layers[0].getAppearances();return!(!l||l.length===0)&&l.some(p=>p.getProperty(s)!=null)}createArrays(){this.text=new IR(new Gc(this.layers,{zoom:this.zoom,lut:this.lut},s=>s.startsWith("text")||s.startsWith("symbol"))),this.icon=new IR(new Gc(this.layers,{zoom:this.zoom,lut:this.lut},s=>s.startsWith("icon")||s.startsWith("symbol"))),this.glyphOffsetArray=new xw,this.lineVertexArray=new C2,this.symbolInstances=new T2}calculateGlyphDependencies(s,l,p,m,_){for(const v of s){const w=v.codePointAt(0);if(w===void 0)break;if(l[w]=!0,m&&_&&w<=65535){const A=Hw[v];A&&(l[A.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(s,l,p,m,_,v){let w=1;const A=s.getUnevaluatedProperties()._values["icon-size"],k=Ix(this.zoom,A,this.worldview),R=kx(k,l);if(k.kind!=="constant"&&k.kind!=="camera"||(w=R.uSize),k.kind==="composite"){const{minZoom:j,maxZoom:z}=k,U=A.possiblyEvaluate(new Rr(j,{worldview:this.worldview}),m),q=A.possiblyEvaluate(new Rr(z,{worldview:this.worldview}),m),X=U.evaluate(p,{},m,_);w=X+(q.evaluate(p,{},m,_)-X)*R.uSizeT}return k.kind==="source"&&(w=A.possiblyEvaluate(new Rr(this.zoom,{worldview:this.worldview}),m).evaluate(p,{},m,_)),w*v}updateFootprints(s,l){}updateReplacement(s,l){if(l.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=l.updateTime;const p=l.getReplacementRegionsForTile(s.toUnwrapped(),!0);return!q2(this.activeReplacements,p)&&(this.activeReplacements=p,!0)}getResolvedImageFromTokens(s){return typeof s=="string"?Ya.build(s):s}populate(s,l,p,m){const _=this.layers[0],v=_.layout,w=this.projection.name==="globe",A=v.get("text-font"),k=v.get("text-field"),R=v.get("icon-image"),[j,z]=v.get("icon-size-scale-range"),U=re(l.scaleFactor||1,j,z),q=(k.value.kind!=="constant"||k.value.value instanceof _o&&!k.value.value.isEmpty()||k.value.value.toString().length>0)&&(A.value.kind!=="constant"||A.value.value.length>0),X=R.value.kind!=="constant"||!!R.value.value||Object.keys(R.parameters).length>0,Q=this.hasAnyAppearanceProperty("icon-image"),ee=v.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!q&&!X&&!Q)return;const oe=l.iconDependencies,le=l.glyphDependencies,de=l.availableImages,Ae=new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),xe=Me=>{const Le=Me.id.toString();oe.has(Le)?oe.get(Le).push(Me):oe.set(Le,[Me])};for(const Me of s){const{feature:Le,id:Be,index:ut,sourceLayerIndex:Xe}=Me,ht=_._featureFilter.needGeometry,_t=nt(Le,ht);if(!_._featureFilter.filter(Ae,_t,p))continue;if(ht||(_t.geometry=yt(Le,p,m)),w&&Le.type!==1&&p.z<=5){const St=_t.geometry,Dt=.98078528056,xt=(ni,ai)=>Ai(Ew(ni.x,ni.y,p,1),Ew(ai.x,ai.y,p,1))<Dt;for(let ni=0;ni<St.length;ni++)St[ni]=gt(St[ni],xt)}let bt,zt;if(q){const St=_.getValueAndResolveTokens("text-field",_t,p,de),Dt=_o.factory(St);Xpe(Dt)&&(this.hasRTLText=!0),(!this.hasRTLText||tw()==="unavailable"||this.hasRTLText&&gl.isParsed())&&(bt=cpe(Dt,_,_t))}if(X){const St=_.getValueAndResolveTokens("icon-image",_t,p,de);zt=this.getResolvedImageFromTokens(St)}const Et=this.layers[0];let vt=!1;if(!zt&&Q){const St=Et.getAppearances();for(const Dt of St)if(Dt.getProperty("icon-image")){const xt=Et.getAppearanceValueAndResolveTokens(Dt,"icon-image",_t,p,de);if(xt){zt=this.getResolvedImageFromTokens(xt),vt=!0;break}}}if(!bt&&!zt)continue;const Ct=this.sortFeaturesByKey?ee.evaluate(_t,{},p):void 0,at={id:Be,text:bt,icon:zt,index:ut,sourceLayerIndex:Xe,geometry:_t.geometry,properties:Le.properties,type:Kpe[Le.type],sortKey:Ct};
821if(this.features.push(at),this.appearanceFeatureData.push({id:Be,properties:Le.properties,usesAppearanceIconAsPlaceholder:vt,isUsingAppearanceVertexData:!1,layoutBasedVertexData:[],activeAppearance:null}),zt){const St=Et._unevaluatedLayout._values,{iconPrimary:Dt,iconSecondary:xt}=Zw(zt,this.iconSizeData,St["icon-size"],p,this.zoom,at,this.pixelRatio,U,this.worldview);xe(Dt),xt&&(this.hasAnySecondaryIcon=!0,xe(xt))}const st=Et.getAppearances();if(st.length!==0&&st.forEach(St=>{if(!St.getProperty("icon-image"))return;const Dt=this.getCombinedIconPrimary(St,Et,_t,p,de,at,U);Dt&&xe(Dt)}),bt){const St=A.evaluate(_t,{},p).join(","),Dt=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ql.vertical)>=0;for(const xt of bt.sections)if(xt.image){const ni=xt.image.getPrimary().scaleSelf(this.pixelRatio),ai=ni.id.toString(),Qt=oe.get(ai)||[];Qt.push(ni),oe.set(ai,Qt)}else{const ni=Z1(bt.toString()),ai=xt.fontStack||St,Qt=le[ai]=le[ai]||{};this.calculateGlyphDependencies(xt.text,Qt,Dt,this.allowVerticalPlacement,ni)}}}if(v.get("symbol-placement")==="line"&&(this.features=function(Me){const Le={},Be={},ut=[];let Xe=0;function ht(Et){ut.push(Me[Et]),Xe++}function _t(Et,vt,Ct){const at=Be[Et];return delete Be[Et],Be[vt]=at,ut[at].geometry[0].pop(),ut[at].geometry[0]=ut[at].geometry[0].concat(Ct[0]),at}function bt(Et,vt,Ct){const at=Le[vt];return delete Le[vt],Le[Et]=at,ut[at].geometry[0].shift(),ut[at].geometry[0]=Ct[0].concat(ut[at].geometry[0]),at}function zt(Et,vt,Ct){const at=Ct?vt[0][vt[0].length-1]:vt[0][0];return`${Et}:${at.x}:${at.y}`}for(let Et=0;Et<Me.length;Et++){const vt=Me[Et],Ct=vt.geometry,at=vt.text?vt.text.toString():null;if(!at){ht(Et);continue}const st=zt(at,Ct),St=zt(at,Ct,!0);if(st in Be&&St in Le&&Be[st]!==Le[St]){const Dt=bt(st,St,Ct),xt=_t(st,St,ut[Dt].geometry);delete Le[st],delete Be[St],Be[zt(at,ut[xt].geometry,!0)]=xt,ut[Dt].geometry=null}else st in Be?_t(st,St,Ct):St in Le?bt(st,St,Ct):(ht(Et),Le[st]=Xe-1,Be[St]=Xe-1)}return ut.filter(Et=>Et.geometry)}(this.features)),v.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",l.elevationFeatures){!this.elevationFeatures&&l.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const Me of l.elevationFeatures)this.elevationFeatureIdToIndex.set(Me.id,this.elevationFeatures.length),this.elevationFeatures.push(Me)}}else v.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((Me,Le)=>Me.sortKey-Le.sortKey)}getCombinedIconPrimary(s,l,p,m,_,v,w){let A,k;const R=s.getUnevaluatedProperties();if(R._values["icon-image"].value!==void 0){const j=l.getAppearanceValueAndResolveTokens(s,"icon-image",p,m,_);A=this.getResolvedImageFromTokens(j)}else{const j=l.getValueAndResolveTokens("icon-image",p,m,_);A=this.getResolvedImageFromTokens(j)}if(A){const j=R._values["icon-size"]||l._unevaluatedLayout._values["icon-size"];k=Zw(A,Ix(this.zoom,j,this.worldview),j,m,this.zoom,v,this.pixelRatio,w,this.worldview).iconPrimary}return k}updateAppearanceBasedIconTextures(s,l,p,m){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const _=this.layers[0];let v=!1,w=0;const A=_.layout,[k,R]=A.get("icon-size-scale-range"),j=re(1,k,R);for(let z=0;z<this.symbolInstances.length;z++){const U=this.symbolInstances.get(z),q=this.appearanceFeatureData[U.featureIndex];if(q&&U.placedIconSymbolIndex>=0){const X=q.id,Q=l&&X!==void 0?l[String(X)]:void 0,ee={type:"Point",id:q.id,properties:q.properties,geometry:[]},oe=this.layers[0].appearances&&this.layers[0].appearances.find(le=>le.isActive({globals:m,feature:ee,canonical:s,featureState:Q}));if(q.activeAppearance===oe)continue;if(oe){q.activeAppearance=oe;const le={sortKey:void 0,text:void 0,icon:null,index:U.featureIndex,sourceLayerIndex:U.featureIndex,geometry:[],properties:q.properties,type:"Point",id:q.id};if(!oe.hasCachedIconPrimary()){const Me=this.getCombinedIconPrimary(oe,_,ee,s,p,le,j);oe.setCachedIconPrimary(Me)}const de=oe.getCachedIconPrimary();if(!de)continue;const Ae=de.toString(),xe=this.iconAtlasPositions&&this.iconAtlasPositions.get(Ae);if(xe){const Me=_.getAppearanceValueAndResolveTokens(oe,"icon-offset",ee,s,p),Le=Me&&Array.isArray(Me)?Me:[0,0];let Be=oA(xe,void 0,Le,_.layout.get("icon-anchor").evaluate(ee,{},s));const ut=_.getAppearanceValueAndResolveTokens(oe,"icon-rotate",ee,s,p),Xe=typeof ut=="number"?ut:0,ht=xe.sdf,_t=_.layout.get("icon-text-fit").constantOr("none");_t!=="none"&&q.textShaping&&q.iconTextFitPadding&&q.fontScale&&(Be=vR(Be,q.textShaping,_t,q.iconTextFitPadding,Le,q.fontScale));
821const bt=this.calculateEffectiveAppearanceIconSize(oe,m.zoom,ee,s,p,j),zt=0,Et=1+(Math.min(wp,Math.round(bt*sd))<<1),vt=SR(Be,Xe,ht,_t!=="none",j);q.isUsingAppearanceVertexData||(q.isUsingAppearanceVertexData=!0,q.layoutBasedVertexData=this.icon.getIconVertexData(w,U.numIconVertices));for(let at=0;at<vt.length;++at){const st=vt[at],St=q.layoutBasedVertexData[0]||U.tileAnchorX,Dt=q.layoutBasedVertexData[1]||U.tileAnchorY,xt=16*st.pixelOffsetTL.x,ni=16*st.pixelOffsetTL.y,ai=16*st.pixelOffsetBR.x,Qt=16*st.pixelOffsetBR.y,Ht=16*st.minFontScaleX,Zi=16*st.minFontScaleY;this.icon.updateIconVertexData(w,St,Dt,Math.round(32*st.tl.x),Math.round(32*st.tl.y),st.texPrimary.x,st.texPrimary.y,zt,Et,xt,ni,Ht,Zi),this.icon.updateIconVertexData(w+1,St,Dt,Math.round(32*st.tr.x),Math.round(32*st.tr.y),st.texPrimary.x+st.texPrimary.w,st.texPrimary.y,zt,Et,ai,ni,Ht,Zi),this.icon.updateIconVertexData(w+2,St,Dt,Math.round(32*st.bl.x),Math.round(32*st.bl.y),st.texPrimary.x,st.texPrimary.y+st.texPrimary.h,zt,Et,xt,Qt,Ht,Zi),this.icon.updateIconVertexData(w+3,St,Dt,Math.round(32*st.br.x),Math.round(32*st.br.y),st.texPrimary.x+st.texPrimary.w,st.texPrimary.y+st.texPrimary.h,zt,Et,ai,Qt,Ht,Zi),w+=4}const Ct=U.numIconVertices-4*vt.length;for(let at=0;at<Ct;++at)this.icon.updateIconVertexData(w+at,0,0,0,0,0,0,0,0,0,0,0,0);v=!0}else w+=U.numIconVertices}else if(q.usesAppearanceIconAsPlaceholder)this.layers[0].appearances&&this.layers[0].appearances.length>0&&(this.icon.updateIconVertexData(w,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(w+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(w+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(w+3,0,0,0,0,0,0,0,0,0,0,0,0),v=!0),w+=U.numIconVertices,q.activeAppearance=null;else if(q.isUsingAppearanceVertexData){const de=q.layoutBasedVertexData.length/12;for(let Ae=0;Ae<de;++Ae){const xe=Ae*12;this.icon.updateIconVertexData(w+Ae,q.layoutBasedVertexData[xe+0],q.layoutBasedVertexData[xe+1],q.layoutBasedVertexData[xe+2],q.layoutBasedVertexData[xe+3],q.layoutBasedVertexData[xe+4],q.layoutBasedVertexData[xe+5],q.layoutBasedVertexData[xe+6],q.layoutBasedVertexData[xe+7],q.layoutBasedVertexData[xe+8],q.layoutBasedVertexData[xe+9],q.layoutBasedVertexData[xe+10],q.layoutBasedVertexData[xe+11])}w+=de,q.isUsingAppearanceVertexData=!1,q.activeAppearance=null,v=!0}else w+=U.numIconVertices,q.activeAppearance=null}}return v}update(s,l,p,m,_,v,w){this.text.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,this.worldview),this.icon.programConfigurations.updatePaintArrays(s,l,_,p,m,v,w,this.worldview)}updateRoadElevation(s){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let l=!1;const p=ke(s),m=1/p;let _=!1,v=!1;for(let w=0;w<this.symbolInstances.length;w++){const A=this.symbolInstances.get(w),k=kt(1,0,0),R=kt(0,1,0),{numHorizontalGlyphVertices:j,numVerticalGlyphVertices:z,numIconVertices:U,numVerticalIconVertices:q}=A,X=j>0||z>0,Q=U>0,ee=this.elevationFeatures[A.elevationFeatureIndex];if(ee){const oe=new Tt(A.tileAnchorX,A.tileAnchorY),le=.075+ee.pointElevation(oe);A.zOffset!==le&&(l=!0,A.zOffset=le),le!==0&&(this.hasAnyZOffset=!0);const de=ee.computeSlopeNormal(oe,m),Ae=ta(Li(),kt(0,0,1),de);Sr(k,k,Ae),Sr(R,R,Ae),k[2]*=p,R[2]*=p,k[0]===1&&k[1]===0&&k[2]===0&&R[0]===0&&R[1]===1&&R[2]===0||(_=_||X,v=v||Q)}if(X&&(mA(this.text.orientationVertexArray,j,k,R),mA(this.text.orientationVertexArray,z,k,R)),Q){const{placedIconSymbolIndex:oe,verticalPlacedIconSymbolIndex:le}=A;oe>=0&&mA(this.icon.orientationVertexArray,U,k,R),le>=0&&mA(this.icon.orientationVertexArray,q,k,R)}}_||(this.text.orientationVertexArray=void 0),v||(this.icon.orientationVertexArray=void 0),l&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const s=(_,v,w)=>{p+=v,p>_.length&&_.resize(p);for(let A=-v;A<0;A++)_.emplace(A+p,w)},l=(_,v,w)=>{m+=v,m>_.length&&_.resize(m);for(let A=-v;A<0;A++)_.emplace(A+m,w)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let p=0,m=0;for(let _=0;_<this.symbolInstances.length;_++){const v=this.symbolInstances.get(_),{numHorizontalGlyphVertices:w,numVerticalGlyphVertices:A,numIconVertices:k}=v,R=v.zOffset,j=k>0;if((w>0||A>0)&&(s(this.text.zOffsetVertexArray,w,R),s(this.text.zOffsetVertexArray,A,R)),j){const{placedIconSymbolIndex:z,verticalPlacedIconSymbolIndex:U}=v;z>=0&&l(this.icon.zOffsetVertexArray,k,R),U>=0&&l(this.icon.zOffsetVertexArray,v.numVerticalIconVertices,R)}}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(s,l,p,m,_){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(v=>v.appearances&&v.appearances.length>0)),this.icon.upload(s,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(s,l,p,m){return!!(s&&l&&p)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(s,l,p,m)&&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=DV(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(s,l){const p=this.lineVertexArray.length;if(s.segment!==void 0)for(const{x:m,y:_}of l)this.lineVertexArray.emplaceBack(m,_);return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(s,l,p,m,_,v,w,A,k,R,j,z,U,q,X,Q,ee,oe){const le=s.indexArray,de=s.layoutVertexArray,Ae=s.globeExtVertexArray,xe=s.segments.prepareSegment(4*oe,de,le,this.canOverlap?v.sortKey:void 0),Me=this.glyphOffsetArray.length,Le=xe.vertexLength,Be=this.allowVerticalPlacement&&w===ql.vertical?Math.PI/2:0,ut=v.text&&v.text.sections;for(let _t=0;_t<l.length;_t++){const{tl:bt,tr:zt,bl:Et,br:vt,texPrimary:Ct,texSecondary:at,pixelOffsetTL:st,pixelOffsetBR:St,minFontScaleX:Dt,minFontScaleY:xt,glyphOffset:ni,isSDF:ai,sectionIndex:Qt}=l[_t],Ht=xe.vertexLength,Zi=ni[1];
vendor: 17,098 bytes, line 821
821if(iS(de,k.x,k.y,bt.x,Zi+bt.y,Ct.x,Ct.y,p,ai,st.x,st.y,Dt,xt),iS(de,k.x,k.y,zt.x,Zi+zt.y,Ct.x+Ct.w,Ct.y,p,ai,St.x,st.y,Dt,xt),iS(de,k.x,k.y,Et.x,Zi+Et.y,Ct.x,Ct.y+Ct.h,p,ai,st.x,St.y,Dt,xt),iS(de,k.x,k.y,vt.x,Zi+vt.y,Ct.x+Ct.w,Ct.y+Ct.h,p,ai,St.x,St.y,Dt,xt),A){const{x:Kt,y:Ii,z:tn}=A.anchor,[yn,Un,sn]=A.up;rS(Ae,Kt,Ii,tn,yn,Un,sn),rS(Ae,Kt,Ii,tn,yn,Un,sn),rS(Ae,Kt,Ii,tn,yn,Un,sn),rS(Ae,Kt,Ii,tn,yn,Un,sn),Dx(s.dynamicLayoutVertexArray,Kt,Ii,tn,Be)}else Dx(s.dynamicLayoutVertexArray,k.x,k.y,k.z,Be);if(Q){const Kt=at||Ct;nS(s.iconTransitioningVertexArray,Kt.x,Kt.y),nS(s.iconTransitioningVertexArray,Kt.x+Kt.w,Kt.y),nS(s.iconTransitioningVertexArray,Kt.x,Kt.y+Kt.h),nS(s.iconTransitioningVertexArray,Kt.x+Kt.w,Kt.y+Kt.h)}le.emplaceBack(Ht,Ht+1,Ht+2),le.emplaceBack(Ht+1,Ht+2,Ht+3),xe.vertexLength+=4,xe.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ni[0]),_t!==l.length-1&&Qt===l[_t+1].sectionIndex||s.programConfigurations.populatePaintArrays(de.length,v,v.index,{},U,q,X,ut&&ut[Qt],this.worldview)}const Xe=oe-l.length;Xe!==0&&this._addNullVertices(Xe,de,p,A,Ae,s,Q,xe,le);const ht=A?A.anchor:k;s.placedSymbolArray.emplaceBack(ht.x,ht.y,ht.z,k.x,k.y,Me,this.glyphOffsetArray.length-Me,Le,R,j,k.segment,p?p[0]:0,p?p[1]:0,m[0],m[1],w,0,0,0,z,0),s.symbolInstanceIndices.push(ee)}_addNullVertices(s,l,p,m,_,v,w,A,k){for(let R=0;R<s;R++){for(let z=0;z<4;z++)iS(l,0,0,0,0,0,0,p,!1,0,0,0,0),m&&rS(_,0,0,0,0,0,0),Dx(v.dynamicLayoutVertexArray,0,0,0,0),w&&nS(v.iconTransitioningVertexArray,0,0);const j=A.vertexLength;k.emplaceBack(j,j+1,j+2),k.emplaceBack(j+1,j+2,j+3),A.vertexLength+=4,A.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(s,l,p,m,_,v,w){s.emplaceBack(l,p,m,_,v,Math.round(w.x),Math.round(w.y))}_addCollisionDebugVertices(s,l,p,m,_,v,w){const A=p.segments.prepareSegment(4,p.layoutVertexArray,p.indexArray),k=A.vertexLength,R=w.tileAnchorX,j=w.tileAnchorY;for(let U=0;U<4;U++)p.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(p.collisionVertexArrayExt,l,s.padding,w.zOffset),this._commitLayoutVertex(p.layoutVertexArray,m,_,v,R,j,new Tt(s.x1,s.y1)),this._commitLayoutVertex(p.layoutVertexArray,m,_,v,R,j,new Tt(s.x2,s.y1)),this._commitLayoutVertex(p.layoutVertexArray,m,_,v,R,j,new Tt(s.x2,s.y2)),this._commitLayoutVertex(p.layoutVertexArray,m,_,v,R,j,new Tt(s.x1,s.y2)),A.vertexLength+=4;const z=p.indexArray;z.emplaceBack(k,k+1),z.emplaceBack(k+1,k+2),z.emplaceBack(k+2,k+3),z.emplaceBack(k+3,k),A.primitiveLength+=4}_addTextDebugCollisionBoxes(s,l,p,m,_,v){for(let w=m;w<_;w++){const A=p.get(w),k=this.getSymbolInstanceTextSize(s,v,l,w);this._addCollisionDebugVertices(A,k,this.textCollisionBox,A.projectedAnchorX,A.projectedAnchorY,A.projectedAnchorZ,v)}}_addIconDebugCollisionBoxes(s,l,p,m,_,v){for(let w=m;w<_;w++){const A=p.get(w),k=this.getSymbolInstanceIconSize(s,l,v.placedIconSymbolIndex);this._addCollisionDebugVertices(A,k,this.iconCollisionBox,A.projectedAnchorX,A.projectedAnchorY,A.projectedAnchorZ,v)}}generateCollisionDebugBuffers(s,l,p){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new kR(lx,XU.members,Sc),this.iconCollisionBox=new kR(lx,XU.members,Sc);const m=kx(this.iconSizeData,s),_=kx(this.textSizeData,s,p);for(let v=0;v<this.symbolInstances.length;v++){const w=this.symbolInstances.get(v);this._addTextDebugCollisionBoxes(_,s,l,w.textBoxStartIndex,w.textBoxEndIndex,w),this._addTextDebugCollisionBoxes(_,s,l,w.verticalTextBoxStartIndex,w.verticalTextBoxEndIndex,w),this._addIconDebugCollisionBoxes(m,s,l,w.iconBoxStartIndex,w.iconBoxEndIndex,w),this._addIconDebugCollisionBoxes(m,s,l,w.verticalIconBoxStartIndex,w.verticalIconBoxEndIndex,w)}}getSymbolInstanceTextSize(s,l,p,m){const _=this.text.placedSymbolArray.get(l.rightJustifiedTextSymbolIndex>=0?l.rightJustifiedTextSymbolIndex:l.centerJustifiedTextSymbolIndex>=0?l.centerJustifiedTextSymbolIndex:l.leftJustifiedTextSymbolIndex>=0?l.leftJustifiedTextSymbolIndex:l.verticalPlacedTextSymbolIndex>=0?l.verticalPlacedTextSymbolIndex:m),v=xR(this.textSizeData,s,_)/zo;return this.tilePixelRatio*v}getSymbolInstanceIconSize(s,l,p){const m=this.icon.placedSymbolArray.get(p),_=xR(this.iconSizeData,s,m);return this.tilePixelRatio*_}_commitDebugCollisionVertexUpdate(s,l,p,m){s.emplaceBack(l,-p,-p,m),s.emplaceBack(l,p,-p,m),s.emplaceBack(l,p,p,m),s.emplaceBack(l,-p,p,m)}_updateTextDebugCollisionBoxes(s,l,p,m,_,v,w){for(let A=m;A<_;A++){const k=p.get(A),R=this.getSymbolInstanceTextSize(s,v,l,A);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,R,k.padding,v.zOffset)}}_updateIconDebugCollisionBoxes(s,l,p,m,_,v,w){for(let A=m;A<_;A++){const k=p.get(A),R=this.getSymbolInstanceIconSize(s,l,v.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,R,k.padding,v.zOffset)}}updateCollisionDebugBuffers(s,l,p,m){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const _=kx(this.iconSizeData,s,m),v=kx(this.textSizeData,s,p);for(let w=0;w<this.symbolInstances.length;w++){const A=this.symbolInstances.get(w);this._updateTextDebugCollisionBoxes(v,s,l,A.textBoxStartIndex,A.textBoxEndIndex,A,p),this._updateTextDebugCollisionBoxes(v,s,l,A.verticalTextBoxStartIndex,A.verticalTextBoxEndIndex,A,p),this._updateIconDebugCollisionBoxes(_,s,l,A.iconBoxStartIndex,A.iconBoxEndIndex,A,m),this._updateIconDebugCollisionBoxes(_,s,l,A.verticalIconBoxStartIndex,A.verticalIconBoxEndIndex,A,m)}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(s,l,p,m,_,v,w,A,k){const R={};if(l<p){const{x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de,featureIndex:Ae}=s.get(l);R.textBox={x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de},R.textFeatureIndex=Ae}if(m<_){const{x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de,featureIndex:Ae}=s.get(m);R.verticalTextBox={x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de},R.verticalTextFeatureIndex=Ae}if(v<w){const{x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de,featureIndex:Ae}=s.get(v);R.iconBox={x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de},R.iconFeatureIndex=Ae}if(A<k){const{x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de,featureIndex:Ae}=s.get(A);R.verticalIconBox={x1:j,y1:z,x2:U,y2:q,padding:X,projectedAnchorX:Q,projectedAnchorY:ee,projectedAnchorZ:oe,tileAnchorX:le,tileAnchorY:de},R.verticalIconFeatureIndex=Ae}return R}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let l=0;l<this.symbolInstances.length;l++){const p=this.symbolInstances.get(l);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.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(s,l){const p=s.placedSymbolArray.get(l),m=p.vertexStartIndex+4*p.numGlyphs;for(let _=p.vertexStartIndex;_<m;_+=4)s.indexArray.emplaceBack(_,_+1,_+2),s.indexArray.emplaceBack(_+1,_+2,_+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const l=Math.sin(s),p=Math.cos(s),m=[],_=[],v=[];for(let w=0;w<this.symbolInstances.length;++w){v.push(w);const A=this.symbolInstances.get(w);m.push(0|Math.round(l*A.tileAnchorX+p*A.tileAnchorY)),_.push(A.featureIndex)}return v.sort((w,A)=>m[w]-m[A]||_[A]-_[w]),v}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let s=0;s<this.symbolInstances.length;++s)this.symbolInstanceIndexesSortedZOffset.push(s)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((s,l)=>this.symbolInstances.get(l).zOffset-this.symbolInstances.get(s).zOffset)}addToSortKeyRanges(s,l){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===l?p.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:l,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const l of this.symbolInstanceIndexes){const p=this.symbolInstances.get(l);this.featureSortOrder.push(p.featureIndex);const{rightJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:_,leftJustifiedTextSymbolIndex:v,verticalPlacedTextSymbolIndex:w,placedIconSymbolIndex:A,verticalPlacedIconSymbolIndex:k}=p;m>=0&&this.addIndicesForPlacedSymbol(this.text,m),_>=0&&_!==m&&this.addIndicesForPlacedSymbol(this.text,_),v>=0&&v!==_&&v!==m&&this.addIndicesForPlacedSymbol(this.text,v),w>=0&&this.addIndicesForPlacedSymbol(this.text,w),A>=0&&this.addIndicesForPlacedSymbol(this.icon,A),k>=0&&this.addIndicesForPlacedSymbol(this.icon,k)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(s){const l=this.symbolInstances.get(this.text.symbolInstanceIndices[s]).elevationFeatureIndex;let p;return this.elevationFeatures&&l<this.elevationFeatures.length&&(p=this.elevationFeatures[l]),p}}function RV(u,s){return s.replace(/{([^{}]+)}/g,(l,p)=>p in u?String(u[p]):"")}let jV,zV,PR;ri(gA,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),gA.addDynamicAttributes=Dx;class LV{constructor(s){this.type=s.property.overrides?s.property.overrides.runtimeType:vf,this.defaultValue=s}evaluate(s){if(s.formattedSection){const l=this.defaultValue.property.overrides;if(l&&l.hasOverride(s.formattedSection))return l.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ri(LV,"FormatSectionOverride",{omit:["defaultValue"]});const NR=()=>PR||(PR={layout:jV||(jV=new bs({"symbol-placement":new Nt(Ze.layout_symbol["symbol-placement"]),"symbol-spacing":new Nt(Ze.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nt(Ze.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zt(Ze.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nt(Ze.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Nt(Ze.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Nt(Ze.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Nt(Ze.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Nt(Ze.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nt(Ze.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nt(Ze.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zt(Ze.layout_symbol["icon-size"]),"icon-size-scale-range":new Nt(Ze.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Zt(Ze.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Zt(Ze.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zt(Ze.layout_symbol["icon-image"]),"icon-image-use-theme":new Nt({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Zt(Ze.layout_symbol["icon-rotate"]),"icon-padding":new Nt(Ze.layout_symbol["icon-padding"]),"icon-keep-upright":new Nt(Ze.layout_symbol["icon-keep-upright"]),"icon-offset":new Zt(Ze.layout_symbol["icon-offset"]),"icon-anchor":new Zt(Ze.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nt(Ze.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nt(Ze.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nt(Ze.layout_symbol["text-rotation-alignment"]),"text-field":new Zt(Ze.layout_symbol["text-field"]),"text-font":new Zt(Ze.layout_symbol["text-font"]),"text-size":new Zt(Ze.layout_symbol["text-size"]),"text-size-scale-range":new Nt(Ze.layout_symbol["text-size-scale-range"]),"text-max-width":new Zt(Ze.layout_symbol["text-max-width"]),"text-line-height":new Zt(Ze.layout_symbol["text-line-height"]),"text-letter-spacing":new Zt(Ze.layout_symbol["text-letter-spacing"]),"text-justify":new Zt(Ze.layout_symbol["text-justify"]),"text-radial-offset":new Zt(Ze.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nt(Ze.layout_symbol["text-variable-anchor"]),"text-anchor":new Zt(Ze.layout_symbol["text-anchor"]),"text-max-angle":new Nt(Ze.layout_symbol["text-max-angle"]),"text-writing-mode":new Nt(Ze.layout_symbol["text-writing-mode"]),"text-rotate":new Zt(Ze.layout_symbol["text-rotate"]),"text-padding":new Nt(Ze.layout_symbol["text-padding"]),"text-keep-upright":new Nt(Ze.layout_symbol["text-keep-upright"]),"text-transform":new Zt(Ze.layout_symbol["text-transform"]),"text-offset":new Zt(Ze.layout_symbol["text-offset"]),"text-allow-overlap":new Nt(Ze.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Nt(Ze.layout_symbol["text-ignore-placement"]),"text-optional":new Nt(Ze.layout_symbol["text-optional"]),visibility:new Nt(Ze.layout_symbol.visibility)})),paint:zV||(zV=new bs({"icon-opacity":new Zt(Ze.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Zt(Ze.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Zt(Ze.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Zt(Ze.paint_symbol["text-emissive-strength"]),"icon-color":new Zt(Ze.paint_symbol["icon-color"]),"icon-halo-color":new Zt(Ze.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zt(Ze.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zt(Ze.paint_symbol["icon-halo-blur"]),"icon-translate":new Nt(Ze.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nt(Ze.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Nt(Ze.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Zt(Ze.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Zt(Ze.paint_symbol["text-occlusion-opacity"]),"text-color":new Zt(Ze.paint_symbol["text-color"],{runtimeType:fl,getOverride:u=>u.textColor,hasOverride:u=>!!u.textColor}),"text-halo-color":new Zt(Ze.paint_symbol["text-halo-color"]),"text-halo-width":new Zt(Ze.paint_symbol["text-halo-width"]),"text-halo-blur":new Zt(Ze.paint_symbol["text-halo-blur"]),"text-translate":new Nt(Ze.paint_symbol["text-translate"]),"text-translate-anchor":new Nt(Ze.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Nt(Ze.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Nt(Ze.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Nt(Ze.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Nt(Ze.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Zt(Ze.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},PR);class yA extends _a{constructor(s,l,p,m){super(s,NR(),l,p,m,s.layout?s.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=W([]),this.hasOcclusionOpacityProperties=s.paint!==void 0&&("icon-occlusion-opacity"in s.paint||"text-occlusion-opacity"in s.paint)}_handleSpecialPaintPropertyUpdate(s){s!=="icon-occlusion-opacity"&&s!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(s,l){super.recalculate(s,l),this.appearances&&this.appearances.forEac
vendor: 13,786 bytes, line 821
821h(m=>{m.recalculate(s,l,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 p=this.layout.get("text-writing-mode");if(p){const m=[];for(const _ of p)m.indexOf(_)<0&&m.push(_);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(s,l,p,m){return this._saturation===s&&this._contrast===l&&this._brightnessMin===p&&this._brightnessMax===m||(this._colorAdjustmentMatrix=function(_,v,w,A){_=fs(_),v=Ur(v);const k=V(),R=_/3,j=1-2*R,z=[j,R,R,0,R,j,R,0,R,R,j,0,0,0,0,1],U=.5-.5*v,q=A-w;return G(k,[q,0,0,0,0,q,0,0,0,0,q,0,w,w,w,1],[v,0,0,0,0,v,0,0,0,0,v,0,U,U,U,1]),G(k,k,z),k}(s,l,p,m),this._saturation=s,this._contrast=l,this._brightnessMin=p,this._brightnessMax=m),this._colorAdjustmentMatrix}getValueAndResolveTokens(s,l,p,m){const _=this.layout.get(s).evaluate(l,{},p,m),v=this._unevaluatedLayout._values[s];return v.isDataDriven()||Zv(v.value)||!_?_:RV(l.properties,_)}getAppearanceValueAndResolveTokens(s,l,p,m,_){const v=s.getProperty(l);if(!v)return;const w=v.evaluate(p,{},m,_),A=s.getUnevaluatedProperties()._values[l];return A.isDataDriven()||Zv(A.value)||!w||typeof w!="string"?w:RV(p.properties,w)}createBucket(s){return new gA(s)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const s of NR().paint.overridableProperties){if(!yA.hasPaintOverride(this.layout,s))continue;const l=this.paint.get(s),p=new LV(l),m=new Kv(p,l.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let _=null;_=l.value.kind==="constant"||l.value.kind==="source"?new by("source",m):new th("composite",m,l.value.zoomStops,l.value.interpolationType),this.paint._values[s]=new wc(l.property,_,l.parameters)}}_handleOverridablePaintPropertyUpdate(s,l,p){return!(!this.layout||l.isDataDriven()||p.isDataDriven())&&yA.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,l){const p=s.get("text-field"),m=NR().paint.properties[l];let _=!1;const v=w=>{for(const A of w)if(m.overrides&&m.overrides.hasOverride(A))return void(_=!0)};if(p.value.kind==="constant"&&p.value.value instanceof _o)v(p.value.value.sections);else if(p.value.kind==="source"){const w=k=>{_||(k instanceof Zu&&ho(k.value)===rp?v(k.value.sections):k instanceof sp?v(k.sections):k.eachChild(w))},A=p.value;A._styleExpression&&w(A._styleExpression.expression)}return _}getProgramIds(){return["symbol"]}getDefaultProgramParams(s,l,p){return{config:new id(this,{zoom:l,lut:p}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let OV,FV,BV,UV;var MR=wn([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function _A(u,s,l,p,m,_,v,w){const A=[u,s,1,l,p,1,m,_,1],k=[v,w,1],R=N([],A),[j,z,U]=Gi(k,k,R);return D(A,A,[j,0,0,0,z,0,0,0,U])}function VV(u,s,l,p,m,_,v,w){const A=function(k,R,j,z,U,q,X,Q){const ee=_A(0,0,1,0,1,1,0,1),oe=_A(k,R,j,z,U,q,X,Q);return D(oe,oe,N([],ee))}(u,s,l,p,m,_,v,w);return[A[2]/A[8]/Ft,A[5]/A[8]/Ft]}function vA(u){return[u[0],Math.min(Math.max(u[1],-me),me)]}class $V extends Gu{constructor(s,l,p,m){super(),this.id=s,this.dispatcher=p,this.coordinates=l.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(m),this.options=l,this._dirty=!1}load(s,l){if(this._loaded=l||!1,this.fire(new Dl("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return s&&(this.coordinates=s),this._loaded=!0,void this._finishLoading();this._imageRequest=f1(this.map._requestManager.transformRequest(this.url,tp.Image),(p,m)=>{this._imageRequest=null,this._loaded=!0,p?this.fire(new ey(p)):m&&(this.image=m instanceof HTMLImageElement?pl.getImageData(m):m,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,s&&(this.coordinates=s),this._finishLoading())})}loaded(){return this._loaded}updateImage(s){return s.url?(this._imageRequest&&s.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=s.url,this.load(s.coordinates,this._loaded),this):this}setTexture(s){if(!(s.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Vw(this.map.painter.context,s.handle),this.width=s.dimensions[0],this.height=s.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Dl("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(s){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Vw||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(s){if(this.coordinates=s,this._boundsArray=void 0,this._unsupportedCoords=!1,!s.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let l=s[0][1],p=s[0][1];for(const _ of s)_[1]>p&&(p=_[1]),_[1]<l&&(l=_[1]);const m=(p+l)/2;if(m>me?this.onNorthPole=!0:m<-me&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const _=s.map(Ke.fromLngLat);this.tileID=function(v){let w=1/0,A=1/0,k=-1/0,R=-1/0;for(const X of v)w=Math.min(w,X.x),A=Math.min(A,X.y),k=Math.max(k,X.x),R=Math.max(R,X.y);const j=Math.max(k-w,R-A),z=Math.max(0,Math.floor(-Math.log2(j))),U=Math.pow(2,z);let q=Math.floor((w+k)/2*U);return q>1&&(q-=1),new Ul(z,q,Math.floor((A+R)/2*U))}(_),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Dl("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Vw||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(s){for(const ee in this.tiles){const oe=this.tiles[ee];oe.state!=="loaded"&&(oe.state="loaded",oe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const l=Yw(new Ul(0,0,0),this.map.transform.projection),p=[l.projection.project(this.coordinates[0][0],this.coordinates[0][1]),l.projection.project(this.coordinates[1][0],this.coordinates[1][1]),l.projection.project(this.coordinates[2][0],this.coordinates[2][1]),l.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(ee){const oe=ee[1].x-ee[0].x,le=ee[1].y-ee[0].y,de=ee[2].x-ee[1].x,Ae=ee[2].y-ee[1].y,xe=ee[3].x-ee[2].x,Me=ee[3].y-ee[2].y,Le=ee[0].x-ee[3].x,Be=ee[0].y-ee[3].y,ut=oe*Ae-de*le,Xe=de*Me-xe*Ae,ht=xe*Be-Le*Me,_t=Le*le-oe*Be;return ut>0&&Xe>0&&ht>0&&_t>0||ut<0&&Xe<0&&ht<0&&_t<0}(p))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const m=Yw(this.tileID,this.map.transform.projection),[_,v,w,A]=this.coordinates.map(ee=>{const oe=m.projection.project(ee[0],ee[1]);return IV(m,oe)._round()});this.perspectiveTransform=VV(_.x,_.y,v.x,v.y,w.x,w.y,A.x,A.y);const k=this._boundsArray=new qf;k.emplaceBack(_.x,_.y,0,0),k.emplaceBack(v.x,v.y,Ft,0),k.emplaceBack(A.x,A.y,0,Ft),k.emplaceBack(w.x,w.y,Ft,Ft),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=s.createVertexBuffer(k,MR.members),this.boundsSegments=ls.simpleSegment(0,0,4,2);const R=[],j=[vA((z=this.coordinates)[0]),vA(z[1]),vA(z[2]),vA(z[3])];var z;const[U,q,X,Q]=function(ee){let oe=ee[0][0],le=oe,de=ee[0][1],Ae=de;for(let xe=1;xe<ee.length;xe++)ee[xe][0]<oe?oe=ee[xe][0]:ee[xe][0]>le&&(le=ee[xe][0]),ee[xe][1]<de?de=ee[xe][1]:ee[xe][1]>Ae&&(Ae=ee[xe][1]);return[oe,de,le-oe,Ae-de]}(j);{const ee=new qf,[oe,le,de,Ae]=function(vt){let Ct=vt[0].x,at=Ct,st=vt[0].y,St=st;for(let Dt=1;Dt<vt.length;Dt++)vt[Dt].x<Ct?Ct=vt[Dt].x:vt[Dt].x>at&&(at=vt[Dt].x),vt[Dt].y<st?st=vt[Dt].y:vt[Dt].y>St&&(St=vt[Dt].y);return[Ct,st,at-Ct,St-st]}(p),xe=vt=>[(vt.x-oe)/de,(vt.y-le)/Ae],[Me,Le,Be,ut]=p.map(xe),Xe=function(vt,Ct,at,st,St,Dt,xt,ni){const ai=_A(0,0,1,0,1,1,0,1);return D(ai,ai,N([],_A(vt,Ct,at,st,St,Dt,xt,ni)))}(Me[0],Me[1],Le[0],Le[1],Be[0],Be[1],ut[0],ut[1]);this.elevatedGlobePerspectiveTransform=VV(Me[0],Me[1],Le[0],Le[1],Be[0],Be[1],ut[0],ut[1]);const ht=(vt,Ct)=>{R.push(vt.lng);const at=Math.round((vt.lng-U)/X*Ft),st=Math.round((vt.lat-q)/Q*Ft),St=xe(Ct),Dt=Gi([],[St[0],St[1],1],Xe),xt=Math.round(Dt[0]/Dt[2]*Ft),ni=Math.round(Dt[1]/Dt[2]*Ft);ee.emplaceBack(at,st,xt,ni)},_t=p[3].x-p[0].x,bt=p[3].y-p[0].y,zt=p[2].x-p[1].x,Et=p[2].y-p[1].y;for(let vt=0;vt<65;vt++){const Ct=vt/64,at=[p[0].x+Ct*_t,p[0].y+Ct*bt],st=[p[1].x+Ct*zt,p[1].y+Ct*Et],St=st[0]-at[0],Dt=st[1]-at[1];for(let xt=0;xt<65;xt++){const ni=xt/64,ai={x:at[0]+St*ni,y:at[1]+Dt*ni};ht(l.projection.unproject(ai.x,ai.y),ai)}}this.elevatedGlobeVertexBuffer=s.createVertexBuffer(ee,MR.members)}{this.maxLongitudeTriangleSize=0;let ee=[],oe=new Xr;const le=(de,Ae,xe)=>{oe.emplaceBack(de,Ae,xe);const Me=R[de],Le=R[Ae],Be=R[xe],ut=Math.min(Math.min(Me,Le),Be),Xe=Math.max(Math.max(Me,Le),Be)-ut;Xe>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Xe),ee.push(ut+Xe/2)};for(let de=0;de<64;de++)for(let Ae=0;Ae<64;Ae++){const xe=65*de+Ae,Me=xe+1,Le=xe+65,Be=Le+1;le(xe,Le,Me),le(Me,Le,Be)}[ee,oe]=function(de,Ae){const xe=Array.from({length:de.length},(Be,ut)=>ut);xe.sort((Be,ut)=>de[Be]-de[ut]);const Me=[],Le=new Xr;for(let Be=0;Be<xe.length;Be++){const ut=xe[Be];Me.push(de[ut]);const Xe=3*ut,ht=Xe+1;Le.emplaceBack(Ae.uint16[Xe],Ae.uint16[ht],Ae.uint16[ht+1])}return[Me,Le]}(ee,oe),this.elevatedGlobeTrianglesCenterLongitudes=ee,this.elevatedGlobeIndexBuffer=s.createIndexBuffer(oe)}this.elevatedGlobeSegments=ls.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,X/Ft,0,Q/Ft,0,0,q,U,0])}prepare(){const s=Object.keys(this.tiles).length!==0;if(this.tileID&&!s)return;const l=this.map.painter.context,p=l.gl;!this._dirty||this.texture instanceof Vw||(this.texture?this.texture.update(this.image):(this.texture=new rR(l,this.image,p.RGBA8),this.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE)),this._dirty=!1),s&&this._prepareData(l)}loadTile(s,l){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},l(null)):(s.state="errored",l(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(s){const l=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!l)return null;const p=this.elevatedGlobeTrianglesCenterLongitudes;let m=(_=s+180)+360*Math.round((p[0]-_)/360);var _;const v=new ls,w=(j,z)=>{v.segments.push({vertexOffset:0,primitiveOffset:j,vertexLength:l.segments[0].vertexLength,primitiveLength:z,sortKey:void 0,vaos:{}})},A=.51*this.maxLongitudeTriangleSize;if(Math.abs(p[0]-m)<=A){const j=Mn(p,0,p.length,m+A);return j===p.length||w(j,fr(p,j+1,p.length,m+360-A)-j),v}m<p[0]&&(m+=360);const k=fr(p,0,p.length,m-A);if(k===p.length)return w(0,p.length),v;w(0,k-0);const R=Mn(p,k+1,p.length,m+A);return R!==p.length&&w(R,p.length-R),v}}const Ype=(Math.pow(256,2)-1)/16907520;class qV extends _a{constructor(s,l,p,m){super(s,{layout:BV||(BV=new bs({visibility:new Nt(Ze.layout_raster.visibility)})),paint:UV||(UV=new bs({"raster-opacity":new Nt(Ze.paint_raster["raster-opacity"]),"raster-color":new Ff(Ze.paint_raster["raster-color"]),"raster-color-mix":new Nt(Ze.paint_raster["raster-color-mix"]),"raster-color-range":new Nt(Ze.paint_raster["raster-color-range"]),"raster-hue-rotate":new Nt(Ze.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Nt(Ze.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Nt(Ze.paint_raster["raster-brightness-max"]),"raster-saturation":new Nt(Ze.paint_raster["raster-saturation"]),"raster-contrast":new Nt(Ze.paint_raster["raster-contrast"]),"raster-resampling":new Nt(Ze.paint_raster["raster-resampling"]),"raster-fade-duration":new Nt(Ze.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Nt(Ze.paint_raster["raster-emissive-strength"]),"raster-array-band":new Nt(Ze.paint_raster["raster-array-band"]),"raster-elevation":new Nt(Ze.paint_raster["raster-elevation"]),"raster-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},l,p,m),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(s){return!(s&&s._source instanceof $V&&(s._source.onNorthPole||s._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(s){s!=="raster-color"&&s!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
vendor: 18,132 bytes, line 821
821updateColorRamp(s){if(!this.hasColorMap()||!this._curRampRange)return;const l=this._transitionablePaint._values["raster-color"].value.expression,[p,m]=s||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(p)&&isNaN(m)||p===this._curRampRange[0]&&m===this._curRampRange[1]||(this.colorRamp=Aw({expression:l,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:p,end:m}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[p,m])}}let HV,GV,WV,KV,ZV;class XV extends _a{constructor(s,l,p,m){super(s,{layout:HV||(HV=new bs({visibility:new Nt(Ze["layout_raster-particle"].visibility)})),paint:GV||(GV=new bs({"raster-particle-array-band":new Nt(Ze["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Nt(Ze["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Ff(Ze["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Nt(Ze["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Nt(Ze["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Nt(Ze["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Nt(Ze["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Nt(Ze["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},l,p,m),this._updateColorRamp(),this.lastInvalidatedAt=pl.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(s){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(s){return!1}_handleSpecialPaintPropertyUpdate(s){s!=="raster-particle-color"&&s!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),s==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const s=this._transitionablePaint._values["raster-particle-color"].value.expression,l=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Aw({expression:s,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:l}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=pl.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Qpe extends _a{constructor(s,l){super(s,{},l,null),this.implementation=s,s.slot&&(this.slot=s.slot)}is3D(s){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(s){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(s){this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)}onRemove(s){this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)}}function DR(u,s,l){const p=[0,0,1],m=wi([]);return en(m,m,l?-Pn(u)+Math.PI:Pn(u)),pi(m,m,-Pn(s)),Sr(p,p,m),Ei(p,p)}const YV={None:0,Model:1,Symbol:2,FillExtrusion:4};class xA{constructor(s,l,p,m){this.message=(s?`${s}: `:"")+p,m&&(this.identifier=m),l!=null&&l.__line__&&(this.line=l.__line__)}}function RR(u,s){const l=u.indexOf("://")===-1;try{return new URL(u,l&&s?"http://example.com":void 0),!0}catch{return!1}}class QV{constructor(s,l){this.feature=s,this.instancedDataOffset=l,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class JV{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new ux,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(s){const l=16*s,p=this.instancedDataArray.float32;let m=Math.floor(p[l+2]);const _=1.05*(p[l+2]-m);return m/=100,[p[l]%1*1.05,p[l+1]%1*1.05,_,m]}tileCoordinatesForInstance(s){const l=16*s,p=this.instancedDataArray.float32;let m=p[l+0];return m=m>Ft?m-Ft:m,new Tt(Math.trunc(m),Math.trunc(p[l+1]))}translationForInstance(s){const l=16*s,p=this.instancedDataArray.float32;return[p[l+4],p[l+5],p[l+6]]}rotationScaleForInstance(s){const l=16*s,p=this.instancedDataArray.float32;return[p[l+7],p[l+8],p[l+9],p[l+10],p[l+11],p[l+12],p[l+13],p[l+14],p[l+15]]}transformForInstance(s){const l=16*s,p=this.instancedDataArray.float32;return[p[l+7],p[l+8],p[l+9],p[l+4],p[l+10],p[l+11],p[l+12],p[l+5],p[l+13],p[l+14],p[l+15],p[l+6],0,0,0,1]}}class jR{constructor(s){this.zoom=s.zoom,this.canonical=s.canonical,this.overscaledZ=this.canonical.z+Math.log2(s.overscaling),this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.projection=s.projection,this.index=s.index,this.worldview=s.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.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=s.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(s,l){}updateAppearances(s,l,p,m){}populate(s,l,p,m){this.tileToMeter=ke(p);const _=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:v,id:w,index:A,sourceLayerIndex:k}of s){const R=w??(v.properties&&v.properties.hasOwnProperty("id")?v.properties.id:void 0),j=nt(v,_);if(!this.layers[0]._featureFilter.filter(new Rr(this.zoom,{worldview:this.worldview,activeFloors:l.activeFloors}),j,p))continue;const z={id:R,sourceLayerIndex:k,index:A,geometry:_?j.geometry:yt(v,p,m),properties:v.properties,type:v.type,patterns:{}},U=this.addFeature(z,z.geometry,j);U&&l.featureIndex.insert(v,z.geometry,A,k,this.index,this.instancesPerModel[U].instancedDataArray.length,Ft/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const s=this.layers[0].modelManager,l=this.layers[0].scope;let p=0;for(const m of this.modelUris){const _=s.getModel(m,l);if(!_)continue;const v=this.instancesPerModel[m];if(v){const w=.5*Hi(_.aabb.max,_.aabb.min)*v.maxScale+v.maxXYTranslationDistance,A=Math.min(Ft,Math.max(w/this.tileToMeter,Ft/32));p=Math.max(A,p)}}return p}update(s,l,p,m){for(const _ in this.instancesPerModel){const v=this.instancesPerModel[_];for(const w in s)v.idToFeaturesIndex.hasOwnProperty(w)&&(this.evaluate(v.features[v.idToFeaturesIndex[w]],s[w],v,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let s=!1;for(const l in this.instancesPerModel){const p=this.instancesPerModel[l];for(const m of p.features){const _=this.layers[0],v=m.feature,w=this.canonical,A=_.paint.get("model-rotation").evaluate(v,{},w),k=_.paint.get("model-scale").evaluate(v,{},w),R=_.paint.get("model-translation").evaluate(v,{},w);rs(m.rotation,A)&&rs(m.scale,k)&&rs(m.translation,R)||(this.evaluate(m,m.featureStates,p,!0),s=!0)}}return s}updateReplacement(s,l,p,m){if(l.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=l.updateTime;const _=l.getReplacementRegionsForTile(s.toUnwrapped(),!0);if(q2(this.activeReplacements,_))return!1;this.activeReplacements=_;let v=!1;for(const w in this.instancesPerModel){const A=this.instancesPerModel[w],k=A.instancedDataArray;for(const R of A.features){const j=R.instancedDataOffset,z=R.instancedDataCount;for(let U=0;U<z;U++){const q=16*(U+j);let X=k.float32[q+0];const Q=X>Ft;X=Q?X-Ft:X;const ee=Math.floor(X),oe=Math.floor(k.float32[q+1]);let le=!1;for(const de of this.activeReplacements)if(!O5(de,p,YV.Model,m)&&!(de.min.x>ee||ee>de.max.x||de.min.y>oe||oe>de.max.y)&&(le=GD(V5(ee,oe,s.canonical,de.footprintTileId.canonical),de.footprint),le))break;k.float32[q]=le?X+Ft:X,v=v||le!==Q}}}return v}isEmpty(){for(const s in this.instancesPerModel)if(this.instancesPerModel[s].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(s){if(!this.uploaded)for(const l in this.instancesPerModel){const p=this.instancesPerModel[l];p.instancedDataArray.length<0||p.instancedDataArray.length===0||(p.instancedDataBuffer?p.instancedDataBuffer.updateData(p.instancedDataArray):p.instancedDataBuffer=s.createVertexBuffer(p.instancedDataArray,Che.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const l in this.instancesPerModel){const p=this.instancesPerModel[l];p.instancedDataArray.length!==0&&p.instancedDataBuffer&&p.instancedDataBuffer.destroy()}const s=this.layers[0].modelManager;if(s&&this.modelUris&&this.modelsRequested)for(const l of this.modelUris)s.removeModel(l,"",!0)}addFeature(s,l,p){const m=this.layers[0],_=m.layout.get("model-id").evaluate(p,{},this.canonical);if(!_)return di(`modelId is not evaluated for layer ${m.id} and it is not going to get rendered.`),_;(RR(_,!1)||this.styleDefinedModelURLs[_]!==void 0)&&(this.modelUris.includes(_)||this.modelUris.push(_)),this.instancesPerModel[_]||(this.instancesPerModel[_]=new JV);const v=this.instancesPerModel[_],w=v.instancedDataArray,A=new QV(p,w.length);for(const k of l)for(const R of k){if(R.x<0||R.x>=Ft||R.y<0||R.y>=Ft)continue;if(this.lookupDim!==0){const z=(this.lookupDim-1)/Ft,U=this.lookupDim*(R.y*z|0)+R.x*z|0;if(this.lookup){if(this.lookup[U]!==0)continue;this.lookup[U]=1}}this.instanceCount++;const j=w.length;w.resize(j+1),v.instancesEvaluatedElevation.push(0),w.float32[16*j]=R.x,w.float32[16*j+1]=R.y}return A.instancedDataCount=v.instancedDataArray.length-A.instancedDataOffset,A.instancedDataCount>0&&(s.id&&(v.idToFeaturesIndex[s.id]=v.features.length),v.features.push(A),this.evaluate(A,{},v,!1)),_}getModelUris(){return this.modelUris}evaluate(s,l,p,m){const _=this.layers[0],v=s.feature,w=this.canonical,A=s.rotation=_.paint.get("model-rotation").evaluate(v,l,w),k=s.scale=_.paint.get("model-scale").evaluate(v,l,w),R=s.translation=_.paint.get("model-translation").evaluate(v,l,w),j=Object.assign({},_.paint.get("model-color").evaluate(v,l,w));j.a=_.paint.get("model-color-mix-intensity").evaluate(v,l,w);const z=[];this.maxVerticalOffset<R[2]&&(this.maxVerticalOffset=R[2]);const U=R[0]*R[0]+R[1]*R[1],q=U>0?Math.sqrt(U):0;p.maxScale=Math.max(Math.max(p.maxScale,k[0]),Math.max(k[1],k[2])),p.maxXYTranslationDistance=Math.max(p.maxXYTranslationDistance,q),this.maxScale=Math.max(Math.max(this.maxScale,k[0]),Math.max(k[1],k[2])),IU(z,A,k);const X=Math.round(100*j.a)+j.b/1.05;for(let Q=0;Q<s.instancedDataCount;++Q){const ee=s.instancedDataOffset+Q,oe=16*ee,le=p.instancedDataArray.float32;let de=0;m&&(de=le[oe+6]-p.instancesEvaluatedElevation[ee]);const Ae=0|le[oe+1];le[oe]=(0|le[oe])+j.r/1.05,le[oe+1]=Ae+j.g/1.05,le[oe+2]=X,le[oe+3]=1/(w.z>10?this.tileToMeter:ke(w,Ae)),le[oe+4]=R[0],le[oe+5]=R[1],le[oe+6]=R[2]+de,le[oe+7]=z[0],le[oe+8]=z[1],le[oe+9]=z[2],le[oe+10]=z[4],le[oe+11]=z[5],le[oe+12]=z[6],le[oe+13]=z[8],le[oe+14]=z[9],le[oe+15]=z[10],p.instancesEvaluatedElevation[ee]=R[2]}}}let e6,t6;ri(jR,"ModelBucket",{omit:["layers"]}),ri(JV,"PerModelAttributes"),ri(QV,"ModelFeature");class Rx{constructor(s,l,p){this._demTile=s,this._dem=this._demTile.dem,this._scale=l,this._offset=p}static create(s,l,p){const m=p||s.findDEMTileFor(l);if(!m||!m.dem)return;const _=m.dem,v=m.tileID,w=1<<l.canonical.z-v.canonical.z;return new Rx(m,_.dim/Ft/w,[(l.canonical.x/w-v.canonical.x)*_.dim,(l.canonical.y/w-v.canonical.y)*_.dim])}tileCoordToPixel(s,l){const p=l*this._scale+this._offset[1];return new Tt(Math.floor(s*this._scale+this._offset[0]),Math.floor(p))}getElevationAt(s,l,p,m){const _=s*this._scale+this._offset[0],v=l*this._scale+this._offset[1],w=Math.floor(_),A=Math.floor(v),k=this._dem;return m=!!m,p?Vi(Vi(k.get(w,A,m),k.get(w,A+1,m),v-A),Vi(k.get(w+1,A,m),k.get(w+1,A+1,m),v-A),_-w):k.get(w,A,m)}getElevationAtPixel(s,l,p){return this._dem.get(s,l,!!p)}getMeterToDEM(s){return(1<<this._demTile.tileID.canonical.z)*ae(1,s)*this._dem.stride}}const zR=new Float32Array(262144),Fy=new Uint8Array(262144);function i6(u){let s=0;if(u.meshes)for(const l of u.meshes)s=Math.max(s,l.aabb.max[2]);if(u.children)for(const l of u.children)s=Math.max(s,i6(l));return s}function n6(u,s,l){if(u.meshes)for(const p of u.meshes){if(p.aabb.min[0]===1/0)continue;const m=gn.applyTransform(p.aabb,u.globalMatrix);l.insert(s,m.min[0],m.min[1],m.max[0],m.max[1])}if(u.children)for(const p of u.children)n6(p,s,l)}const r6=["","wall","door","roof","window","lamp","logo"];class s6{constructor(s){this.node=s,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:s.id,geometry:[],properties:{height:i6(s)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new gn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let s=0;const l=new gn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const p of this.node.meshes)this.node.lightMeshIndex!==s&&(p.transformedAabb=gn.applyTransformFast(p.aabb,this.node.globalMatrix),l.encapsulate(p.transformedAabb)),s++;this.aabb=l}return this.aabb}}class bA{constructor(s,l,p,m,_,v,w,A){this.id=p,this.layers=s,this.layerIds=this.layers.map(k=>k.fqid),this.stateDependentLayerIds=this.layers.filter(k=>k.isStateDependent()).map(k=>k.id),this.modelTraits|=Cx.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,m&&(this.modelTraits|=Cx.HasMapboxMeshFeatures),_&&(this.modelTraits|=Cx.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=v,this.worldview=A,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const k of l)this.nodesInfo.push(new s6(k)),n6(k,w.featureIndexArray.length,w.grid),w.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,w.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(s,l){for(const p of this.getNodesInfo()){const m=p.node;m.footprint&&l.push({footprint:m.footprint,id:s})}}updateAppearances(s,l,p,m){}update(s){const l=Object.keys(s).length!==0;if(l&&!this.stateDependentLayers.length)return;const p=l?this.stateDependentLayers:this.layers;if(!Nl(s,this.states))for(const m of p)this.evaluate(m,s);this.states=structuredClone(s)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(s){if(!this.needsUpload)return;const l=this.getNodesInfo();for(const p of l){const m=p.node;this.uploaded?this.updatePbrBuffer(m):aR(m,s,!0)}for(const p of l)iA(p.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(s){let l=!1;if(!s.meshes)return l;for(const p of s.meshes)p.pbrBuffer&&(p.pbrBuffer.updateData(p.featureArray),l=!0);return l}needsReEvaluation(s,l,p){const m=s.transform.projectionOptions,_=s.style.getBrightness(),v=this.brightness!==_;if(!this.uploaded||this.dirty||m.name!==this.projection.name||sS(p.paint.get("model-color").value,v)||sS(p.paint.get("model-color-mix-intensity").value,v)||sS(p.paint.get("model-roughness").value,v)||sS(p.paint.get("model-emissive-strength").value,v)||sS(p.paint.get("model-height-based-emissive-strength-multiplier").value,v)){this.projection=m,this.brightness=_;const w=this.getNodesInfo();for(const A of w)A.state=null;return!0}return!1}evaluateTransform(s,l){if(s.transform.zoom===this.zoom)return;this.zoom=s.transform.zoom;const p=this.getNodesInfo(),m=this.id.canonical;for(const _ of p){const v=_.feature;_.evaluatedTranslation=l.paint.get("model-translation").evaluate(v,{},m),_.evaluatedScale=l.paint.get("model-scale").evaluate(v,{},m)}}evaluate(s,l){const p=this.getNodesInfo();for(const m of p){if(!m.node.meshes)continue;const _=m.feature,v=l&&l[_.id];if(Nl(v,m.state))continue;m.state=structuredClone(v);const w=m.node.meshes&&m.node.meshes[0].featureData,A=m.evaluatedColor[2],k=m.evaluatedRMEA[2],R=this.id.canonical;if(m.hasTranslucentParts=!1,w){for(let j=0;j<r6.length;j++){const z=r6[j];z.length&&(_.properties.part=z);const U=s.paint.get("model-color").evaluate(_,v,R).toPremultipliedRenderColor(null),q=s.paint.get("model-color-mix-intensity").evaluate(_,v,R);m.evaluatedColor[j]=[U.r,U.g,U.b,q],m.evaluatedRMEA[j][0]=s.paint.get("model-roughness").evaluate(_,v,R),m.evaluatedRMEA[j][2]=s.paint.get("model-emissive-strength").evaluate(_,v,R),m.evaluatedRMEA[j][3]=U.a,m.emissionHeightBasedParams[j]=s.paint.get("model-height-based-emissive-strength-multiplier").evaluate(_,v,R),!m.hasTranslucentParts&&U.a<1&&(m.hasTranslucentParts=!0)}delete _.properties.part,efe(m,A!==m.evaluatedColor[2]||k!==m.evaluatedRMEA[2],this.modelTraits)}else m.evaluatedRMEA[0][2]=s.paint.get("model-emissive-strength").evaluate(_,v,R);m.evaluatedTranslation=s.paint.get("model-translation").evaluate(_,v,R),m.evaluatedScale=s.paint.get("model-scale").evaluate(_,v,R),this.updatePbrBuffer(m.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(s,l,p,m){const _=s.findDEMTileFor(p);if(_&&(_.tileID.canonical!==this.terrainTile||l!==this.terrainExaggeration)){if
821(_.dem&&_.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=_.tileID.overscaledZ;const v=Rx.create(s,p,_);if(!v)return;this.modelTraits&Cx.HasMapboxMeshFeatures&&this.updateDEM(s,v,p,m);for(const w of this.getNodesInfo()){const A=w.node;if(!A.footprint||!A.footprint.vertices||!A.footprint.vertices.length)continue;const k=A.footprint.vertices;let R=v.getElevationAt(k[0].x,k[0].y,!0,!0);for(let j=1;j<k.length;j++)R=Math.min(R,v.getElevationAt(k[j].x,k[j].y,!0,!0));A.elevation=R}}this.terrainTile=_.tileID.canonical,this.terrainExaggeration=l}}updateDEM(s,l,p,m){let _=l._dem._modifiedForSources[m];if(_===void 0&&(l._dem._modifiedForSources[m]=[],_=l._dem._modifiedForSources[m]),_.includes(p.canonical))return;const v=l._dem.dim;_.push(p.canonical);let w=!1;for(const A of this.getNodesInfo()){const k=A.node;if(!k.footprint||!k.footprint.grid)continue;const R=k.footprint.grid,j=l.tileCoordToPixel(R.min.x,R.min.y),z=l.tileCoordToPixel(R.max.x,R.max.y),U=Math.min(Math.min(v-z.y,j.x),Math.min(j.y,v-z.x));if(U<0)continue;const q=re(U,2,5);let X=Math.max(0,j.x-q),Q=Math.max(0,j.y-q),ee=Math.min(z.x+q,v-1),oe=Math.min(z.y+q,v-1);for(let xe=Q;xe<=oe;++xe)for(let Me=X;Me<=ee;++Me)Fy[xe*v+Me]=255;let le=0,de=0;for(let xe=0;xe<R.cellsY;++xe)for(let Me=0;Me<R.cellsX;++Me){if(!R.cells[xe*R.cellsX+Me])continue;const Le=l.tileCoordToPixel(R.min.x+Me/R.xScale,R.min.y+xe/R.yScale),Be=l.tileCoordToPixel(R.min.x+(Me+1)/R.xScale,R.min.y+(xe+1)/R.yScale);for(let ut=Le.y;ut<=Math.min(Be.y+1,v-1);++ut)for(let Xe=Le.x;Xe<=Math.min(Be.x+1,v-1);++Xe)Fy[ut*v+Xe]===255&&(Fy[ut*v+Xe]=0,le+=l.getElevationAtPixel(Xe,ut),de++)}const Ae=le/de;X=Math.max(1,j.x-q),Q=Math.max(1,j.y-q),ee=Math.min(z.x+q,v-2),oe=Math.min(z.y+q,v-2),w=!0;for(let xe=Q;xe<=oe;++xe)for(let Me=X;Me<=ee;++Me)Fy[xe*v+Me]===0&&(zR[xe*v+Me]=l._dem.set(Me,xe,Ae));for(let xe=1;xe<q;++xe){X=Math.max(1,j.x-xe),Q=Math.max(1,j.y-xe),ee=Math.min(z.x+xe,v-2),oe=Math.min(z.y+xe,v-2);for(let Me=Q;Me<=oe;++Me)for(let Le=X;Le<=ee;++Le){const Be=Me*v+Le;if(Fy[Be]===255){let ut=0,Xe=0,ht=-1,_t=-1;for(let bt=-1;bt<=1;++bt)for(let zt=-1;zt<=1;++zt){const Et=(Me+bt)*v+Le+zt;if(Fy[Et]>=xe)continue;const vt=zR[Et],Ct=Math.abs(vt);Ct>Xe&&(ut=vt,Xe=Ct,ht=zt,_t=bt)}if(Xe>.1){const bt=1-(xe+.5*Math.abs(ht*_t))/q;let zt=l._dem.get(Le,Me)+ut*bt;const Et=l._dem.get(Le+ht,Me+_t),vt=l._dem.get(Le-ht,Me-_t,!0);(zt-Et)*(zt-vt)>0&&(zt=(Et+vt)/2),zR[Be]=l._dem.set(Le,Me,zt),Fy[Be]=xe}}}}}w&&(l._demTile.needsDEMTextureUpload=!0,l._dem._timestamp=pl.now())}setFilter(s){this.filter=s?tx(s):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(s=>this.filter.filter(new Rr(this.id.overscaledZ,{worldview:this.worldview}),s.feature,this.id.canonical)):this.nodesInfo}destroy(){const s=this.getNodesInfo();for(const l of s)iA(l.node),lR(l.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(s,l){if(l.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=l.updateTime;const p=l.getReplacementRegionsForTile(s.toUnwrapped());for(const m of this.getNodesInfo()){const _=m.node.footprint;m.hiddenByReplacement=!!_&&!p.find(v=>v.footprint===_)}}getHeightAtTileCoord(s,l){const p=[],m=[0,0,0],_=W([]);for(const v of this.getNodesInfo()){const w=v.node.meshes[0],A=w.transformedAabb;if(s<A.min[0]||l<A.min[1]||s>A.max[0]||l>A.max[1])continue;if(v.node.hidden===!0)return{height:1/0,maxHeight:v.feature.properties.height,hidden:!1,verticalScale:v.evaluatedScale[2]};$(_,v.node.globalMatrix),m[0]=s,m[1]=l,zi(m,m,_);const k=(m[0]-w.aabb.min[0])/(w.aabb.max[0]-w.aabb.min[0])*zy|0,R=Math.min(63,(m[1]-w.aabb.min[1])/(w.aabb.max[1]-w.aabb.min[1])*zy|0)*zy+Math.min(63,k),j=w.heightmap[R];if(!(j<0&&v.node.footprint))return v.hiddenByReplacement?void 0:{height:j,maxHeight:v.feature.properties.height,hidden:!1,verticalScale:v.evaluatedScale[2]};if(v.node.footprint.grid.query(new Tt(s,l),new Tt(s,l),p),p.length>0)return{height:void 0,maxHeight:v.feature.properties.height,hidden:v.hiddenByReplacement,verticalScale:v.evaluatedScale[2]}}}}function sS(u,s){return u instanceof by&&!u.isLightConstant&&s}function Jpe(u,s,l,p,m,_,v,w){let A=(61440&s|(61440&s)>>4)>>8,k=(3840&s|(3840&s)>>4)>>4,R=240&s|(240&s)>>4;l[3]>0&&(A=Vi(A,255*l[0],l[3]),k=Vi(k,255*l[1],l[3]),R=Vi(R,255*l[2],l[3]));const j=A<<8|k,z=R<<8|Math.floor(255*p[3]),U=function(xe){const Me=re(xe,0,2);return Math.min(Math.round(.5*Me*255),255)}(p[2])<<8|15*p[0]<<4|15*p[1],q=re(m[0],0,1),X=re(m[1],0,1),Q=re(m[2],0,1),ee=re(m[3],0,1);let oe,le,de,Ae;if(q!==X&&v!==_&&X!==q){const xe=v-_;le=1/(xe*(X-q)),de=-(_+xe*q)/(xe*(X-q));const Me=re(m[4],-1,1);Ae=Math.pow(10,Me),oe=255*Q<<8|255*ee}else oe=65535,le=0,de=1,Ae=1;if(u.emplaceBack(j,z,U,oe,le,de,Ae),w){const xe=w.length;w.clear();for(let Me=0;Me<xe;Me++)w.emplaceBack(j,z,U,oe,le,de,Ae)}}function efe(u,s,l){const p=u.node;let m=0;const _=l&Cx.HasMeshoptCompression;for(const v of p.meshes){if(p.lights&&p.lightMeshIndex===m||!v.featureData)continue;v.featureArray=new Zf,v.featureArray.reserve(v.featureData.length);let w=s;for(const A of v.featureData){const k=_?65535&A:A>>16&65535,R=_?A>>16&65535:65535&A,j=(15&R)<8?15&R:0,z=u.evaluatedRMEA[j],U=u.evaluatedColor[j],q=u.emissionHeightBasedParams[j];let X;if(w&&j===2&&p.lights&&(X=new Zf,X.resize(10*p.lights.length)),Jpe(v.featureArray,k,U,z,q,v.aabb.min[2],v.aabb.max[2],X),X&&w){w=!1;const Q=p.meshes[p.lightMeshIndex];Q.featureArray=X,Q.featureArray._trim()}}v.featureArray._trim(),m++}}ri(bA,"Tiled3dModelBucket",{omit:["layers"]}),ri(s6,"Tiled3dModelFeature");const tfe=["id","tile","layer","source","sourceLayer","state"];class By{constructor(s,l,p,m,_){this.type="Feature",this._vectorTileFeature=s,this._z=l,this._x=p,this._y=m,this.properties=s?s.properties:{},this.id=_}clone(){const s=new By(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(s.state=Object.assign({},this.state)),this.layer&&(s.layer=Object.assign({},this.layer)),this.source&&(s.source=this.source),this.sourceLayer&&(s.sourceLayer=this.sourceLayer),s}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(s){this._geometry=s}toJSON(){const s={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const l of tfe)this[l]!==void 0&&(s[l]=this[l]);return s}}class Uy extends Gu{constructor(s,l,p,m){super(),this.id=s,this.type="model",this.models=[],this._loaded=!1,this._options=l,this._modelsInfo=new Map}load(){const s=[];for(const l in this._options.models){const p=this._options.models[l],m=this._modelsInfo.get(l);if(m){const _=m.model;_.position=p.position!=null?new H(p.position[0],p.position[1]):new H(0,0),_.orientation=p.orientation!=null?p.orientation:[0,0,0],m.modelSpec=p,Uy.applyModelSpecification(_,p),_.computeBoundsAndApplyParent(),this.models.push(_)}else{const _=TU(this.map._requestManager.transformRequest(p.uri,tp.Model).url).then(v=>{if(!v)return;const w=uR(v),A=new kU(l,p.uri,p.position,p.orientation,w);Uy.applyModelSpecification(A,p),A.computeBoundsAndApplyParent(),this.models.push(A),this._modelsInfo.set(l,{modelSpec:p,model:A})}).catch(v=>{this.fire(new ey(new Error(`Could not load model ${l} from ${p.uri}: ${v.message}`)))});s.push(_)}}Promise.allSettled(s).then(()=>{this._loaded=!0,this.fire(new Dl("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(l=>{this._loaded=!0,this.fire(new ey(new Error(`Could not load models: ${l.message}`)))})}
821static applyModelSpecification(s,l){l.nodeOverrides&&Uy.convertNodeOverrides(s,l.nodeOverrides),l.materialOverrides&&Uy.convertMaterialOverrides(s,l.materialOverrides),l.nodeOverrideNames&&(s.nodeOverrideNames=[...l.nodeOverrideNames]),l.materialOverrideNames&&(s.materialOverrideNames=[...l.materialOverrideNames]),l.featureProperties&&(s.featureProperties=l.featureProperties)}static convertNodeOverrides(s,l){if(Array.isArray(l)&&l.every(p=>typeof p=="string")){s.nodeOverrideNames=[];for(const p of l)s.nodeOverrideNames.push(p)}else Object.entries(l).forEach(([p,m])=>{const _={orientation:[0,0,0]};if(m.hasOwnProperty("orientation")){const v=m.orientation;v&&(_.orientation=v)}s.nodeOverrides.set(p,_)})}static convertMaterialOverrides(s,l){if(Array.isArray(l)&&l.every(p=>typeof p=="string")){s.materialOverrideNames=[];for(const p of l)s.materialOverrideNames.push(p)}else Object.entries(l).forEach(([p,m])=>{const _={color:new lr(1,1,1),colorMix:0,emissionStrength:0,opacity:1},v=m["model-color"];v!==void 0&&(_.color.r=v[0],_.color.g=v[1],_.color.b=v[2]);const w=m["model-color-mix-intensity"];w!==void 0&&(_.colorMix=w);const A=m["model-emissive-strength"];A!==void 0&&(_.emissionStrength=A);const k=m["model-opacity"];k!==void 0&&(_.opacity=k),s.materialOverrides.set(p,_)})}onAdd(s){this.map=s,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(s,l){}serialize(){return this._options}setProperty(s,l){return!1}reload(){const s=fp(this.id,this.scope);this.map.style.clearSource(s),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(s){this.models=[];const l=new Map;for(const p in s){const m=s[p];if(this._modelsInfo.has(p)){const _=this._modelsInfo.get(p);_&&_.modelSpec.uri===m.uri&&l.set(p,_)}}this._modelsInfo=l,this._options.models=s,this._loaded=!1,this.load()}}function LR(u,s,l,p){const m=1<<u.z;s.lat=ue((p/Ft+u.y)/m),s.lng=fe((l/Ft+u.x)/m)}function ife(u,s,l,p){const m=u.getNodesInfo()[s];if(!m||m.hiddenByReplacement||!m.node.meshes)return;let _=Number.MAX_VALUE;const v=m.node,w=l.tile,A=p.calculatePosMatrix(w.tileID.toUnwrapped(),p.worldSize),k=m.evaluatedScale;let R=0;
vendor: 20,796 bytes, line 821
821p.elevation&&v.elevation&&(R=v.elevation*p.elevation.exaggeration()),te(A,A,[(v.anchor?v.anchor[0]:0)*(k[0]-1),(v.anchor?v.anchor[1]:0)*(k[1]-1),R]),ce(A,A,k);const j=l.queryGeometry,z=j.isPointQuery()?j.screenBounds:j.screenGeometry,U=function(X){const Q=G([],A,X.globalMatrix);G(Q,p.expandedFarZProjMatrix,Q);for(let ee=0;ee<X.meshes.length;++ee){const oe=X.meshes[ee];if(ee===X.lightMeshIndex)continue;const le=oR(z,p,Q,oe.aabb);le!=null&&(_=Math.min(le,_))}if(X.children)for(const ee of X.children)U(ee)};if(U(v),_===Number.MAX_VALUE)return;const q=new H(0,0);return LR(w.tileID.canonical,q,m.node.anchor[0],m.node.anchor[1]),{intersectionZ:_,position:q,feature:m.feature}}const nfe={circle:class extends _a{constructor(u,s,l,p){super(u,{layout:nd||(nd=new bs({"circle-sort-key":new Zt(Ze.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Nt(Ze.layout_circle["circle-elevation-reference"]),visibility:new Nt(Ze.layout_circle.visibility)})),paint:Qf||(Qf=new bs({"circle-radius":new Zt(Ze.paint_circle["circle-radius"]),"circle-color":new Zt(Ze.paint_circle["circle-color"]),"circle-blur":new Zt(Ze.paint_circle["circle-blur"]),"circle-opacity":new Zt(Ze.paint_circle["circle-opacity"]),"circle-translate":new Nt(Ze.paint_circle["circle-translate"]),"circle-translate-anchor":new Nt(Ze.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Nt(Ze.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Nt(Ze.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Zt(Ze.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Zt(Ze.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Zt(Ze.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Nt(Ze.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p)}createBucket(u){return new ts(u)}queryRadius(u){const s=u;return xo("circle-radius",this,s)+xo("circle-stroke-width",this,s)+gs(this.paint.get("circle-translate"))}queryIntersectsFeature(u,s,l,p,m,_,v,w){const A=Yf(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),_.angle,u.pixelToTileUnitsFactor),k=this.paint.get("circle-radius").evaluate(s,l)+this.paint.get("circle-stroke-width").evaluate(s,l);return d5(u,p,_,v,w,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",A,k)}getProgramIds(){return["circle"]}getDefaultProgramParams(u,s,l){const p=u5(this);return{config:new id(this,{zoom:s,lut:l}),defines:p,overrideFog:!1}}is3D(u){return!u&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends _a{createBucket(u){return new p5(u)}constructor(u,s,l,p){super(u,{layout:f5||(f5=new bs({visibility:new Nt(Ze.layout_heatmap.visibility)})),paint:m5||(m5=new bs({"heatmap-radius":new Zt(Ze.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Zt(Ze.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Nt(Ze.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ff(Ze.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Nt(Ze.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(u){u==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Aw({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(u){return xo("heatmap-radius",this,u)}queryIntersectsFeature(u,s,l,p,m,_,v,w){const A=this.paint.get("heatmap-radius").evaluate(s,l);return d5(u,p,_,v,w,!0,!0,new Tt(0,0),A)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(u,s,l){return u==="heatmap"?{config:new id(this,{zoom:s,lut:l}),overrideFog:!1}:{}}},hillshade:class extends _a{constructor(u,s,l,p){super(u,{layout:g5||(g5=new bs({visibility:new Nt(Ze.layout_hillshade.visibility)})),paint:y5||(y5=new bs({"hillshade-illumination-direction":new Nt(Ze.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Nt(Ze.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Nt(Ze.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Nt(Ze.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Nt(Ze.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Nt(Ze.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Nt(Ze.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p)}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(u,s,l){return{overrideFog:!1}}},fill:class extends _a{constructor(u,s,l,p){super(u,{layout:M5||(M5=new bs({"fill-sort-key":new Zt(Ze.layout_fill["fill-sort-key"]),visibility:new Nt(Ze.layout_fill.visibility),"fill-elevation-reference":new Nt(Ze.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Zt(Ze.layout_fill["fill-construct-bridge-guard-rail"])})),paint:D5||(D5=new bs({"fill-antialias":new Nt(Ze.paint_fill["fill-antialias"]),"fill-opacity":new Zt(Ze.paint_fill["fill-opacity"]),"fill-color":new Zt(Ze.paint_fill["fill-color"]),"fill-outline-color":new Zt(Ze.paint_fill["fill-outline-color"]),"fill-translate":new Nt(Ze.paint_fill["fill-translate"]),"fill-translate-anchor":new Nt(Ze.paint_fill["fill-translate-anchor"]),"fill-pattern":new Zt(Ze.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Nt(Ze.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Nt(Ze.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Zt(Ze.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Zt(Ze.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Zt(Ze.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p)}getProgramIds(){const u=this.paint.get("fill-pattern"),s=u&&u.constantOr(1),l=[s?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&l.push(s&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),l}getDefaultProgramParams(u,s,l){return{config:new id(this,{zoom:s,lut:l}),overrideFog:!1}}recalculate(u,s){super.recalculate(u,s);const l=this.paint._values["fill-outline-color"];l.value.kind==="constant"&&l.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(u){return new $D(u)}queryRadius(){return gs(this.paint.get("fill-translate"))}queryIntersectsFeature(u,s,l,p,m,_){return!u.queryGeometry.isAboveHorizon&&ws(Bl(u.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),_.angle,u.pixelToTileUnitsFactor),p)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(u){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const s=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return u!=null?s&&!u:s}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 _a{constructor(u,s,l,p){super(u,{layout:rU||(rU=new bs({visibility:new Nt(Ze["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Nt(Ze["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:sU||(sU=new bs({"fill-extrusion-opacity":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Zt(Ze["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Nt(Ze["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(u){return new G2(u)}queryRadius(){return gs(this.paint.get("fill-extrusion-translate"))}is3D(u){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(u,s,l,p,m,_,v,w,A){const k=Yf(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),_.angle,u.pixelToTileUnitsFactor),R=this.paint.get("fill-extrusion-height").evaluate(s,l),j=this.paint.get("fill-extrusion-base").evaluate(s,l),z=[0,0],U=w&&_.elevation,q=_.elevation?_.elevation.exaggeration():1,X=u.tile.getBucket(this);if(U&&X instanceof G2){const de=X.centroidVertexArray,Ae=A+1;Ae<de.length&&(z[0]=de.geta_centroid_pos0(Ae),z[1]=de.geta_centroid_pos1(Ae))}if(z[0]===0&&z[1]===1)return!1;_.projection.name==="globe"&&(p=nU([p],[new Tt(0,0),new Tt(Ft,Ft)],u.tileID.canonical).map(de=>de.polygon).flat());const Q=U?w:null,[ee,oe]=hU(_,p,j,R,k,v,Q,z,q,_.center.lat,u.tileID.canonical),le=u.queryGeometry;return dU(ee,oe,le.isPointQuery()?le.screenBounds:le.screenGeometry)}},building:class extends _a{constructor(u,s,l,p){super(u,{layout:LU||(LU=new bs({visibility:new Nt(Ze.layout_building.visibility),"building-facade":new Zt(Ze.layout_building["building-facade"]),"building-facade-floors":new Zt(Ze.layout_building["building-facade-floors"]),"building-facade-unit-width":new Zt(Ze.layout_building["building-facade-unit-width"]),"building-facade-window":new Zt(Ze.layout_building["building-facade-window"]),"building-roof-shape":new Zt(Ze.layout_building["building-roof-shape"]),"building-height":new Zt(Ze.layout_building["building-height"]),"building-base":new Zt(Ze.layout_building["building-base"]),"building-flood-light-wall-radius":new Zt(Ze.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Zt(Ze.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Zt(Ze.layout_building["building-flip-roof-orientation"])})),paint:OU||(OU=new bs({"building-opacity":new Nt(Ze.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Nt(Ze.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Nt(Ze.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Nt(Ze.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Nt(Ze.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Nt(Ze.paint_building["building-vertical-scale"]),"building-cast-shadows":new Nt(Ze.paint_building["building-cast-shadows"]),"building-color":new Zt(Ze.paint_building["building-color"]),"building-emissive-strength":new Zt(Ze.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Nt(Ze.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Nt(Ze.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Nt(Ze.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Nt(Ze.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Nt(Ze.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(u){return new zU(u)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(u){return!0}queryRadius(u){return 0}queryIntersectsFeature(u,s,l,p,m,_,v,w,A){let k=this.layout.get("building-height").evaluate(s,l);const R=this.layout.get("building-base").evaluate(s,l),j=u.tile.getBucket(this).getFootprint(s);if(j){if(j.hiddenFlags!==0)return!1;k=j.height}const[z,U]=hU(_,p,R,k,new Tt(0,0),v,null,[0,0],1,_.center.lat,u.tileID.canonical),q=u.queryGeometry;return dU(z,U,q.isPointQuery()?q.screenBounds:q.screenGeometry)}},line:class extends _a{constructor(u,s,l,p){const m=KU();super(u,m,s,l,p),m.layout&&(this.layout=new pp(m.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(u){if(u==="line-gradient"){const s=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=s._styleExpression&&s._styleExpression.expression instanceof my,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}recalculate(u,s){super.recalculate(u,s),this.paint._values["line-floorwidth"]=(()=>{if(qw)return qw;const l=KU();return qw=new Jhe(l.paint.properties["line-width"].specification),qw.useIntegerZoom=!0,qw})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,u)}createBucket(u){return new hR(u)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(u,s,l){const p=GU(this);return{config:new id(this,{zoom:s,lut:l}),defines:p,overrideFog:!1}}queryRadius(u){const s=u,l=ZU(xo("line-width",this,s),xo("line-gap-width",this,s)),p=xo("line-offset",this,s);return l/2+Math.abs(p)+gs(this.paint.get("line-translate"))}queryIntersectsFeature(u,s,l,p,m,_){if(u.queryGeometry.isAboveHorizon)return!1;const v=Bl(u.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),_.angle,u.pixelToTileUnitsFactor),w=u.pixelToTileUnitsFactor/2*ZU(this.paint.get("line-width").evaluate(s,l),this.paint.get("line-gap-width").evaluate(s,l)),A=this.paint.get("line-offset").evaluate(s,l);return A&&(p=function(k,R){const j=[],z=new Tt(0,0);for(let U=0;U<k.length;U++){const q=k[U],X=[];for(let Q=0;Q<q.length;Q++){const ee=q[Q],oe=q[Q+1],le=Q===0?z:ee.sub(q[Q-1])._unit()._perp(),de=Q===q.length-1?z:oe.sub(ee)._unit()._perp(),Ae=le._add(de)._unit();Ae._mult(1/(Ae.x*de.x+Ae.y*de.y)),X.push(Ae._mult(R)._add(ee))}j.push(X)}return j}(p,A*u.pixelToTileUnitsFactor)),function(k,R,j){for(let z=0;z<R.length;z++){const U=R[z];if(k.length>=3){for(let q=0;q<U.length;q++)if(vo(k,U[q]))return!0}if(el(k,U,j))return!0}return!1}(v,p,w)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(u){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:yA,background:class extends _a{constructor(u,s,l,p){super(u,{layout:OV||(OV=new bs({visibility:new Nt(Ze.layout_background.visibility)})),paint:FV||(FV=new bs({"background-pitch-alignment":new Nt(Ze.paint_background["background-pitch-alignment"]),"background-color":new Nt(Ze.paint_background["background-color"]),"background-pattern":new Nt(Ze.paint_background["background-pattern"]),"background-opacity":new Nt(Ze.paint_background["background-opacity"]),"background-emissive-strength":new Nt(Ze.paint_background["background-emissive-strength"]),"background-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(u,s,l){return{overrideFog:!1}}is3D(u){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:qV,"raster-particle":XV,sky:class extends _a{constructor(u,s,l,p){super(u,{layout:WV||(WV=new bs({visibility:new Nt(Ze.layout_sky.visibility)})),paint:KV||(KV=new bs({"sky-type":new Nt(Ze.paint_sky["sky-type"]),"sky-atmosphere-sun":new Nt(Ze.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Nt(Ze.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Nt(Ze.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Nt(Ze.paint_sky["sky-gradient-radius"]),"sky-gradient":new Ff(Ze.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Nt(Ze.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Nt(Ze.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Nt(Ze.paint_sky["sky-opacity"]),"sky-gradient-use
821-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(u){u==="sky-gradient"?this._updateColorRamp():u!=="sky-atmosphere-sun"&&u!=="sky-atmosphere-halo-color"&&u!=="sky-atmosphere-color"&&u!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Aw({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(u){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const s=u.style.light.properties.get("position");return this._lightPosition.azimuthal!==s.azimuthal||this._lightPosition.polar!==s.polar}return!1}getCenter(u,s){if(this.paint.get("sky-type")==="atmosphere"){const p=this.paint.get("sky-atmosphere-sun"),m=!p,_=u.style.light,v=_.properties.get("position");return m&&_.properties.get("anchor")==="viewport"&&di("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),m?DR(v.azimuthal,90-v.polar,s):DR(p[0],90-p[1],s)}const l=this.paint.get("sky-gradient-center");return DR(l[0],90-l[1],s)}isSky(){return!0}markSkyboxValid(u){this._skyboxInvalidated=!1,this._lightPosition=u.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const u=this.paint.get("sky-type");return u==="atmosphere"?["skyboxCapture","skybox"]:u==="gradient"?["skyboxGradient"]:null}},slot:class extends _a{constructor(u,s,l,p){super(u,{paint:ZV||(ZV=new bs({}))},s,null)}},model:class extends _a{constructor(u,s,l,p){super(u,{layout:e6||(e6=new bs({visibility:new Nt(Ze.layout_model.visibility),"model-id":new Zt(Ze.layout_model["model-id"])})),paint:t6||(t6=new bs({"model-opacity":new Zt(Ze.paint_model["model-opacity"]),"model-rotation":new Zt(Ze.paint_model["model-rotation"]),"model-scale":new Zt(Ze.paint_model["model-scale"]),"model-translation":new Zt(Ze.paint_model["model-translation"]),"model-color":new Zt(Ze.paint_model["model-color"]),"model-color-mix-intensity":new Zt(Ze.paint_model["model-color-mix-intensity"]),"model-type":new Nt(Ze.paint_model["model-type"]),"model-cast-shadows":new Nt(Ze.paint_model["model-cast-shadows"]),"model-receive-shadows":new Nt(Ze.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Nt(Ze.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Zt(Ze.paint_model["model-emissive-strength"]),"model-roughness":new Zt(Ze.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Zt(Ze.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Nt(Ze.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Nt(Ze.paint_model["model-front-cutoff"]),"model-elevation-reference":new Nt(Ze.paint_model["model-elevation-reference"]),"model-color-use-theme":new Zt({type:"string",default:"default","property-type":"data-driven"})}))},s,l,p),this.layer=u,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(u){return new jR(u)}getProgramIds(){return["model"]}is3D(u){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(u){return u instanceof bA?Ft-1:0}queryRenderedFeatures(u,s,l){const p=s.getSource();if(!(p&&p instanceof Uy))return{};const m=p,_={};_[this.id]=[];const v=_[this.id];let w=0;for(const A of m.models){const k=s.getFeatureState(this.sourceLayer,A.id),R={type:"Unknown",id:A.id,properties:A.featureProperties},j=this.paint.get("model-rotation").evaluate(R,k),z=this.paint.get("model-scale").evaluate(R,k),U=this.paint.get("model-translation").evaluate(R,k),q=this.paint.get("model-elevation-reference");let X=[];tA(X,A,l,A.position,j,z,U,q==="ground",q==="ground",!1),l.projection.name==="globe"&&(X=eA(X,l));const Q=G([],l.projMatrix,X),ee=oR(u.isPointQuery()?u.screenBounds:u.screenGeometry,l,Q,A.aabb);if(ee!=null){const oe=new By(void 0,0,0,0,A.id);oe.layer=this.layer,oe.properties=structuredClone(A.featureProperties),oe.properties.layer=this.id,oe.properties.uri=A.uri,oe.properties.orientation=A.orientation,oe.sourceLayer=this.sourceLayer,oe.geometry={type:"Point",coordinates:[A.position.lng,A.position.lat]},oe.state=k,oe.source=this.source,v.push({featureIndex:w,feature:oe,intersectionZ:ee})}++w}return _}queryIntersectsFeature(u,s,l,p,m,_){if(!this.modelManager)return!1;const v=this.modelManager,w=u.tile.getBucket(this);if(!(w&&w instanceof jR))return!1;for(const A in w.instancesPerModel){const k=w.instancesPerModel[A],R=s.id!==void 0?s.id:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0;if(k.idToFeaturesIndex.hasOwnProperty(R)){const j=k.features[k.idToFeaturesIndex[R]],z=v.getModel(A,this.scope);if(!z)return!1;let U=[];const q=new H(0,0),X=w.canonical;let Q=Number.MAX_VALUE;for(let ee=0;ee<j.instancedDataCount;++ee){const oe=16*(j.instancedDataOffset+ee),le=k.instancedDataArray.float32,de=[le[oe+4],le[oe+5],le[oe+6]];LR(X,q,Math.floor(le[oe]),Math.floor(le[oe+1])),tA(U,z,_,q,j.rotation,j.scale,de,!1,!1,!1),_.projection.name==="globe"&&(U=eA(U,_));const Ae=G([],_.projMatrix,U),xe=u.queryGeometry,Me=oR(xe.isPointQuery()?xe.screenBounds:xe.screenGeometry,_,Ae,z.aabb);Me!=null&&(Q=Math.min(Me,Q))}return Q!==Number.MAX_VALUE&&Q}}return!1}_handleOverridablePaintPropertyUpdate(u,s,l){return!(!this.layout||s.isDataDriven()||l.isDataDriven()||u!=="model-color"&&u!=="model-color-mix-intensity"&&u!=="model-rotation"&&u!=="model-scale"&&u!=="model-translation"&&u!=="model-emissive-strength")}_isPropertyZoomDependent(u){const s=this._transitionablePaint._values[u];return s!=null&&s.value!=null&&s.value.expression!=null&&s.value.expression instanceof th}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends _a{constructor(u,s,l,p){super(u,{layout:R5||(R5=new bs({"clip-layer-types":ne
821w Nt(Ze.layout_clip["clip-layer-types"]),"clip-layer-scope":new Nt(Ze.layout_clip["clip-layer-scope"])})),paint:j5||(j5=new bs({}))},s,l,p)}recalculate(u,s){super.recalculate(u,s)}createBucket(u){return new z5(u)}is3D(u){return!0}}},OR=new lr(0,0,0),FR={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},BR={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},wA={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},rfe={PAINT_ORDER_FILL_AND_STROKE:1},oS={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},o6={MASK_TYPE_LUMINANCE:1};function sfe(u,s,l){u===1&&s.icons.push(function(p,m){return function(_){if(_.usvg_tree.height||(_.usvg_tree.height=_.usvg_tree.width),!_.metadata)return _;const{metadata:v}=_;if(v.content_area){const{content_area:w}=v;w.left==null&&(w.left=0),w.top==null&&(w.top=w.left),w.width==null&&(w.width=_.usvg_tree.width),w.height==null&&(w.height=w.width)}if(v.text_placeholder){const{text_placeholder:w}=v;w.top==null&&(w.top=w.left),w.height==null&&(w.height=w.width)}return v.stretch_x&&v.stretch_x.length&&a6(v,"x"),v.stretch_y&&v.stretch_y.length&&a6(v,"y"),_}(p.readFields(ofe,{name:void 0},m))}(l,l.readVarint()+l.pos))}function a6(u,s){const l=[],p=u[`stretch_${s}`];let m=null;for(let _=0;_<p.length;_++)m===null?m=l.length===0?p[0]:l[l.length-1][1]+p[_]:(l.push([m,m+p[_]]),m=null);u[`stretch_${s}_areas`]=l}function ofe(u,s,l){u===1?s.name=l.readString():u===2?s.metadata=function(p,m){return p.readFields(afe,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},m)}(l,l.readVarint()+l.pos):u===3&&(s.usvg_tree=function(p,m){return p.readFields(ufe,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},m)}(l,l.readVarint()+l.pos),s.data="usvg_tree")}function afe(u,s,l){u===1?s.stretch_x=l.readPackedVarint():u===2?s.stretch_y=l.readPackedVarint():u===3?s.content_area=l6(l,l.readVarint()+l.pos):u===4?s.variables.push(function(p,m){return p.readFields(cfe,{name:void 0},m)}(l,l.readVarint()+l.pos)):u===5&&(s.text_placeholder=l6(l,l.readVarint()+l.pos))}function l6(u,s){return u.readFields(lfe,{},s)}function lfe(u,s,l){u===1?s.left=l.readVarint():u===2?s.width=l.readVarint():u===3?s.top=l.readVarint():u===4&&(s.height=l.readVarint())}function cfe(u,s,l){u===1?s.name=l.readString():u===2&&(s.rgb_color=CA(l.readVarint()),s.value="rgb_color")}function ufe(u,s,l){u===1?s.width=s.height=l.readVarint():u===2?s.height=l.readVarint():u===3?s.children.push(SA(l,l.readVarint()+l.pos)):u===4?s.linear_gradients.push(function(p,m){return p.readFields(yfe,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},m)}(l,l.readVarint()+l.pos)):u===5?s.radial_gradients.push(function(p,m){return p.readFields(vfe,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},m)}(l,l.readVarint()+l.pos)):u===7?s.clip_paths.push(function(p,m){return p.readFields(xfe,{children:[]},m)}(l,l.readVarint()+l.pos)):u===8&&s.masks.push(function(p,m){const _=p.readFields(bfe,{left:0,width:20,mask_type:o6.MASK_TYPE_LUMINANCE,children:[]},m);return _.height==null&&(_.height=_.width),_.top==null&&(_.top=_.left),_}(l,l.readVarint()+l.pos))}function SA(u,s){return u.readFields(dfe,{},s)}function dfe(u,s,l){u===1?(s.group=function(p,m){return p.readFields(hfe,{opacity:255,children:[]},m)}(l,l.readVarint()+l.pos),s.node="group"):u===2&&(s.path=function(p,m){return p.readFields(ffe,{paint_order:1,commands:[],step:1,diffs:[],rule:FR.PATH_RULE_NON_ZERO},m)}(l,l.readVarint()+l.pos),s.node="path")}function hfe(u,s,l){u===1?s.transform=TA(l,l.readVarint()+l.pos):u===2?s.opacity=l.readVarint():u===5?s.clip_path_idx=l.readVarint():u===6?s.mask_idx=l.readVarint():u===7&&s.children.push(SA(l,l.readVarint()+l.pos))}function TA(u,s){return u.readFields(pfe,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},s)}function pfe(u,s,l){u===1?s.sx=l.readFloat():u===2?s.ky=l.readFloat():u===3?s.kx=l.readFloat():u===4?s.sy=l.readFloat():u===5?s.tx=l.readFloat():u===6&&(s.ty=l.readFloat())}function ffe(u,s,l){u===1?s.fill=function(p,m){return p.readFields(mfe,{rgb_color:OR,paint:"rgb_color",opacity:255},m)}(l,l.readVarint()+l.pos):u===2?s.stroke=function(p,m){return p.readFields(gfe,{rgb_color:OR,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},m)}(l,l.readVarint()+l.pos):u===3?s.paint_order=l.readVarint():u===5?l.readPackedVarint(s.commands):u===6?s.step=l.readFloat():u===7?l.readPackedSVarint(s.diffs):u===8&&(s.rule=l.readVarint())}function mfe(u,s,l){u===1?(s.rgb_color=CA(l.readVarint()),s.paint="rgb_color"):u===2?(s.linear_gradient_idx=l.readVarint(),s.paint="linear_gradient_idx"):u===3?(s.radial_gradient_idx=l.readVarint(),s.paint="radial_gradient_idx"):u===5&&(s.op
821acity=l.readVarint())}function CA(u){return new lr((u>>16&255)/255,(u>>8&255)/255,(255&u)/255,1)}function gfe(u,s,l){u===1?(s.rgb_color=CA(l.readVarint()),s.paint="rgb_color"):u===2?(s.linear_gradient_idx=l.readVarint(),s.paint="linear_gradient_idx"):u===3?(s.radial_gradient_idx=l.readVarint(),s.paint="radial_gradient_idx"):u===5?l.readPackedFloat(s.dasharray):u===6?s.dashoffset=l.readFloat():u===7?s.miterlimit=l.readFloat():u===8?s.opacity=l.readVarint():u===9?s.width=l.readFloat():u===10?s.linecap=l.readVarint():u===11&&(s.linejoin=l.readVarint())}function yfe(u,s,l){u===1?s.transform=TA(l,l.readVarint()+l.pos):u===2?s.spread_method=l.readVarint():u===3?s.stops.push(c6(l,l.readVarint()+l.pos)):u===4?s.x1=l.readFloat():u===5?s.y1=l.readFloat():u===6?s.x2=l.readFloat():u===7&&(s.y2=l.readFloat())}function c6(u,s){return u.readFields(_fe,{offset:0,opacity:255,rgb_color:OR},s)}function _fe(u,s,l){u===1?s.offset=l.readFloat():u===2?s.opacity=l.readVarint():u===3&&(s.rgb_color=CA(l.readVarint()))}function vfe(u,s,l){u===1?s.transform=TA(l,l.readVarint()+l.pos):u===2?s.spread_method=l.readVarint():u===3?s.stops.push(c6(l,l.readVarint()+l.pos)):u===4?s.cx=l.readFloat():u===5?s.cy=l.readFloat():u===6?s.r=l.readFloat():u===7?s.fx=l.readFloat():u===8?s.fy=l.readFloat():u===9&&(s.fr=l.readFloat())}function xfe(u,s,l){u===1?s.transform=TA(l,l.readVarint()+l.pos):u===2?s.clip_path_idx=l.readVarint():u===3&&s.children.push(SA(l,l.readVarint()+l.pos))}function bfe(u,s,l){u===1?s.left=s.top=l.readFloat():u===2?s.width=s.height=l.readFloat():u===3?s.top=l.readFloat():u===4?s.height=l.readFloat():u===5?s.mask_type=l.readVarint():u===6?s.mask_idx=l.readVarint():u===7&&s.children.push(SA(l,l.readVarint()+l.pos))}class wfe{static calculate(s={},l=[]){const p=new Map,m=new Map;if(Object.keys(s).length===0)return p;l.forEach(_=>{m.set(_.name,_.rgb_color||new lr(0,0,0))});for(const[_,v]of Object.entries(s))m.has(_)?p.set(m.get(_).toString(),v):console.warn(`Ignoring unknown image variable "${_}"`);return p}}function jx(u,s=255,l){const p=s/255,m=u.toString(),_=l.has(m)?l.get(m).clone():u.clone();return _.a*=p,_.toString()}function aS(u,s){if(!hl()){const l=document.createElement("canvas");return l.width=u,l.height=s,l}return new OffscreenCanvas(u,s)}function Sfe(u,s){const l=wfe.calculate(s.params,u.metadata?u.metadata.variables:[]),p=u.usvg_tree,m=p.width,_=p.height,v=s.transform?s.transform:new DOMMatrix,w=Math.max(1,Math.round(m*v.a)),A=Math.max(1,Math.round(_*v.d)),k=new DOMMatrix([w/m,0,0,A/_,0,0]),R=aS(w,A).getContext("2d");return UR(R,k,p,p,l),R.getImageData(0,0,w,A)}function UR(u,s,l,p,m){for(const _ of p.children)u6(u,s,l,_,m)}function u6(u,s,l,p,m){p.group?(u.save(),function(_,v,w,A,k){const R=A.mask_idx!=null?w.masks[A.mask_idx]:null,j=A.clip_path_idx!=null?w.clip_paths[A.clip_path_idx]:null;if(A.transform&&(v=zx(A.transform).preMultiplySelf(v)),!function(q,X,Q){return q.opacity!==255||X||Q}(A,j!=null,R!=null))return void UR(_,v,w,A,k);const z=aS(_.canvas.width,_.canvas.height),U=z.getContext("2d");UR(U,v,w,A,k),j&&y6(U,v,w,j),R&&_6(U,v,w,R,k),_.globalAlpha=A.opacity/255,_.drawImage(z,0,0)}(u,s,l,p.group,m),u.restore()):p.path&&(u.save(),function(_,v,w,A,k){_.setTransform(v),A.paint_order===rfe.PAINT_ORDER_FILL_AND_STROKE?(d6(_,w,A,k),p6(_,w,A,k)):(p6(_,w,A,k),d6(_,w,A,k))}(u,s,l,p.path,m),u.restore())}function d6(u,s,l,p){const m=l.fill;if(!m)return;const _=m.opacity/255;switch(u.save(),u.beginPath(),v6(l,u),m.paint){case"rgb_color":u.fillStyle=jx(m.rgb_color,m.opacity,p);break;case"linear_gradient_idx":{const v=s.linear_gradients[m.linear_gradient_idx];v.transform&&u.setTransform(zx(v.transform).preMultiplySelf(u.getTransform())),u.fillStyle=f6(u,v,_,p);break}case"radial_gradient_idx":{const v=s.radial_gradients[m.radial_gradient_idx];v.transform&&u.setTransform(zx(v.transform).preMultiplySelf(u.getTransform())),u.fillStyle=m6(u,v,_,p)}}u.fill(h6(l)),u.restore()}function h6(u){return u.rule===FR.PATH_RULE_NON_ZERO?"nonzero":u.rule===FR.PATH_RULE_EVEN_ODD?"evenodd":void 0}function p6(u,s,l,p){const m=l.stroke;if(!m)return;const _=x6(l);u.lineWidth=m.width,u.miterLimit=m.miterlimit,u.setLineDash(m.dasharray),u.lineDashOffset=m.dash
821offset;const v=m.opacity/255;switch(m.paint){case"rgb_color":u.strokeStyle=jx(m.rgb_color,m.opacity,p);break;case"linear_gradient_idx":u.strokeStyle=f6(u,s.linear_gradients[m.linear_gradient_idx],v,p,!0);break;case"radial_gradient_idx":u.strokeStyle=m6(u,s.radial_gradients[m.radial_gradient_idx],v,p,!0)}switch(m.linejoin){case wA.LINE_JOIN_MITER_CLIP:case wA.LINE_JOIN_MITER:u.lineJoin="miter";break;case wA.LINE_JOIN_ROUND:u.lineJoin="round";break;case wA.LINE_JOIN_BEVEL:u.lineJoin="bevel"}switch(m.linecap){case BR.LINE_CAP_BUTT:u.lineCap="butt";break;case BR.LINE_CAP_ROUND:u.lineCap="round";break;case BR.LINE_CAP_SQUARE:u.lineCap="square"}u.stroke(_)}function f6(u,s,l,p,m=!1){if(s.stops.length===1){const z=s.stops[0];return jx(z.rgb_color,z.opacity*l,p)}const{x1:_,y1:v,x2:w,y2:A}=s;let k=new DOMPoint(_,v),R=new DOMPoint(w,A);if(m){const z=zx(s.transform);k=z.transformPoint(k),R=z.transformPoint(R)}const j=u.createLinearGradient(k.x,k.y,R.x,R.y);for(const z of s.stops)j.addColorStop(z.offset,jx(z.rgb_color,z.opacity*l,p));return j}function m6(u,s,l,p,m=!1){if(s.stops.length===1){const ee=s.stops[0];return jx(ee.rgb_color,ee.opacity*l,p)}const _=zx(s.transform),{fx:v,fy:w,fr:A,cx:k,cy:R,r:j}=s;let z=new DOMPoint(v,w),U=new DOMPoint(k,R),q=A,X=j;if(m){z=_.transformPoint(z),U=_.transformPoint(U);const ee=(_.a+_.d)/2;q=A*ee,X=s.r*ee}const Q=u.createRadialGradient(z.x,z.y,q,U.x,U.y,X);for(const ee of s.stops)Q.addColorStop(ee.offset,jx(ee.rgb_color,ee.opacity*l,p));return Q}function g6(u,s,l,p){const m=p.transform?zx(p.transform).preMultiplySelf(s):s,_=aS(u.canvas.width,u.canvas.height),v=_.getContext("2d");for(const A of p.children)if(A.group)g6(v,m,l,A.group);else if(A.path){const k=A.path,R=new Path2D;R.addPath(x6(k),m),v.fill(R,h6(k))}const w=p.clip_path_idx!=null?l.clip_paths[p.clip_path_idx]:null;w&&y6(v,m,l,w),u.globalCompositeOperation="source-over",u.drawImage(_,0,0)}function y6(u,s,l,p){const m=aS(u.canvas.width,u.canvas.height);g6(m.getContext("2d"),s,l,p),u.globalCompositeOperation="destination-in",u.drawImage(m,0,0)}function _6(u,s,l,p,m){if(p.children.length===0)return;const _=p.mask_idx!=null?l.masks[p.mask_idx]:null;_&&_6(u,s,l,_,m);const v=u.canvas.width,w=u.canvas.height,A=aS(v,w),k=A.getContext("2d"),R=p.width,j=p.height,z=p.left,U=p.top,q=new Path2D,X=new Path2D;X.rect(z,U,R,j),q.addPath(X,s),k.clip(q);for(const oe of p.children)u6(k,s,l,oe,m);const Q=k.getImageData(0,0,v,w),ee=Q.data;if(p.mask_type===o6.MASK_TYPE_LUMINANCE)for(let oe=0;oe<ee.length;oe+=4)ee[oe+3]=ee[oe+3]/255*(.2126*ee[oe]+.7152*ee[oe+1]+.0722*ee[oe+2]);k.putImageData(Q,0,0),u.globalCompositeOperation="destination-in",u.drawImage(A,0,0)}function zx(u){return u?new DOMMatrix([u.sx,u.ky,u.kx,u.sy,u.tx,u.ty]):new DOMMatrix}function v6(u,s){const l=u.step;let p=u.diffs[0]*l,m=u.diffs[1]*l;s.moveTo(p,m);for(let _=0,v=2;_<u.commands.length;_++)switch(u.commands[_]){case oS.PATH_COMMAND_MOVE:p+=u.diffs[v++]*l,m+=u.diffs[v++]*l,s.moveTo(p,m);break;case oS.PATH_COMMAND_LINE:p+=u.diffs[v++]*l,m+=u.diffs[v++]*l,s.lineTo(p,m);break;case oS.PATH_COMMAND_QUAD:{const w=p+u.diffs[v++]*l,A=m+u.diffs[v++]*l;p=w+u.diffs[v++]*l,m=A+u.diffs[v++]*l,s.quadraticCurveTo(w,A,p,m);break}case oS.PATH_COMMAND_CUBIC:{const w=p+u.diffs[v++]*l,A=m+u.diffs[v++]*l,k=w+u.diffs[v++]*l,R=A+u.diffs[v++]*l;p=k+u.diffs[v++]*l,m=R+u.diffs[v++]*l,s.bezierCurveTo(w,A,k,R,p,m);break}case oS.PATH_COMMAND_CLOSE:s.closePath()}return s}function x6(u){return v6(u,new Path2D)}class EA{constructor(s){this.capacity=s,this.cache=new Map}get(s){if(!this.cache.has(s))return;const l=this.cache.get(s);return this.cache.delete(s),this.cache.set(s,l),l}put(s,l){this.cache.has(s)?this.cache.delete(s):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(s,l)}delete(s){this.cache.delete(s)}}ri(EA,"LRUCache");class VR{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(s){return new oa(s,s.data)}
vendor: 5,492 bytes, line 821
821getFromCache(s,l,p){return this.cacheMap.has(p)||this.cacheMap.set(p,new EA(150)),this.cacheMap.get(p).get(fp(s.toString(),l))}setInCache(s,l,p,m){this.cacheDependenciesMap.has(m)||this.cacheDependenciesMap.set(m,new Map),this.cacheMap.has(m)||this.cacheMap.set(m,new EA(150));const _=this.cacheDependenciesMap.get(m),v=fp(s.id.toString(),p);_.get(v)||_.set(v,new Set);const w=this.cacheMap.get(m),A=s.toString();_.get(v).add(A),w.put(fp(s.toString(),p),l)}removeImagesFromCacheByIds(s,l,p=0){if(!this.cacheMap.has(p)||!this.cacheDependenciesMap.has(p))return;const m=this.cacheMap.get(p),_=this.cacheDependenciesMap.get(p);for(const v of s){const w=fp(v.toString(),l);if(_.has(w)){for(const A of _.get(w))m.delete(A);_.delete(w)}}}rasterize(s,l,p,m,_=Sfe){const v=this.getFromCache(s,p,m);if(v)return v.clone();const w=_(l.icon,s.options),A=VR._getImage(w);return this.setInCache(s,A,p,m),A.clone()}}class b6{constructor(s){this.size=s,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(s,l){const p=this.toIdx(s,l);return{min:this.minimums[p],max:this.maximums[p]}}isLeaf(s,l){return this.leaves[this.toIdx(s,l)]}toIdx(s,l){return l*this.size+s}}function w6(u,s,l,p){let m=0,_=Number.MAX_VALUE;for(let v=0;v<3;v++)if(Math.abs(p[v])<1e-15){if(l[v]<u[v]||l[v]>s[v])return null}else{const w=1/p[v];let A=(u[v]-l[v])*w,k=(s[v]-l[v])*w;if(A>k){const R=A;A=k,k=R}if(A>m&&(m=A),k<_&&(_=k),m>_)return null}return m}function S6(u,s,l,p,m,_,v,w,A,k,R){const j=p-u,z=m-s,U=_-l,q=v-u,X=w-s,Q=A-l,ee=R[1]*Q-R[2]*X,oe=R[2]*q-R[0]*Q,le=R[0]*X-R[1]*q,de=j*ee+z*oe+U*le;if(Math.abs(de)<1e-15)return null;const Ae=1/de,xe=k[0]-u,Me=k[1]-s,Le=k[2]-l,Be=(xe*ee+Me*oe+Le*le)*Ae;if(Be<0||Be>1)return null;const ut=Me*U-Le*z,Xe=Le*j-xe*U,ht=xe*z-Me*j,_t=(R[0]*ut+R[1]*Xe+R[2]*ht)*Ae;return _t<0||Be+_t>1?null:(q*ut+X*Xe+Q*ht)*Ae}function T6(u,s,l){return(u-s)/(l-s)}function C6(u,s,l,p,m,_,v,w,A){const k=1<<l,R=_-p,j=v-m,z=(u+1)/k*R+p,U=(s+0)/k*j+m,q=(s+1)/k*j+m;w[0]=(u+0)/k*R+p,w[1]=U,A[0]=z,A[1]=q}class E6{constructor(s){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=s,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const l=function(_){const v=Math.ceil(Math.log2(_.dim/8)),w=[];let A=Math.ceil(Math.pow(2,v));const k=1/A,R=(U,q,X,Q,ee)=>{const oe=Q?1:0,le=(U+1)*X-oe,de=q*X,Ae=(q+1)*X-oe;ee[0]=U*X,ee[1]=de,ee[2]=le,ee[3]=Ae};let j=new b6(A);const z=[];for(let U=0;U<A*A;U++){R(U%A,Math.floor(U/A),k,!1,z);const q=sm(z[0],z[1],_),X=sm(z[2],z[1],_),Q=sm(z[2],z[3],_),ee=sm(z[0],z[3],_);j.minimums.push(Math.min(q,X,Q,ee)),j.maximums.push(Math.max(q,X,Q,ee)),j.leaves.push(1)}for(w.push(j),A/=2;A>=1;A/=2){const U=w[w.length-1];j=new b6(A);for(let q=0;q<A*A;q++){R(q%A,Math.floor(q/A),2,!0,z);const X=U.getElevation(z[0],z[1]),Q=U.getElevation(z[2],z[1]),ee=U.getElevation(z[2],z[3]),oe=U.getElevation(z[0],z[3]),le=U.isLeaf(z[0],z[1]),de=U.isLeaf(z[2],z[1]),Ae=U.isLeaf(z[2],z[3]),xe=U.isLeaf(z[0],z[3]),Me=Math.min(X.min,Q.min,ee.min,oe.min),Le=Math.max(X.max,Q.max,ee.max,oe.max),Be=le&&de&&Ae&&xe;j.maximums.push(Le),j.minimums.push(Me),j.leaves.push(Le-Me<=5&&Be?1:0)}w.push(j)}return w}(this.dem),p=l.length-1,m=l[p];this._addNode(m.minimums[0],m.maximums[0],m.leaves[0]),this._construct(l,0,0,p,0)}raycastRoot(s,l,p,m,_,v,w=1){return w6([s,l,-100],[p,m,this.maximums[0]*w],_,v)}raycast(s,l,p,m,_,v,w=1){if(!this.nodeCount)return null;const A=this.raycastRoot(s,l,p,m,_,v,w);if(A==null)return null;const k=[],R=[],j=[],z=[],U=[{idx:0,t:A,nodex:0,nodey:0,depth:0}];for(;U.length>0;){const{idx:q,t:X,nodex:Q,nodey:ee,depth:oe}=U.pop();if(this.leaves[q]){C6(Q,ee,oe,s,l,p,m,j,z);const de=1<<oe,Ae=(Q+0)/de,xe=(Q+1)/de,Me=(ee+0)/de,Le=(ee+1)/de,Be=sm(Ae,Me,this.dem)*w,ut=sm(xe,Me,this.dem)*w,Xe=sm(xe,Le,this.dem)*w,ht=sm(Ae,Le,this.dem)*w,_t=S6(j[0],j[1],Be,z[0],j[1],ut,z[0],z[1],Xe,_,v),bt=S6(z[0],z[1],Xe,j[0],z[1],ht,j[0],j[1],Be,_,v),zt=Math.min(_t!==null?_t:Number.MAX_VALUE,bt!==null?bt:Number.MAX_VALUE);if(zt!==Number.MAX_VALUE)return zt;{const Et=Ci([],_,v,X);if(A6(Be,ut,ht,Xe,T6(Et[0],j[0],z[0]),T6(Et[1],j[1],z[1]))>=Et[2])return X}continue}let le=0;for(let de=0;de<this._siblingOffset.length;de++){C6((Q<<1)+this._siblingOffset[de][0],(ee<<1)+this._siblingOffset[de][1],oe+1,s,l,p,m,j,z),j[2]=-100,z[2]=this.maximums[this.childOffsets[q]+de]*w;const Ae=w6(j,z,_,v);if(Ae!=null){const xe=Ae;k[de]=xe;let Me=!1;for(let Le=0;Le<le&&!Me;Le++)xe>=k[R[Le]]&&(R.splice(Le,0,de),Me=!0);Me||(R[le]=de),le++}}for(let de=0;de<le;de++){const Ae=R[de];U.push({idx:this.childOffsets[q]+Ae,t:k[Ae],nodex:(Q<<1)+this._siblingOffset[Ae][0],nodey:(ee<<1)+this._siblingOffset[Ae][1],depth:oe+1})}}return null}_addNode(s,l,p){return this.minimums.push(s),this.maximums.push(l),this.leaves.push(p),this.childOffsets.push(0),this.nodeCount++}_construct(s,l,p,m,_){if(s[m].isLeaf(l,p)===1)return;this.childOffsets[_]||(this.childOffsets[_]=this.nodeCount);const v=m-1,w=s[v];let A=0,k=0;for(let R=0;R<this._siblingOffset.length;R++){const j=2*l+this._siblingOffset[R][0],z=2*p+this._siblingOffset[R][1],U=w.getElevation(j,z),q=w.isLeaf(j,z),X=this._addNode(U.min,U.max,q);q&&(A|=1<<R),k||(k=X)}for(let R=0;R<this._siblingOffset.length;R++)A&1<<R||this._construct(s,2*l+this._siblingOffset[R][0],2*p+this._siblingOffset[R][1],v,k+R)}}function A6(u,s,l,p,m,_){return Vi(Vi(u,l,_),Vi(s,p,_),m)}function sm(u,s,l){const p=l.dim,m=re(u*p-.5,0,p-1),_=re(s*p-.5,0,p-1),v=Math.floor(m),w=Math.floor(_),A=Math.min(v+1,p-1),k=Math.min(w+1,p-1);
vendor: 5,836 bytes, line 821
821return A6(l.get(v,w),l.get(A,w),l.get(v,k),l.get(A,k),m-v,_-w)}const Tfe={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Cfe(u,s,l){return(256*u*256+256*s+l)/10-1e4}function Efe(u,s,l){return 256*u+s+l/256-32768}class AA{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(s,l,p,m=!1){if(this.uid=s,l.height!==l.width)throw new RangeError("DEM tiles must be square");if(p&&p!=="mapbox"&&p!=="terrarium")return void di(`"${p}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=l.height;const _=this.dim=l.height-2,v=new Uint32Array(l.data.buffer);if(this.pixels=new Uint8Array(l.data.buffer),this.floatView=new Float32Array(l.data.buffer),this.borderReady=m,this._modifiedForSources={},!m){for(let A=0;A<_;A++)v[this._idx(-1,A)]=v[this._idx(0,A)],v[this._idx(_,A)]=v[this._idx(_-1,A)],v[this._idx(A,-1)]=v[this._idx(A,0)],v[this._idx(A,_)]=v[this._idx(A,_-1)];v[this._idx(-1,-1)]=v[this._idx(0,0)],v[this._idx(_,-1)]=v[this._idx(_-1,0)],v[this._idx(-1,_)]=v[this._idx(0,_-1)],v[this._idx(_,_)]=v[this._idx(_-1,_-1)]}const w=p==="terrarium"?Efe:Cfe;for(let A=0;A<v.length;++A){const k=4*A;this.floatView[A]=w(this.pixels[k],this.pixels[k+1],this.pixels[k+2])}this._timestamp=pl.now()}_buildQuadTree(){this._tree=new E6(this)}get(s,l,p=!1){p&&(s=re(s,-1,this.dim),l=re(l,-1,this.dim));const m=this._idx(s,l);return this.floatView[m]}set(s,l,p){const m=this._idx(s,l),_=this.floatView[m];return this.floatView[m]=p,p-_}static getUnpackVector(s){return Tfe[s]}_idx(s,l){if(s<-1||s>=this.dim+1||l<-1||l>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(l+1)*this.stride+(s+1)}static pack(s,l){const p=[0,0,0,0],m=AA.getUnpackVector(l);let _=Math.floor((s+m[3])/m[2]);return p[2]=_%256,_=Math.floor(_/256),p[1]=_%256,_=Math.floor(_/256),p[0]=_,p}getPixels(){return new x5({width:this.stride,height:this.stride},this.pixels)}backfillBorder(s,l,p){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let m=l*this.dim,_=l*this.dim+this.dim,v=p*this.dim,w=p*this.dim+this.dim;switch(l){case-1:m=_-1;break;case 1:_=m+1}switch(p){case-1:v=w-1;break;case 1:w=v+1}const A=-l*this.dim,k=-p*this.dim;for(let R=v;R<w;R++)for(let j=m;j<_;j++){const z=4*this._idx(j,R),U=4*this._idx(j+A,R+k);this.pixels[z+0]=s.pixels[U+0],this.pixels[z+1]=s.pixels[U+1],this.pixels[z+2]=s.pixels[U+2],this.pixels[z+3]=s.pixels[U+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function Afe(u,s,l){u===1?s.headerLength=l.readFixed32():u===2?s.x=l.readVarint():u===3?s.y=l.readVarint():u===4?s.z=l.readVarint():u===5&&s.layers.push(function(p,m){return p.readFields(Mfe,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},m)}(l,l.readVarint()+l.pos))}function Ife(u,s,l){u===1?(s.delta_filter=function(p,m){return p.readFields(kfe,{blockSize:0},m)}(l,l.readVarint()+l.pos),s.filter="delta_filter"):u===2?(l.readVarint(),s.filter="zigzag_filter"):u===3?(l.readVarint(),s.filter="bitshuffle_filter"):u===4&&(l.readVarint(),s.filter="byteshuffle_filter")}function kfe(u,s,l){u===1&&(s.blockSize=l.readVarint())}function Pfe(u,s,l){u===1?(l.readVarint(),s.codec="gzip_data"):u===2?(l.readVarint(),s.codec="jpeg_image"):u===3?(l.readVarint(),s.codec="webp_image"):u===4&&(l.readVarint(),s.codec="png_image")}function Nfe(u,s,l){let p=0,m=0;u===1?s.firstByte=l.readFixed64():u===2?s.lastByte=l.readFixed64():u===3?s.filters.push(function(_,v){return _.readFields(Ife,{},v)}(l,l.readVarint()+l.pos)):u===4?s.codec=function(_,v){return _.readFields(Pfe,{},v)}(l,l.readVarint()+l.pos):u===5?m=l.readFloat():u===6?p=l.readFloat():u===7?s.bands.push(l.readString()):u===8?s.offset=l.readDouble():u===9&&(s.scale=l.readDouble()),s.offset===0&&(s.offset=m),s.scale===0&&(s.scale=p)}function Mfe(u,s,l){u===1?s.version=l.readVarint():u===2?s.name=l.readString():u===3?s.units=l.readString():u===4?s.tileSize=l.readVarint():u===5?s.buffer=l.readVarint():u===6?s.pixelFormat=l.readVarint():u===7&&s.dataIndex.push(function(p,m){return p.readFields(Nfe,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},m)}(l,l.readVarint()+l.pos))}function Dfe(u,s,l){if(u===2)(function(p,m,_){p.readFields(Rfe,_,m)})(l,l.readVarint()+l.pos,s);else if(u===3)throw new Error("Not implemented")}function Rfe(u,s,l){if(u===1){let p=0;const m=l.readVarint()+l.pos;for(;l.pos<m;)s[p++]=l.readVarint()}}function jfe(u,s){if(s.length!==4)throw new Error(`Expected data of dimension 4 but got ${s.length}.`);let l=s[3];for(let p=2;p>=1;p--){const m=p===1?1:0,_=p===2?1:0;for(let v=0;v<s[0];v++){const w=s[1]*v;for(let A=m;A<s[1];A++){const k=s[2]*(A+w);for(let R=_;R<s[2];R++){const j=s[3]*(R+k);for(let z=0;z<s[3];z++){const U=j+z;u[U]+=u[U-l]}}}}l*=s[p]}return u}function zfe(u){for(let s=0,l=u.length;s<l;s++)u[s]=u[s]>>>1^-(1&u[s]);return u}function Lfe(u,s){switch(s){case"uint32":return u;case"uint16":for(let l=0;l<u.length;l+=2){const p=u[l],m=u[l+1];u[l]=(240&p)>>4|(61440&p)>>8|(240&m)<<4|61440&m,u[l+1]=15&p|(3840&p)>>4|(15&m)<<8|(3840&m)<<4}return u;case"uint8":for(let l=0;l<u.length;l+=4){const p=u[l],m=u[l+1],_=u[l+2],v=u[l+3];u[l+0]=(192&p)>>6|(192&m)>>4|(192&_)>>2|192&v,u[l+1]=(48&p)>>4|(48&m)>>2|48&_|(48&v)<<2,u[l+2]=(12&p)>>2|12&m|(12&_)<<2|(12&v)<<4,u[l+3]=3&p|(3&m)<<2|(3&_)<<4|(3&v)<<6}return u;default:throw new Error(`Invalid pixel format, "${s}"`)}}ri(AA,"DEMData"),ri(E6,"DemMinMaxQuadTree",{omit:["dem"]});var Wc=Uint8Array,lS=Uint16Array,Ofe=Int32Array,I6=new Wc([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]),k6=new Wc([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]),Ffe=new Wc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P6=function(u,s){for(var l=new lS(31),p=0;p<31;++p)l[p]=s+=1<<u[p-1];var m=new Ofe(l[30]);for(p=1;p<30;++p)for(var _=l[p];
vendor: 1,052 bytes, line 821
821_<l[p+1];++_)m[_]=_-l[p]<<5|p;return{b:l,r:m}},N6=P6(I6,2),M6=N6.b,Bfe=N6.r;M6[28]=258,Bfe[258]=28;for(var Ufe=P6(k6,0).b,D6=new lS(32768),ro=0;ro<32768;++ro){var Lx=(43690&ro)>>1|(21845&ro)<<1;D6[ro]=((65280&(Lx=(61680&(Lx=(52428&Lx)>>2|(13107&Lx)<<2))>>4|(3855&Lx)<<4))>>8|(255&Lx)<<8)>>1}var cS=function(u,s,l){for(var p=u.length,m=0,_=new lS(s);m<p;++m)u[m]&&++_[u[m]-1];var v,w=new lS(s);for(m=1;m<s;++m)w[m]=w[m-1]+_[m-1]<<1;v=new lS(1<<s);var A=15-s;for(m=0;m<p;++m)if(u[m])for(var k=m<<4|u[m],R=s-u[m],j=w[u[m]-1]++<<R,z=j|(1<<R)-1;j<=z;++j)v[D6[j]>>A]=k;return v},uS=new Wc(288);for(ro=0;ro<144;++ro)uS[ro]=8;for(ro=144;ro<256;++ro)uS[ro]=9;for(ro=256;ro<280;++ro)uS[ro]=7;for(ro=280;ro<288;++ro)uS[ro]=8;var R6=new Wc(32);for(ro=0;ro<32;++ro)R6[ro]=5;var Vfe=cS(uS,9),$fe=cS(R6,5),$R=function(u){for(var s=u[0],l=1;l<u.length;++l)u[l]>s&&(s=u[l]);return s},ad=function(u,s,l){var p=s/8|0;return(u[p]|u[p+1]<<8)>>(7&s)&l},qR=function(u,s){var l=s/8|0;return(u[l]|u[l+1]<<8|u[l+2]<<16)>>(7&s)},qfe=["unexpected EOF","invalid block type","invali
821d 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"],ld=function(u,s,l){var p=new Error(s||qfe[u]);if(p.code=u,Error.captureStackTrace&&Error.captureStackTrace(p,ld),!l)throw p;return p},Hfe=new Wc(0),Gfe=typeof TextDecoder<"u"&&new TextDecoder;try{Gfe.decode(Hfe,{stream:!0})}catch{}const Wfe={gzip_data:"gzip"};class bu extends Error{constructor(s){super(s),this.name="MRTError"}}const Kfe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},j6={uint32:1,uint16:2,uint8:4},Zfe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let HR;class IA{constructor(s=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=s}getLayer(s){const l=this.layers[s];if(!l)throw new bu(`Layer '${s}' not found`);return l}getHeaderLength(s){const l=new Uint8Array(s),p=new DataView(s);if(l[0]!==13)throw new bu("File is not a valid MRT.");return p.getUint32(1,!0)}parseHeader(s){const l=new Uint8Array(s),p=this.getHeaderLength(s);if(l.length<p)throw new bu(`Expected header with length >= ${p} but got buffer of length ${l.length}`);const m=new HR(l.subarray(0,p)).readFields(Afe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==m.x||this.y!==m.y||this.z!==m.z))throw new bu(`Invalid attempt to parse header ${m.z}/${m.x}/${m.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=m.x,this.y=m.y,this.z=m.z;for(const _ of m.layers)this.layers[_.name]=new z6(_,{cacheSize:this._cacheSize});return this}createDecodingTask(s){const l=[],p=this.getLayer(s.layerName);for(let m of s.blockIndices){const _=p.dataIndex[m],v=_.firstByte-s.firstByte,w=_.lastByte-s.firstByte;if(p._blocksInProgress.has(m))continue;const A={layerName:p.name,firstByte:v,lastByte:w,pixelFormat:p.pixelFormat,blockIndex:m,blockShape:[_.bands.length].concat(p.bandShape),buffer:p.buffer,codec:_.codec.codec,filters:_.filters.map(k=>k.filter)};p._blocksInProgress.add(m),l.push(A)}return new L6(l,()=>{l.forEach(m=>p._blocksInProgress.delete(m.blockIndex))},(m,_)=>{if(l.forEach(v=>p._blocksInProgress.delete(v.blockIndex)),m)throw m;_.forEach(v=>{this.getLayer(v.layerName).processDecodedData(v)})})}}class z6{constructor({version:s,name:l,units:p,tileSize:m,pixelFormat:_,buffer:v,dataIndex:w},A){if(this.version=s,this.version!==1)throw new bu(`Cannot parse raster layer encoded with MRT version ${s}`);this.name=l,this.units=p,this.tileSize=m,this.buffer=v,this.pixelFormat=Kfe[_],this.dataIndex=w,this.bandShape=[m+2*v,m+2*v,j6[this.pixelFormat]],this._decodedBlocks=new EA(A?A.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return j6[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:s})=>s).flat()}processDecodedData(s){const l=s.blockIndex.toString();this._decodedBlocks.get(l)||this._decodedBlocks.put(l,s.data)}getBlockForBand(s){let l=0;switch(typeof s){case"string":for(const[p,m]of this.dataIndex.entries()){for(const[_,v]of m.bands.entries())if(v===s)return{bandIndex:l+_,blockIndex:p,blockBandIndex:_};l+=m.bands.length}break;case"number":for(const[p,m]of this.dataIndex.entries()){if(s>=l&&s<l+m.bands.length)return{bandIndex:s,blockIndex:p,blockBandIndex:s-l};l+=m.bands.length}break;default:throw new bu(`Invalid band \`${JSON.stringify(s)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(s){let l=1/0,p=-1/0;const m=[],_=new Set;for(const v of s){const{blockIndex:w}=this.getBlockForBand(v);if(w<0)throw new bu(`Invalid band: ${JSON.stringify(v)}`);const A=this.dataIndex[w];m.includes(w)||m.push(w),_.add(w),l=Math.min(l,A.firstByte),p=Math.max(p,A.lastByte)}if(_.size>this.cacheSize)throw new bu(`Number of blocks to decode (${_.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:l,lastByte:p,blockIndices:m}}hasBand(s){const{blockIndex:l}=this.getBlockForBand(s);return l>=0}hasDataForBand(s){const{blockIndex:l}=this.getBlockForBand(s);return l>=0&&!!this._decodedBlocks.get(l.toString())}
vendor: 9,496 bytes, line 821
821getBandView(s){const{blockIndex:l,blockBandIndex:p}=this.getBlockForBand(s);if(l<0)throw new bu(`Band not found: ${JSON.stringify(s)}`);const m=this._decodedBlocks.get(l.toString());if(!m)throw new bu(`Data for band ${JSON.stringify(s)} of layer "${this.name}" not decoded.`);const _=this.dataIndex[l],v=this.bandShape.reduce((k,R)=>k*R,1),w=p*v,A=m.subarray(w,w+v);return{data:A,bytes:new Uint8Array(A.buffer).subarray(A.byteOffset,A.byteOffset+A.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:_.offset,scale:_.scale}}}IA.setPbf=function(u){HR=u};class L6{constructor(s,l,p){this.tasks=s,this._onCancel=l,this._onComplete=p,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(s,l){this._finalized||(this._onComplete(s,l),this._finalized=!0)}}IA.performDecoding=function(u,s){const l=new Uint8Array(u);return Promise.all(s.tasks.map(p=>{const{layerName:m,firstByte:_,lastByte:v,pixelFormat:w,blockShape:A,blockIndex:k,filters:R,codec:j}=p,z=l.subarray(_,v+1),U=new Uint32Array(A[0]*A[1]*A[2]);let q;if(j!=="gzip_data")throw new bu(`Unhandled codec: ${j}`);return q=function(X,Q){if(!globalThis.DecompressionStream&&Q==="gzip_data")return Promise.resolve(((de=function(Me){Me[0]==31&&Me[1]==139&&Me[2]==8||ld(6,"invalid gzip data");var Le=Me[3],Be=10;4&Le&&(Be+=2+(Me[10]|Me[11]<<8));for(var ut=(Le>>3&1)+(Le>>4&1);ut>0;ut-=!Me[Be++]);return Be+(2&Le)}(le=X))+8>le.length&&ld(6,"invalid gzip data"),function(Me,Le,Be,ut){var Xe=Me.length;if(!Xe||Le.f&&!Le.l)return Be||new Wc(0);var ht=!Be,_t=ht||Le.i!=2,bt=Le.i;ht&&(Be=new Wc(3*Xe));var zt,Et,vt=function(ys){var qr=Be.length;if(ys>qr){var Nr=new Wc(Math.max(2*qr,ys));Nr.set(Be),Be=Nr}},Ct=Le.f||0,at=Le.p||0,st=Le.b||0,St=Le.l,Dt=Le.d,xt=Le.m,ni=Le.n,ai=8*Xe;do{if(!St){Ct=ad(Me,at,1);var Qt=ad(Me,at+1,3);if(at+=3,!Qt){var Ht=Me[(be=4+((at+7)/8|0))-4]|Me[be-3]<<8,Zi=be+Ht;if(Zi>Xe){bt&&ld(0);break}_t&&vt(st+Ht),Be.set(Me.subarray(be,Zi),st),Le.b=st+=Ht,Le.p=at=8*Zi,Le.f=Ct;continue}if(Qt==1)St=Vfe,Dt=$fe,xt=9,ni=5;else if(Qt==2){var Kt=ad(Me,at,31)+257,Ii=ad(Me,at+10,15)+4,tn=Kt+ad(Me,at+5,31)+1;at+=14;for(var yn=new Wc(tn),Un=new Wc(19),sn=0;sn<Ii;++sn)Un[Ffe[sn]]=ad(Me,at+3*sn,7);at+=3*Ii;var Qn=$R(Un),Jn=(1<<Qn)-1,is=cS(Un,Qn);for(sn=0;sn<tn;){var be,ye=is[ad(Me,at,Jn)];if(at+=15&ye,(be=ye>>4)<16)yn[sn++]=be;else{var ft=0,Ut=0;for(be==16?(Ut=3+ad(Me,at,3),at+=2,ft=yn[sn-1]):be==17?(Ut=3+ad(Me,at,7),at+=3):be==18&&(Ut=11+ad(Me,at,127),at+=7);Ut--;)yn[sn++]=ft}}var mt=yn.subarray(0,Kt),Gt=yn.subarray(Kt);xt=$R(mt),ni=$R(Gt),St=cS(mt,xt),Dt=cS(Gt,ni)}else ld(1);if(at>ai){bt&&ld(0);break}}_t&&vt(st+131072);for(var yi=(1<<xt)-1,fi=(1<<ni)-1,cn=at;;cn=at){var Fi=(ft=St[qR(Me,at)&yi])>>4;if((at+=15&ft)>ai){bt&&ld(0);break}if(ft||ld(2),Fi<256)Be[st++]=Fi;else{if(Fi==256){cn=at,St=null;break}var ui=Fi-254;Fi>264&&(ui=ad(Me,at,(1<<(Ui=I6[sn=Fi-257]))-1)+M6[sn],at+=Ui);var Kn=Dt[qR(Me,at)&fi],Cr=Kn>>4;if(Kn||ld(3),at+=15&Kn,Gt=Ufe[Cr],Cr>3){var Ui=k6[Cr];Gt+=qR(Me,at)&(1<<Ui)-1,at+=Ui}if(at>ai){bt&&ld(0);break}_t&&vt(st+131072);var On=st+ui;if(st<Gt){var Er=0-Gt,cr=Math.min(Gt,On);for(Er+st<0&&ld(3);st<cr;++st)Be[st]=(void 0)[Er+st]}for(;st<On;++st)Be[st]=Be[st-Gt]}}Le.l=St,Le.p=cn,Le.b=st,Le.f=Ct,St&&(Ct=1,Le.m=xt,Le.d=Dt,Le.n=ni)}while(!Ct);return st!=Be.length&&ht?(zt=Be,((Et=st)==null||Et>zt.length)&&(Et=zt.length),new Wc(zt.subarray(0,Et))):Be.subarray(0,st)}(le.subarray(de,-8),{i:2},new Wc(((ee=le)[(oe=ee.length)-4]|ee[oe-3]<<8|ee[oe-2]<<16|ee[oe-1]<<24)>>>0))));var ee,oe,le,de;const Ae=Wfe[Q];if(!Ae)throw new Error(`Unhandled codec: ${Q}`);const xe=new globalThis.DecompressionStream(Ae);return new Response(new Blob([X]).stream().pipeThrough(xe)).arrayBuffer().then(Me=>new Uint8Array(Me))}(z,j).then(X=>(function(Q,ee){Q.readFields(Dfe,ee)}(new HR(X),U),new Zfe[w](U.buffer))),q.then(X=>{for(let Q=R.length-1;Q>=0;Q--)switch(R[Q]){case"delta_filter":jfe(X,A);break;case"zigzag_filter":zfe(X);break;case"bitshuffle_filter":Lfe(X,w);break;default:throw new bu(`Unhandled filter "${R[Q]}"`)}return{layerName:m,blockIndex:k,data:X}}).catch(X=>{throw X})}))},ri(L6,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),ri(IA,"MapboxRasterTile"),ri(z6,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class O6{constructor(s){this._stringToNumber={},this._numberToString=[];for(let l=0;l<s.length;l++){const p=s[l];this._stringToNumber[p]=l,this._numberToString[l]=p}}encode(s){return this._stringToNumber[s]}decode(s){return this._numberToString[s]}}class F6{constructor(s,l){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new hp(Ft,16,0),this.featureIndexArray=new E2,this.promoteId=l,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(s,l,p,m,_,v=0,w=0){const A=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,m,_,v);const k=this.grid;for(let R=0;R<l.length;R++){const j=l[R],z=[1/0,1/0,-1/0,-1/0];for(let U=0;U<j.length;U++){const q=j[U];z[0]=Math.min(z[0],q.x),z[1]=Math.min(z[1],q.y),z[2]=Math.max(z[2],q.x),z[3]=Math.max(z[3],q.y)}w!==0&&(z[0]-=w,z[1]-=w,z[2]+=w,z[3]+=w),z[0]<Ft&&z[1]<Ft&&z[2]>=0&&z[3]>=0&&k.insert(A,z[0],z[1],z[2],z[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new li(new rA(this.rawTileData)).layers,this.sourceLayerCoder=new O6(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const s in this.vtLayers)this.vtFeatures[s]=[]}return this.vtLayers}query(s,l){const{tilespaceGeometry:p,transform:m,tileTransform:_,pixelPosMatrix:v,availableImages:w,worldview:A}=l;this.loadVTLayers(),this.serializedLayersCache.clear();const k=l.queryRadius?l.queryRadius:0,R=p.bufferedTilespaceBounds,j=this.grid.query(R.min.x,R.min.y,R.max.x,R.max.y,(X,Q,ee,oe)=>ms(p.bufferedTilespaceGeometry,X-k,Q-k,ee+k,oe+k));j.sort(Xfe);let z=null;m.elevation&&j.length>0&&(z=Rx.create(m.elevation,this.tileID));const U={};let q;for(let X=0;X<j.length;X++){const Q=j[X];if(Q===q)continue;q=Q;const ee=this.featureIndexArray.get(Q);let oe=null;this.is3DTile?this.loadMatchingModelFeature(U,ee,s,p,m,A):this.loadMatchingFeature(U,ee,s,w,A,(le,de,Ae,xe=0)=>(oe||(oe=yt(le,this.tileID.canonical,_)),de.queryIntersectsFeature(p,le,Ae,oe,this.z,m,v,z,xe)))}return U}loadMatchingFeature(s,l,p,m,_,v){const{featureIndex:w,bucketIndex:A,sourceLayerIndex:k,layoutVertexArrayOffset:R}=l,j=this.bucketLayerIDs[A],z=p.layers,U=Object.keys(z);if(U.length&&!vi(U,j))return;const q=p.sourceCache,X=this.sourceLayerCoder.decode(k),Q=this.vtLayers[X].feature(w),ee=this.getId(Q,X);for(let oe=0;oe<j.length;oe++){const le=j[oe];if(!z[le])continue;const{styleLayer:de,targets:Ae}=z[le];let xe={};ee!==void 0&&(xe=q.getFeatureState(de.sourceLayer,ee));const Me=!v||v(Q,de,xe,R);if(!Me)continue;const Le=new By(Q,this.z,this.x,this.y,ee);Le.tile=this.tileID.canonical,Le.state=xe;let Be=this.serializedLayersCache.get(le);Be||(Be=de.serialize(),Be.id=le,this.serializedLayersCache.set(le,Be)),Le.source=Be.source,Le.sourceLayer=Be["source-layer"],Le.layer=Object.assign({},Be),Le.layer.paint=B6(Be.paint,de.paint,Q,xe,m),Le.layer.layout=B6(Be.layout,de.layout,Q,xe,m);let ut=!1;for(const Xe of Ae){this.updateFeatureProperties(Le,Xe);const{filter:ht}=Xe;if(ht){if(Q.properties=Le.properties,ht.needGeometry){const _t=nt(Q,!0);if(!ht.filter(new Rr(this.tileID.overscaledZ,{worldview:_}),_t,this.tileID.canonical))continue}else if(!ht.filter(new Rr(this.tileID.overscaledZ,{worldview:_}),Q))continue}ut=!0,Xe.targetId&&this.addFeatureVariant(Le,Xe)}ut&&this.appendToResult(s,le,w,Le,Me)}}loadMatchingModelFeature(s,l,p,m,_,v){const{featureIndex:w,bucketIndex:A}=l,k=this.bucketLayerIDs[A],R=p.layers,j=Object.keys(R);if(!j.length||vi(j,k))for(let z=0;z<k.length;z++){const U=k[z],{styleLayer:q,targets:X}=R[U];if(q.type!=="model")continue;const Q=m.tile,ee=Q.getBucket(q);if(!(ee&&ee instanceof bA))continue;const oe=ife(ee,w,m,_);if(!oe)continue;const{z:le,x:de,y:Ae}=Q.tileID.canonical,{feature:xe,intersectionZ:Me,position:Le}=oe;let Be={};xe.id!==void 0&&(Be=p.sourceCache.getFeatureState(q.sourceLayer,xe.id));const ut=new By({},le,de,Ae,xe.id);ut.tile=this.tileID.canonical,ut.state=Be,ut.properties=xe.properties,ut.geometry={type:"Point",coordinates:[Le.lng,Le.lat]};let Xe=this.serializedLayersCache.get(U);Xe||(Xe=q.serialize(),Xe.id=U,this.serializedLayersCache.set(U,Xe)),ut.source=Xe.source,ut.sourceLayer=Xe["source-layer"],ut.layer=Object.assign({},Xe);let ht=!1;for(const _t of X){this.updateFeatureProperties(ut,_t);const{filter:bt}=_t;if(bt){if(xe.properties=ut.properties,bt.needGeometry){if(!bt.filter(new Rr(this.tileID.overscaledZ,{worldview:v}),xe,this.tileID.canonical))continue}else if(!bt.filter(new Rr(this.tileID.overscaledZ,{worldview:v}),xe))continue}ht=!0,_t.targetId&&this.addFeatureVariant(ut,_t)}ht&&this.appendToResult(s,U,w,ut,Me)}}updateFeatureProperties(s,l,p){if(l.properties){const m={};for(const _ in l.properties){const v=l.properties[_].evaluate({zoom:this.z},s._vectorTileFeature,s.state,s.tile,p);v!=null&&(m[_]=v)}s.properties=m}}addFeatureVariant(s,l,p){const m={target:l.target,namespace:l.namespace,uniqueFeatureID:l.uniqueFeatureID};l.properties&&(m.properties=s.properties),s.variants=s.variants||{},s.variants[l.targetId]=s.variants[l.targetId]||[],s.variants[l.targetId].push(m)}appendToResult(s,l,p,m,_){let v=s[l];v===void 0&&(v=s[l]=[]),v.push({featureIndex:p,feature:m,intersectionZ:_})}lookupSymbolFeatures(s,l,p,m,_,v){const w={};this.loadVTLayers();
vendor: 4,695 bytes, line 821
821for(const A of s)this.loadMatchingFeature(w,{bucketIndex:l,sourceLayerIndex:p,featureIndex:A,layoutVertexArrayOffset:0},m,_,v);return w}loadFeature(s){const{featureIndex:l,sourceLayerIndex:p}=s;this.loadVTLayers();const m=this.sourceLayerCoder.decode(p),_=this.vtFeatures[m];if(_[l])return _[l];const v=this.vtLayers[m].feature(l);return _[l]=v,v}hasLayer(s){for(const l of this.bucketLayerIDs)for(const p of l)if(s===p)return!0;return!1}getId(s,l){let p=s.id;if(this.promoteId){const m=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[l];if(m!=null)if(Array.isArray(m)){if(!this.promoteIdExpression){const _=_u(m);if(_.result!=="success"){const v=_.value.map(w=>`${w.key}: ${w.message}`).join(", ");return void di(`Failed to create expression for promoteId: ${v}`)}this.promoteIdExpression=_.value}p=this.promoteIdExpression.evaluate({zoom:0},s)}else p=s.properties[m];typeof p=="boolean"&&(p=Number(p))}return p}}function B6(u,s,l,p,m){return Ee(u,(_,v)=>{const w=s instanceof pp?s.get(v):null;return w&&w.evaluate?w.evaluate(l,p,void 0,m):w})}function Xfe(u,s){return s-u}ri(F6,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const U6=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class GR{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[l,p]=new Uint8Array(s,0,2);if(l!==219)throw new Error("Data does not appear to be in a KDBush format.");const m=p>>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const _=U6[15&p];if(!_)throw new Error("Unrecognized array type.");const[v]=new Uint16Array(s,2,1),[w]=new Uint32Array(s,4,1);return new GR(w,v,_,s)}constructor(s,l=64,p=Float64Array,m){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+l,2),65535),this.ArrayType=p,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const _=U6.indexOf(this.ArrayType),v=2*s*this.ArrayType.BYTES_PER_ELEMENT,w=s*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-w%8)%8;if(_<0)throw new Error(`Unexpected typed array class: ${p}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+w+A,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+v+w+A),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+w+A,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+_]),new Uint16Array(this.data,2,1)[0]=l,new Uint32Array(this.data,4,1)[0]=s)}add(s,l){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=s,this.coords[this._pos++]=l,p}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return WR(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,l,p,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:v,nodeSize:w}=this,A=[0,_.length-1,0],k=[];for(;A.length;){const R=A.pop()||0,j=A.pop()||0,z=A.pop()||0;if(j-z<=w){for(let Q=z;Q<=j;Q++){const ee=v[2*Q],oe=v[2*Q+1];ee>=s&&ee<=p&&oe>=l&&oe<=m&&k.push(_[Q])}continue}const U=z+j>>1,q=v[2*U],X=v[2*U+1];q>=s&&q<=p&&X>=l&&X<=m&&k.push(_[U]),(R===0?s<=q:l<=X)&&(A.push(z),A.push(U-1),A.push(1-R)),(R===0?p>=q:m>=X)&&(A.push(U+1),A.push(j),A.push(1-R))}return k}within(s,l,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:_,nodeSize:v}=this,w=[0,m.length-1,0],A=[],k=p*p;for(;w.length;){const R=w.pop()||0,j=w.pop()||0,z=w.pop()||0;if(j-z<=v){for(let Q=z;Q<=j;Q++)$6(_[2*Q],_[2*Q+1],s,l)<=k&&A.push(m[Q]);continue}const U=z+j>>1,q=_[2*U],X=_[2*U+1];$6(q,X,s,l)<=k&&A.push(m[U]),(R===0?s-p<=q:l-p<=X)&&(w.push(z),w.push(U-1),w.push(1-R)),(R===0?s+p>=q:l+p>=X)&&(w.push(U+1),w.push(j),w.push(1-R))}return A}}function WR(u,s,l,p,m,_){if(m-p<=l)return;const v=p+m>>1;V6(u,s,v,p,m,_),WR(u,s,l,p,v-1,1-_),WR(u,s,l,v+1,m,1-_)}function V6(u,s,l,p,m,_){for(;m>p;){if(m-p>600){const k=m-p+1,R=l-p+1,j=Math.log(k),z=.5*Math.exp(2*j/3),U=.5*Math.sqrt(j*z*(k-z)/k)*(R-k/2<0?-1:1);V6(u,s,l,Math.max(p,Math.floor(l-R*z/k+U)),Math.min(m,Math.floor(l+(k-R)*z/k+U)),_)}const v=s[2*l+_];let w=p,A=m;for(dS(u,s,p,l),s[2*m+_]>v&&dS(u,s,p,m);w<A;){for(dS(u,s,w,A),w++,A--;s[2*w+_]<v;)w++;for(;s[2*A+_]>v;)A--}s[2*p+_]===v?dS(u,s,p,A):(A++,dS(u,s,A,m)),A<=l&&(p=A+1),l<=A&&(m=A-1)}}function dS(u,s,l,p){KR(u,l,p),KR(s,2*l,2*p),KR(s,2*l+1,2*p+1)}function KR(u,s,l){const p=u[s];u[s]=u[l],u[l]=p}function $6(u,s,l,p){const m=u-l,_=s-p;return m*m+_*_}
821r.$=bv,r.A=Ku,r.B=fp,r.C=2,r.D=bx,r.E=Gu,r.F=Ww,r.G=mV,r.H=xv,r.I=no,r.J=rw,r.K=wf,r.L=ly,r.M=Hv,r.N=qv,r.O=H1,r.P=Tt,r.Q=Zv,r.R=tp,r.S=Bf,r.T=rR,r.U=_u,r.V=xA,r.W=W1,r.X=Pf,r.Y=kf,r.Z=fy,r._=ya,r.a=function(u){return Vr.API_CDN_URL_REGEX.test(u)},r.a$=qf,r.a0=$i,r.a1=y1,r.a2=Uf,r.a3=class extends xA{},r.a4=Gv,r.a5=q1,r.a6=Ze,r.a7=function(u){const s=u.value;return s?$i(s)?RR(s,!0)?[]:[new xA(u.key,s,`invalid url "${s}"`)]:[new xA(u.key,s,`string expected, "${wf(s)}" found`)]:[]},r.a8=m2,r.a9=bs,r.aA=re,r.aB=G,r.aC=$t,r.aD=Ja,r.aE=vo,r.aF=se,r.aG=ct,r.aH=function(u,s){const l={};for(let p=0;p<s.length;p++){const m=s[p];m in u&&(l[m]=u[m])}return l},r.aI=F,r.aJ=ne,r.aK=class{constructor(u){this.entries={},this.scheduler=u}request(u,s,l,p){const m=this.entries[u]=this.entries[u]||{callbacks:[]};if(m.result){const[_,v]=m.result;return this.scheduler?this.scheduler.add(()=>{p(_,v)},s):p(_,v),()=>{}}return m.callbacks.push(p),m.cancel||(m.cancel=l((_,v)=>{m.result=[_,v];for(const w of m.callbacks)this.scheduler?this.scheduler.add(()=>{w(_,v)},s):w(_,v);setTimeout(()=>delete this.entries[u],3e3)})),()=>{m.result||(m.callbacks=m.callbacks.filter(_=>_!==p),m.callbacks.length||(m.cancel(),delete this.entries[u]))}}},r.aL=function(u,s,l){const p=JSON.stringify(u.request);return u.data&&(this.deduped.entries[p]={result:[null,u.data]}),this.deduped.request(p,{type:"parseTile",isSymbolTile:u.isSymbolTile,zoom:u.tileZoom},m=>{const _=yf(u.request,(v,w,A)=>{v?m(v):w&&m(null,{vectorTile:l?void 0:new li(new rA(w)),rawData:w,responseHeaders:new Map(A.entries())})});return()=>{_.cancel(),m()}},s)},r.aM=function(u){return u?{cacheControl:u.get("Cache-Control"),expires:u.get("Expires")}:{cacheControl:void 0,expires:void 0}},r.aN=function(u){mv++,mv>Xa&&(u.getActor().send("enforceCacheSizeLimit",Gg),mv=0)},r.aO=function(u){return u<=1?1:Math.pow(2,Math.floor(Math.log2(u)))},r.aP=po,r.aQ=qV,r.aR=XV,r.aS=H,r.aT=$V,r.aU=function(u,s){const l=document.createElement("video");l.muted=!0,l.onloadstart=function(){s(null,l)};for(let p=0;p<u.length;p++){const m=document.createElement("source");ir(u[p])||(l.crossOrigin="Anonymous"),m.src=u[p],l.appendChild(m)}return{cancel:()=>{}}},r.aV=Vw,r.aW=Uy,r.aX=Ve,r.aY=Yw,r.aZ=fe,r.a_=ue,r.aa=Nt,r.ab=class{constructor(u){this.specification=u}possiblyEvaluate(u,s){return Hn(u.expression.evaluate(s))}interpolate(u,s,l){return{x:Vi(u.x,s.x,l),y:Vi(u.y,s.y,l),z:Vi(u.z,s.z,l),azimuthal:Vi(u.azimuthal,s.azimuthal,l),polar:Vi(u.polar,s.polar,l)}}},r.ac=Rr,r.ad=th,r.ae=Ke,r.af=zi,r.ag=qt,r.ah=ge,r.ai=pp,r.aj=em,r.ak=Vi,r.al=Ft,r.am=iy,r.an=Pn,r.ao=lr,r.ap=class{constructor(u){this.specification=u}possiblyEvaluate(u,s){return function([l,p]){const m=Hn([1,l,p]);return{x:m.x,y:m.y,z:m.z}}(u.expression.evaluate(s))}interpolate(u,s,l){return{x:Vi(u.x,s.x,l),y:Vi(u.y,s.y,l),z:Vi(u.z,s.z,l)}}},r.aq=function(u,s,l=0,p=!0){const m=new Tt(l,l),_=u.sub(m),v=s.add(m),w=[_,new Tt(v.x,_.y),v,new Tt(_.x,v.y)];return p&&w.push(_.clone()),w},r.ar=function(u,s){const l=[];for(let p=0;p<u.length;p++){const m=ze(p-1,-1,u.length-1),_=ze(p+1,-1,u.length-1),v=u[p],w=u[_],A=u[m].sub(v).unit(),k=w.sub(v).unit(),R=k.angleWithSep(A.x,A.y),j=A.add(k).unit().mult(-1*s/Math.sin(R/2));l.push(v.add(j))}return l},r.as=IV,r.at=ms,r.au=function(u,s,l=0){return kt(((s.x-l)*u.scale-u.x)*Ft,(s.y*u.scale-u.y)*Ft,Ce(s.z,s.y))},r.av=Yn,r.aw=Ei,r.ax=dn,r.ay=VU,r.az=function(u){let s=1/0,l=1/0,p=-1/0,m=-1/0;for(const _ of u)s=Math.min(s,_.x),l=Math.min(l,_.y),p=Math.max(p,_.x),m=Math.max(m,_.y
vendor: 24,705 bytes, line 821
821);return{min:new Tt(s,l),max:new Tt(p,m)}},r.b=function(u){return Vr.API_FONTS_REGEX.test(u)},r.b$=GD,r.b0=Xr,r.b1=rt,r.b2=S2,r.b3=gA,r.b4=function(){gl.isLoading()||gl.isLoaded()||tw()!=="deferred"||iw()},r.b5=tx,r.b6=nt,r.b7=By,r.b8=_r,r.b9=hR,r.bA=we,r.bB=V,r.bC=function(u,s){const{x:l,y:p}=u.point,m=a5(l,p,u.worldSize/u._pixelsPerMercatorPixel,0,0);return G(m,m,DD(lh(s)))},r.bD=C,r.bE=Kr,r.bF=Hi,r.bG=Ci,r.bH=Xi,r.bI=Ai,r.bJ=kx,r.bK=ql,r.bL=xR,r.bM=function(u,s,l,p,m){const _=5*s+2;u.float32[_+0]=l,u.float32[_+1]=p,u.float32[_+2]=m},r.bN=Dx,r.bO=co,r.bP=Di,r.bQ=ia,r.bR=hu,r.bS=ze,r.bT=function(u,s,l,p){var m=new S(4);return m[0]=u,m[1]=s,m[2]=l,m[3]=p,m},r.bU=class{isDataAvailableAtPoint(u){const s=this._source();if(this.isUsingMockSource()||!s||u.y<0||u.y>1)return!1;const l=s.getSource().maxzoom,p=1<<l,m=Math.floor(u.x),_=Math.floor((u.x-m)*p),v=Math.floor(u.y*p),w=this.findDEMTileFor(new po(l,m,l,_,v));return!(!w||!w.dem)}getAtPointOrZero(u,s=0){return this.getAtPoint(u,s)||0}getAtPoint(u,s,l=!0){if(this.isUsingMockSource())return null;s==null&&(s=null);const p=this._source();if(!p||u.y<0||u.y>1)return s;const m=p.getSource().maxzoom,_=1<<m,v=Math.floor(u.x),w=u.x-v,A=new po(m,v,m,Math.floor(w*_),Math.floor(u.y*_)),k=this.findDEMTileFor(A);if(!k||!k.dem)return s;const R=k.dem,j=1<<k.tileID.canonical.z,z=(w*j-k.tileID.canonical.x)*R.dim,U=(u.y*j-k.tileID.canonical.y)*R.dim,q=Math.floor(z),X=Math.floor(U);return(l?this.exaggeration():1)*Vi(Vi(R.get(q,X),R.get(q,X+1),U-X),Vi(R.get(q+1,X),R.get(q+1,X+1),U-X),z-q)}static getAtTileOffset(u,s,l,p){const m=1<<u.canonical.z;return p?p.pointElevation(s):l?l.getAtPointOrZero(new Ke(u.wrap+(u.canonical.x+s.x/Ft)/m,(u.canonical.y+s.y/Ft)/m)):0}static getAtTileOffsetFunc(u,s,l,p){return(m,_,v)=>{const w=this.getAtTileOffset(u,m,_,v),A=p.upVector(u.canonical,m.x,m.y);return Ot(A,A,w*p.upVectorScale(u.canonical,s,l).metersToTile),A}}getForTilePoints(u,s,l,p){if(this.isUsingMockSource())return!1;const m=Rx.create(this,u,p);return!!m&&(s.forEach(_=>{_[2]=this.exaggeration()*m.getElevationAt(_[0],_[1],l)}),!0)}getMinMaxForTile(u){if(this.isUsingMockSource())return null;const s=this.findDEMTileFor(u);if(!s||!s.dem)return null;const l=s.dem.tree,p=s.tileID,m=1<<u.canonical.z-p.canonical.z;let _=u.canonical.x/m-p.canonical.x,v=u.canonical.y/m-p.canonical.y,w=0;for(let A=0;A<u.canonical.z-p.canonical.z&&!l.leaves[w];A++){_*=2,v*=2;const k=2*Math.floor(v)+Math.floor(_);w=l.childOffsets[w]+k,_%=1,v%=1}return{min:this.exaggeration()*l.minimums[w],max:this.exaggeration()*l.maximums[w]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(u,s,l){throw new Error("Pure virtual method called.")}pointCoordinate(u){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(u){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const u=this.visibleDemTiles;if(u.length===0)return null;let s=!1,l=Number.MAX_VALUE,p=Number.MIN_VALUE;for(const m of u){const _=this.getMinMaxForTile(m.tileID);_&&(l=Math.min(l,_.min),p=Math.max(p,_.max),s=!0)}return s?{min:l,max:p}:null}},r.bV=W2,r.bW=Ps,r.bX=zo,r.bY=O5,r.bZ=YV,r.b_=V5,r.ba=$D,r.bb=yt,r.bc=Qa,r.bd=cx,r.be=t5,r.bf=ls,r.bg=vx,r.bh=MR,r.bi=function(u,s){const l=em(s.zoom);if(l===0)return lh(u);const p=z2(u),m=MD(p),_=se(p.getWest())*s.worldSize,v=se(p.getEast())*s.worldSize,w=ne(p.getNorth())*s.worldSize,A=ne(p.getSouth())*s.worldSize,k=[_,w,0],R=[v,w,0],j=[_,A,0],z=[v,A,0],U=$([],s.globeMatrix);return zi(k,k,U),zi(R,R,U),zi(j,j,U),zi(z,z,U),m[0]=vp(m[0],j,l),m[1]=vp(m[1],z,l),m[2]=vp(m[2],R,l),m[3]=vp(m[3],k,l),gn.fromPoints(m)},r.bj=O2,r.bk=$,r.bl=Ew,r.bm=vp,r.bn=mp,r.bo=bde,r.bp=Ne,r.bq=te,r.br=IA,r.bs=rA,r.bt=yf,r.bu=function(u,s){const l=[];for(const p in u)p in s||l.push(p);return l},r.bv=Re,r.bw=["type","source","source-layer","minzoom","maxzoom","filter","layout"],r.bx=Nl,r.by=B,r.bz=W,r.c=ga,r.c$=function(u){return u*u*u*u*u},r.c0=_R,r.c1=wV,r.c2=CR,r.c3=GR,r.c4=Ot,r.c5=Ia,r.c6=wi,r.c7=function(u,s,l){l*=.5;var p=s[0],m=s[1],_=s[2],v=s[3],w=Math.sin(l),A=Math.cos(l);return u[0]=p*A+m*w,u[1]=m*A-p*w,u[2]=_*A+v*w,u[3]=v*A-_*w,u},r.c8=pi,r.c9=ps,r.cA=nr,r.cB=EU,r.cC=Ul,r.cD=r5,r.cE=function(u,s,l,p,m,_,v,w,A){if(A.name==="globe")return r5(u,s,new Ul(l,p,m),!1);const k=Yw({z:l,x:p,y:m},A);return new gn([(_+k.x/k.scale)*s,s*(k.y/k.scale),v],[(_+k.x2/k.scale)*s,s*(k.y2/k.scale),w])},r.cF=function(u,s,l){return u[0]=Math.min(s[0],l[0]),u[1]=Math.min(s[1],l[1]),u[2]=Math.min(s[2],l[2]),u[3]=Math.min(s[3],l[3]),u},r.cG=function(u,s,l){return u[0]=Math.max(s[0],l[0]),u[1]=Math.max(s[1],l[1]),u[2]=Math.max(s[2],l[2]),u[3]=Math.max(s[3],l[3]),u},r.cH=function(u){const s=Math.round((u+45+360)%360/90)%4;return Vc[s]},r.cI=me,r.cJ=ot,r.cK=a,r.cL=function(u){const s=W(new Float64Array(16));G(s,u.pixelMatrix,u.globeMatrix);const l=[0,T,0],p=[0,E,0];return zi(l,l,s),zi(p,p,s),[l[0]>0&&l[0]<=u.width&&l[1]>0&&l[1]<=u.height&&!jD(u,new H(u.center.lat,90)),p[0]>0&&p[0]<=u.width&&p[1]>0&&p[1]<=u.height&&!jD(u,new H(u.center.lat,-90))]},r.cM=function(u,s){const{scale:l}=u.tileTransform,p=l*Ft/(u.tileSize*Math.pow(2,s.zoom-u.tileID.overscaledZ+u.tileID.canonical.z));return function(m,_,v){var w=_[1],A=_[2],k=_[3],R=v[0],j=v[1];return m[0]=_[0]*R,m[1]=w*R,m[2]=A*j,m[3]=k*j,m}(new Float32Array(4),s.inverseAdjustmentMatrix,[p,p])},r.cN=Q2,r.cO=Je,r.cP=CU,r.cQ=function(u){const s=CU(u,!0);return C([],[s[0],s[1],s[4],s[5]])},r.cR=ce,r.cS=hr,r.cT=_e,r.cU=function(u){const{x:s,y:l}=u.point,{lng:p,lat:m}=u._center;return a5(s,l,u.worldSize,p,m)},r.cV=pt,r.cW=Ms,r.cX=Vl,r.cY=Ns,r.cZ=g,r.c_=function(u,s,l){let p=0;for(let m=0;m<2;++m)u[m]>0&&(p+=(u[m]-0)*(u[m]-0)),s[m]<0&&(p+=(0-s[m])*(0-s[m]));return p},r.ca=function(u,s){return u[0]=-s[0],u[1]=-s[1],u[2]=-s[2],u[3]=s[3],u},r.cb=De,r.cc=function(u,s,l,p,m){var _=1/Math.tan(s/2);if(u[0]=_/l,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=_,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,m!=null&&m!==1/0){var v=1/(p-m);u[10]=(m+p)*v,u[14]=2*m*p*v}else u[10]=-1,u[14]=-2*p;return u},r.cd=function(u,s,l,p,m,_,v){var w=1/(s-l),A=1/(p-m),k=1/(_-v);return u[0]=-2*w,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=-2*A,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=2*k,u[11]=0,u[12]=(s+l)*w,u[13]=(m+p)*A,u[14]=(v+_)*k,u[15]=1,u},r.ce=ae,r.cf=function(u,s,l){u[4*s+0]=l[0],u[4*s+1]=l[1],u[4*s+2]=l[2],u[4*s+3]=l[3]},r.cg=mx,r.ch=Xf,r.ci=Fs,r.cj=vu,r.ck=Ny,r.cl=DV,r.cm=function(){var u=new S(4);return S!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u},r.cn=function(u,s,l){var p=s[0],m=s[1],_=s[2],v=s[3],w=Math.sin(l),A=Math.cos(l);return u[0]=p*A+_*w,u[1]=m*A+v*w,u[2]=p*-w+_*A,u[3]=m*-w+v*A,u},r.co=function(u,s){return u[0]===s[0]&&u[1]===s[1]&&u[2]===s[2]&&u[3]===s[3]},r.cp=rs,r.cq=function(u){var s=u[0],l=u[1],p=u[2],m=u[3];return Math.sqrt(s*s+l*l+p*p+m*m)},r.cr=dl,r.cs=Sr,r.ct=xu,r.cu=3,r.cv=2,r.cw=7,r.cx=6,r.cy=Nn,r.cz=dt,r.d=function(u){return Vr.API_TILEJSON_REGEX.test(u)},r.d$=u5,r.d0=J,r.d1=45,r.d2=Py,r.d3=function(u,s,l){const p=Math.sqrt(u*u+s*s+l*l),m=p>0?Math.acos(l/p)*Wd:0;let _=u!==0||s!==0?Math.atan2(-s,-u)*Wd+90:0;return _<0&&(_+=360),[p,_,m]},r.d4=kt,r.d5=Hn,r.d6=ke,r.d7=Fe,r.d8=gn,r.d9=lt,r.dA=ww,r.dB=class extends Tc{constructor(u){super(u),this.current=ED}set(u,s,l){if(this.fetchUniformLocation(u,s)){for(let p=0;p<9;p++)if(l[p]!==this.current[p]){this.current=l,this.gl.uniformMatrix3fv(this.location,!1,l);break}}}},r.dC=Kd,r.dD=function(u,s,l){const p=em(l.zoom),m=u.style.map._antialias,_=u.terrain&&u.terrain.exaggeration()>0;return p===0&&!m&&!_},r.dE=function(u){const s=u.pixelsPerMeter,l=s/ae(1,u.center.lat),p=W(new Float64Array(16));return te(p,p,[u.point.x,u.point.y,0]),ce(p,p,[l,l,s]),Float32Array.from(p)},r.dF=z2,r.dG=function(u){const s=me-5;u=re(u,-s,s)/s*90;const l=Math.pow(Math.abs(Math.sin(Pn(u))),3);return Math.round(l*(b.length-1))},r.dH=function(u,s,l,p){const m=s.getNorth(),_=s.getSouth(),v=s.getWest(),w=s.getEast(),A=1<<u.z,k=w-v,R=m-_,j=k/y,z=-R/b[l],U=[0,j,0,z,0,0,m,v,0];if(u.z>0){const q=180/p;D(U,U,[q/k+1,0,0,0,q/R+1,0,-.5*q/j,.5*q/z,1])}return U[2]=A,U[5]=u.x,U[8]=u.y,U},r.dI=lh,r.dJ=function(u,s,l){const p=W(new Float64Array(16)),m=(s/(1<<u)-.5)*Math.PI*2;return Te(p,l.globeMatrix,m),Float32Array.from(p)},r.dK=x5,r.dL=j2,r.dM=function(u,s){return[Math.pow(u[0],2.2)*s,Math.pow(u[1],2.2)*s,Math.pow(u[2],2.2)*s]},r.dN=I,r.dO=function(u,s){var l=Math.sin(s),p=Math.cos(s);return u[0]=p,u[1]=l,u[2]=0,u[3]=-l,u[4]=p,u[5]=0,u[6]=0,u[7]=0,u[8]=1,u},r.dP=Gi,r.dQ=o5,r.dR=Ur,r.dS=fs,r.dT=256,r.dU=function(u,s){const l=[0,0,0];return zi(l,l,O2(lh(s.canonical))),zi(l,l,u),l},r.dV=u=>({u_matrix:new Ny(u),u_texsize:new vu(u),u_pixels_to_tile_units:new Sw(u),u_device_pixel_ratio:new Fs(u),u_width_scale:new Fs(u),u_floor_width_scale:new Fs(u),u_image:new mx(u),u_units_to_pixels:new vu(u),u_tile_units_to_pixels:new Fs(u),u_alpha_discard_threshold:new Fs(u),u_trim_offset:new vu(u),u_trim_fade_range:new vu(u),u_trim_color:new Py(u),u_emissive_strength:new Fs(u),u_zbias_factor:new Fs(u),u_tile_to_meter:new Fs(u),u_ground_shadow_factor:new Xf(u),u_pattern_transition:new Fs(u)}),r.dW=u=>({u_matrix:new Ny(u),u_pixels_to_tile_units:new Sw(u),u_device_pixel_ratio:new Fs(u),u_width_scale:new Fs(u),u_floor_width_scale:new Fs(u),u_units_to_pixels:new vu(u),u_dash_image:new mx(u),u_gradient_image:new mx(u),u_image_height:new Fs(u),u_texsize:new vu(u),u_tile_units_to_pixels:new Fs(u),u_alpha_discard_threshold:new Fs(u),u_trim_offset:new vu(u),u_trim_fade_range:new vu(u),u_trim_color:new Py(u),u_emissive_strength:new Fs(u),u_zbias_factor:new Fs(u),u_tile_to_meter:new Fs(u),u_ground_shadow_factor:new Xf(u)}),r.dX=u=>({u_camera_to_center_distance:new Fs(u),u_extrude_scale:new Sw(u),u_device_pixel_ratio:new Fs(u),u_matrix:new Ny(u),u_inv_rot_matrix:new Ny(u),u_merc_center:new vu(u),u_tile_id:new Xf(u),u_zoom_transition:new Fs(u),u_up_dir:new Xf(u),u_emissive_strength:new Fs(u)}),r.dY=Gf,r.dZ=lpe,r.d_=class{constructor(u,s,l,p){this.context=u,this.format=p,this.size=l,this.texture=u.gl.createTexture();const[m,_,v]=this.size,{gl:w}=u;w.bindTexture(w.TEXTURE_3D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in s&&s.data&&w.texImage3D(w.TEXTURE_3D,0,this.format,m,_,v,0,iR(this.format),nR(this.format),s.data)}bind(u,s){const{context:l}=this,{gl:p}=l;p.bindTexture(p.TEXTURE_3D,this.texture),u!==this.minFilter&&(p.texParameteri(p.TEXTURE_3D,p.TEXTURE_MAG_FILTER,u),p.texParameteri(p.TEXTURE_3D,p.TEXTURE_MIN_FILTER,u),this.minFilter=u),s!==this.wrapS&&(p.texParameteri(p.TEXTURE_3D,p.TEXTURE_WRAP_S,s),p.texParameteri(p.TEXTURE_3D,p.TEXTURE_WRAP_T,s),this.wrapS=s)}destroy(){const{gl:u}=this.context;u.deleteTexture(this.texture),this.texture=null}},r.da=function(u){return[Math.pow(u[0],1/2.2),Math.pow(u[1],1/2.2),Math.pow(u[2],1/2.2)]},r.db=TU,r.dc=uR,r.dd=kU,r.de=RR,r.df=function(u,s){return u.readFields(sfe,{icons:[]},s)},r.dg=K2,r.dh=Px,r.di=wR,r.dj=h1,r.dk=f2,r.dl=qg,r.dm=Jg,r.dn=It,r.dp=function(u){const s=u.indexOf(Ty);return s>=0?u.slice(0,s):u},r.dq=function(u){return u.indexOf(Ty)>=0},r.dr=function(u){const s=u.lastIndexOf(Ty);return s>=0?u.slice(s+1):""},r.ds=function(u){const s=[],l=u.id;return l===void 0&&s.push({message:`layers.${l}: missing required property "id"`}),u.render===void 0&&s.push({message:`layers.${l}: missing required method "render"`}),u.renderingMode&&u.renderingMode!=="2d"&&u.renderingMode!=="3d"&&s.push({message:`layers.${l}: property "renderingMode" must be either "2d" or "3d"`}),s},r.dt=function(u,s,l,p){return u.type==="custom"?new Qpe(u,s):new nfe[u.type](u,s,l,p)},r.du=Ye,r.dv=function(u){const s=u.indexOf(Ty);return s>=0?u.slice(s+1):""},r.dw=class extends By{constructor(u,s){super(u._vectorTileFeature,u._z,u._x,u._y,u.id),u.state&&(this.state=Object.assign({},u.state)),this.target=s.target,this.namespace=s.namespace,s.properties&&(this.properties=s.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=u.source,this.sourceLayer=u.sourceLayer,this.layer=u.layer)}toJSON(){const u=super.toJSON();return u.target=this.target,u.namespace=this.namespace,u}},r.dx=ew,r.dy=Wg,r.dz=function(u){return u({pluginStatus:Na,pluginURL:rh}),ew.on("pluginStateChange",u),u},r.e=Vr,r.e$=function([u,s,l]){const p=Math.hypot(u,s,l),m=Math.atan2(u,l),_=.5*Math.PI-Math.acos(-s/p);return new H(Ms(m),Ms(_))},r.e0=(u,s,l,p,m,_)=>{const v=u.transform,w=v.projection.name==="globe";let A;if(_.paint.get("circle-pitch-alignment")==="map")if(w){const R=o5(v.zoom,s.canonical)*v._pixelsPerMercatorPixel;A=Float32Array.from([R,0,0,R])}else A=v.calculatePixelsToTileUnitsMatrix(l);else A=new Float32Array([v.pixelsToGLUnits[0],0,0,v.pixelsToGLUnits[1]]);const k={u_camera_to_center_distance:u.transform.getCameraToCenterDistance(v.projection),u_matrix:u.translatePosMatrix(s.projMatrix,l,_.paint.get("circle-translate"),_.paint.get("circle-translate-anchor")),u_device_pixel_ratio:pl.devicePixelRatio,u_extrude_scale:A,u_inv_rot_matrix:Ede,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:_.paint.get("circle-emissive-strength")};if(w){k.u_inv_rot_matrix=p,k.u_merc_center=m,k.u_tile_id=[s.canonical.x,s.canonical.y,1<<s.canonical.z],k.u_zoom_transition=em(v.zoom);const R=m[0]*Ft,j=m[1]*Ft;k.u_up_dir=v.projection.upVector(new Ul(0,0,0),R,j)}return k},r.e1=GU,r.e2=Ya,r.e3=(u,s,l,p,m,_,v,w,A,k)=>{const R=u.transform,j=R.pitch<15?$U(.07,.7,re((14-R.zoom)/5,0,1)):.07,z=l.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:HU(u,s,l,p),u_texsize:s.imageAtlasTexture?s.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:R.calculatePixelsToTileUnitsMatrix(s),u_device_pixel_ratio:m,u_width_scale:_,u_floor_width_scale:v,u_image:0,u_tile_units_to_pixels:qU(s,R),u_units_to_pixels:[1/R.pixelsToGLUnits[0],1/R.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:w,u_trim_fade_range:l.paint.get("line-trim-fade-range"),u_trim_color:l.paint.get("line-trim-color").toPremultipliedRenderColor(z?null:l.lut).toArray01(),u_emissive_strength:l.paint.get("line-emissive-strength"),u_zbias_factor:j,u_tile_to_meter:ke(s.tileID.canonical,0),u_ground_shadow_factor:A,u_pattern_transition:k}},r.e4=(u,s,l,p,m,_,v,w,A,k)=>{const R=u.transform,j=R.calculatePixelsToTileUnitsMatrix(s),z=l.paint.get("line-trim-color-use-theme").constantOr("default")==="none",U=R.pitch<15?$U(.07,.7,re((14-R.zoom)/5,0,1)):.07;return{u_matrix:HU(u,s,l,p),u_pixels_to_tile_units:j,u_device_pixel_ratio:_,u_width_scale:v,u_floor_width_scale:w,u_units_to_pixels:[1/R.pixelsToGLUnits[0],1/R.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:m,u_texsize:WU(l)&&s.lineAtlasTexture?s.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:qU(s,u.transform),u_alpha_discard_threshold:0,u_trim_offset:A,u_trim_fade_range:l.paint.get("line-trim-fade-range"),u_trim_color:l.paint.get("line-trim-color").toPremultipliedRenderColor(z?null:l.lut).toArray01(),u_emissive_strength:l.paint.get("line-emissive-strength"),u_zbias_factor:U,u_tile_to_meter:ke(s.tileID.canonical,0),u_ground_shadow_factor:k}},r.e5=He,r.e6=Aw,r.e7=Ce,r.e8=_p,r.e9=G2,r.eA=LR,r.eB=tA,r.eC=eA,r.eD=[1,1,1],r.eE=Rx,r.eF=Qs,r.eG=function(u,s,l,p){var m=s[0],_=s[1],v=s[2],w=s[3];return u[0]=m+p*(l[0]-m),u[1]=_+p*(l[1]-_),u[2]=v+p*(l[2]-v),u[3]=w+p*(l[3]-w),u},r.eH=Cx,r.eI=Sc,r.eJ=ah,r.eK=function(u,s,l,p,m,_,v,w,A,k,R,j,z,U,q,X){var Q=new S(16);return Q[0]=u,Q[1]=s,Q[2]=l,Q[3]=p,Q[4]=m,Q[5]=_,Q[6]=v,Q[7]=w,Q[8]=A,Q[9]=k,Q[10]=R,Q[11]=j,Q[12]=z,Q[13]=U,Q[14]=q,Q[15]=X,Q},r.eL=L,r.eM=mw,r.eN=Ey,r.eO=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Tt(1/0,1/0),max:new Tt(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(u,s=!1){const l=B5(new Tt(0,0),new Tt(Ft,Ft),u),p=[];if(s&&!qD(l,this._globalClipBounds))return p;for(const m of this._activeRegions){if(m.hiddenByOverlap||!qD(l,m))continue;const _=the(m.min,m.max,u);p.push({min:_.min,max:_.max,sourceId:this._sourceIds[m.priority],footprint:m.footprint,footprintTileId:m.tileId,order:m.order,clipMask:m.clipMask,clipScope:m.clipScope})}return p}setSources(u){this._setSources(u.map(s=>({getSourceId:()=>s.cache.id,getFootprints:()=>{const l=[];for(const p of s.cache.getVisibleCoordinates()){const m=s.cache.getTile(p).buckets[s.layer];m&&m.updateFootprints(p.toUnwrapped(),l)}return l},getOrder:()=>s.order,getClipMask:()=>s.clipMask,getClipScope:()=>s.clipScope})))}_addSource(u){const s=u.getFootprints();if(s.length===0)return;const l=u.getOrder(),p=u.getClipMask(),m=u.getClipScope();for(const _ of s){if(!_.footprint)continue;const v=B5(_.footprint.min,_.footprint.max,_.id);this._activeRegions.push({min:v.min,max:v.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:_.id,footprint:_.footprint,order:l,clipMask:p,clipScope:m})}this._sourceIds.push(u.getSourceId())}_computeReplacement(){this._activeRegions.sort((s,l)=>s.priority-l.priority||$2(s.min,l.min)||$2(s.max,l.max)||s.order-l.order||s.clipMask-l.clipMask||function(p,m){const _=(v,w)=>v+w;return p.length-m.length||p.reduce(_,"").localeCompare(m.reduce(_,""))}(s.clipScope,l.clipScope));let u=this._activeRegions.length!==this._prevRegions.length;if(!u){let s=0;for(;!u&&s!==this._activeRegions.length;){const l=this._activeRegions[s],p=this._prevRegions[s];u=l.priority!==p.priority||!F5(l,p)||l.order!==p.order||l.clipMask!==p.clipMask||!Nl(l.clipScope,p.clipScope),this._activeRegions[s].hiddenByOverlap=p.hiddenByOverlap,++s}}if(u){++this._updateTime;for(const l of this._activeRegions)l.order!==Dw&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,l.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,l.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,l.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,l.max.y));const s=l=>{const p=this._activeRegions;if(l>=p.length)return l;const m=p[l].priority;for(;l<p.length&&p[l].priority===m;)++l;return l};if(this._sourceIds.length>1){let l=0,p=s(l);for(;l!==p;){let m=l;const _=l;for(;m!==p;){const v=this._activeRegions[m];v.hiddenByOverlap=!1;for(let w=0;w<_;w++){const A=this._activeRegions[w];if(!A.hiddenByOverlap&&v.order===Dw&&qD(v,A)&&(v.hiddenByOverlap=U5(v.footprint,v.tileId,A.footprint,A.tileId),v.hiddenByOverlap))break}++m}l=p,p=s(l)}}}}_setSources(u){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let s=u.length-1;s>=0;s--)this._addSource(u[s]);this._computeReplacement()}},r.eP=Dw,r.eQ=class{constructor(u){this._createGrid(u),this._createPoles(u)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const u of this._poleSegments)u.destroy();for(const u of this._gridSegments)u.withSkirts.destroy(),u.withoutSkirts.destroy()}_fillGridMeshWithLods(u,s){const l=new Qa,p=new Xr,m=[],_=u+1+2,v=s[0]+1,w=s[0]+1+(1+s.length),A=(k,R,j)=>{let z=k===_-1?k-2:k===0?k:k-1;return z+=j?24575:0,[z,R]};for(let k=0;k<_;++k)l.emplaceBack(...A(k,0,!0));for(let k=0;k<v;++k)for(let R=0;R<_;++R)l.emplaceBack(...A(R,k,(R===0||R===_-1)&&!0));for(let k=0;k<s.length;++k){const R=s[k];for(let j=0;j<_;++j)l.emplaceBack(...A(j,R,!0))}for(let k=0;k<s.length;++k){const R=p.length,j=s[k]+1+2,z=new Xr;for(let X=0;X<j-1;X++){const Q=X===j-2,ee=Q?_*(w-s.length+k-X):_;for(let oe=0;oe<_-1;oe++){const le=X*_+oe;X===0||Q||oe===0||oe===_-2?(z.emplaceBack(le+1,le,le+ee),z.emplaceBack(le+ee,le+ee+1,le+1)):(p.emplaceBack(le+1,le,le+ee),p.emplaceBack(le+ee,le+ee+1,le+1))}}const U=ls.simpleSegment(0,R,l.length,p.length-R);for(let X=0;X<z.uint16.length;X+=3)p.emplaceBack(z.uint16[X],z.uint16[X+1],z.uint16[X+2]);const q=ls.simpleSegment(0,R,l.length,p.length-R);m.push({withoutSkirts:U,withSkirts:q})}return{vertices:l,indices:p,segments:m}}_createGrid(u){const s=this._fillGridMeshWithLods(y,b);this._gridSegments=s.segments,this._gridBuffer=u.createVertexBuffer(s.vertices,t5.members),this._gridIndexBuffer=u.createIndexBuffer(s.indices,!0)}_createPoles(u){const s=new Xr;for(let v=0;v<=y;v++)s.emplaceBack(0,v+1,v+2);this._poleIndexBuffer=u.createIndexBuffer(s,!0);const l=new yp,p=new yp,m=new yp,_=new yp;this._poleSegments=[];for(let v=0,w=0;v<g;v++){const A=360/(1<<v);l.emplaceBack(0,-Ja,0,.5,0),p.emplaceBack(0,-Ja,0,.5,1),m.emplaceBack(0,-Ja,0,.5,.5),_.emplaceBack(0,-Ja,0,.5,.5);for(let k=0;k<=y;k++){let R=k/y,j=0;const z=Vi(0,A,R),[U,q,X]=P(Tde,Cde,z,Ja);l.emplaceBack(U,q,X,R,j),p.emplaceBack(U,q,X,R,1-j);const Q=Pn(z);R=.5+.5*Math.sin(Q),j=.5+.5*Math.cos(Q),m.emplaceBack(U,q,X,R,j),_.emplaceBack(U,q,X,R,1-j)}this._poleSegments.push(ls.simpleSegment(w,0,66,64)),w+=66}this._poleNorthVertexBuffer=u.createVertexBuffer(l,_x,!1),this._poleSouthVertexBuffer=u.createVertexBuffer(p,_x,!1),this._texturedPoleNorthVertexBuffer=u.createVertexBuffer(m,_x,!1),this._texturedPoleSouthVertexBuffer=u.createVertexBuffer(_,_x,!1)}getGridBuffers(u,s){return[this._gridBuffer,this._gridIndexBuffer,s?this._gridSegments[u].withSkirts:this._gridSegments[u].withoutSkirts]}getPoleBuffers(u,s){return[s?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,s?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[u]]}},r.eR=L5,r.eS=We,r.eT=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},r.eU=ie,r.eV=ve,r.eW=function(u,s,l){return u[0]=s[0]/l[0],u[1]=s[1]/l[1],u[2]=s[2]/l[2],u},r.eX=Ys,r.eY=M,r.eZ=si,r.e_=Vt,r.ea=iU,r.eb=im,r.ec=G5,r.ed=H5,r.ee=Se,r.ef=function(u,s){if(u===s){var l=s[1],p=s[2],m=s[3],_=s[6],v=s[7],w=s[11];u[1]=s[4],u[2]=s[8],u[3]=s[12],u[4]=l,u[6]=s[9],u[7]=s[13],u[8]=p,u[9]=_,u[11]=s[14],u[12]=m,u[13]=v,u[14]=w}else u[0]=s[0],u[1]=s[4],u[2]=s[8],u[3]=s[12],u[4]=s[1],u[5]=s[5],u[6]=s[9],u[7]=s[13],u[8]=s[2],u[9]=s[6],u[10]=s[10],u[11]=s[14],u[12]=s[3],u[13]=s[7],u[14]=s[11],u[15]=s[15];return u},r.eg=Ype,r.eh=wn,r.ei=yw,r.ej=256,r.ek=DD,r.el=Ll,r.em=Te,r.en=function(u,s){return u[0]=s[0],u[1]=s[1],u[2]=s[2],u[3]=s[4],u[4]=s[5],u[5]=s[6],u[6]=s[8],u[7]=s[9],u[8]=s[10],u},r.eo=yp,r.ep=fw,r.eq=a2,r.er=function(u,s,l,p,m){return re((u-s)/(l-s)*(m-p)+p,p,m)},r.es=en,r.et=function(u,s){var l=s[0],p=s[1],m=s[2],_=s[3],v=s[4],w=s[5],A=s[6],k=s[7],R=s[8],j=R*v-w*k,z=-R*_+w*A,U=k*_-v*A,q=l*j+p*z+m*U;return q?(u[0]=j*(q=1/q),u[1]=(-R*p+m*k)*q,u[2]=(w*p-m*v)*q,u[3]=z*q,u[4]=(R*l-m*A)*q,u[5]=(-w*l+m*_)*q,u[6]=U*q,u[7]=(-k*l+p*A)*q,u[8]=(v*l-p*_)*q,u):null},r.eu=2,r.ev=Oi,r.ew=Li,r.ex=Pe,r.ey=function(u,s){var l=new S(3);Pe(l,s);var p=1/l[0],m=1/l[1],_=1/l[2],v=s[0]*p,w=s[1]*m,A=s[2]*_,k=s[4]*p,R=s[5]*m,j=s[6]*_,z=s[8]*p,U=s[9]*m,q=s[10]*_,X=v+R+q,Q=0;return X>0?(Q=2*Math.sqrt(X+1),u[3]=.25*Q,u[0]=(j-U)/Q,u[1]=(z-A)/Q,u[2]=(w-k)/Q):v>R&&v>q?(Q=2*Math.sqrt(1+v-R-q),u[3]=(j-U)/Q,u[0]=.25*Q,u[1]=(w+k)/Q,u[2]=(z+A)/Q):R>q?(Q=2*Math.sqrt(1+R-v-q),u[3]=(z-A)/Q,u[0]=(w+k)/Q,u[1]=.25*Q,u[2]=(j+U)/Q):(Q=2*Math.sqrt(1+q-v-R),u[3]=(w-k)/Q,u[0]=(z+A)/Q,u[1]=(j+U)/Q,u[2]=.25*Q),u},r.ez=function(u,s){var l=2*Math.acos(s[3]),p=Math.sin(l/2);return p>x?(u[0]=s[0]/p,u[1]=s[1]/p,u[2]=s[2]/p):(u[0]=1,u[1]=0,u[2]=0),l},r.f=function(u){return btoa(encodeURIComponent(u).replace(/%([0-9A-F]{2})/g,(s,l)=>String.fromCharCode(+("0x"+l))))},r.f0=Pt,r.f1=sR,r.f2=function(u){const s=u.navigator?u.navigator.userAgent:null;return!!function(l){if(xs==null){const p=l.navigator?l.navigator.userAgent:null;xs=!!l.safari||!(!p||!(/\b(iPad|iPhone|iPod)\b/.test(p)||p.match("Safari")&&!p.match("Chrome")))}return xs}(u)&&!(!s||!(s.match("Version/15.4")||s.match("Version/15.5")||s.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},r.f3=function(u,s){Gg=u,Xa=s},r.f4=jD,r.f5=l5,r.f6=function(u){const s=[0,0,0],l=W(new Float64Array(16));return G(l,u.pixelMatrix,u.globeMatrix),zi(s,s,l),new Tt(s[0],s[1])},r.f7=function(){const u=Fw;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(YD),Fw=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()"))},r.f8=function(){K2().acquire(YD)},r.f9=tw,r.fA=wt,r.fB=function(u){let s=0;
821if(new Uint32Array(u,0,1)[0]!==vU){const l=new Uint32Array(u,0,7),[,,p,m,_,v]=l;s=l.byteLength+m+_+v+_,(p!==u.byteLength||s>=u.byteLength)&&di("Invalid b3dm header information.")}return SU(u,s)},r.fC=function(u,s){const l=uR(u);for(const p of l){for(const m of p.meshes)Mhe(m);p.lights&&(p.lightMeshIndex=p.meshes.length,p.meshes.push(Dhe(p.lights,s)))}return l},r.fD=bA,r.fE=Zr,r.fF=fU,r.fG=gl,r.fH=ml,r.fI=function(u){ep(),Pa!=null&&Pa.then(s=>{s.keys().then(l=>{for(let p=0;p<l.length-u;p++)s.delete(l[p]).catch(m=>di(m.message))}).catch(l=>di(l.message))}).catch(s=>di(s.message))},r.fa=function(u,s,l=!1){if(Na===ml.deferred||Na===ml.loading||Na===ml.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");rh=pl.resolveURL(u),Na=ml.deferred,Q1=s,J1(),l||iw()},r.fb=function(u){wx=pl.resolveURL(u),Sx||(Sx=new bx(K2(),new Gu)),Sx.broadcast("setMeshoptUrl",wx)},r.fc=yU,r.fd=function(u){JD=pl.resolveURL(u),Sx||(Sx=new bx(K2(),new Gu)),Sx.broadcast("setDracoUrl",JD)},r.fe=gU,r.ff=Ow,r.fg=function(u){const s=Hu();if(!s)return;const l=s.delete(Hg);u&&l.then(()=>u()).catch(u)},r.fh=jy,r.fi=ri,r.fj=tm,r.fk=od,r.fl=O6,r.fm=F6,r.fn=FU,r.fo=Yt,r.fp="hd_road_elevation",r.fq=Ki,r.fr=Ee,r.fs=xp,r.ft=bR,r.fu=Oy,r.fv=function(u,s,l,p,m,_,v,w=1,A,k,R){u.createArrays(),u.tilePixelRatio=Ft/(512*u.overscaling),u.compareText={},u.iconsNeedLinear=!1;const j=u.layers[0].layout,z=u.layers[0]._unevaluatedLayout._values,U={};U.scaleFactor=w,U.textSizeScaleRange=j.get("text-size-scale-range"),U.iconSizeScaleRange=j.get("icon-size-scale-range");const[q,X]=U.textSizeScaleRange,[Q,ee]=U.iconSizeScaleRange;U.textScaleFactor=re(U.scaleFactor,q,X),U.iconScaleFactor=re(U.scaleFactor,Q,ee);const oe=z["text-size"],le=z["icon-size"];if(u.textSizeData.kind==="composite"){const{minZoom:Be,maxZoom:ut}=u.textSizeData;U.compositeTextSizes=[oe.possiblyEvaluate(new Rr(Be,{worldview:R}),_),oe.possiblyEvaluate(new Rr(ut,{worldview:R}),_)]}if(u.iconSizeData.kind==="composite"){const{minZoom:Be,maxZoom:ut}=u.iconSizeData;U.compositeIconSizes=[le.possiblyEvaluate(new Rr(Be,{worldview:R}),_),le.possiblyEvaluate(new Rr(ut,{worldview:R}),_)]}U.layoutTextSize=oe.possiblyEvaluate(new Rr(v+1,{worldview:R}),_),U.layoutIconSize=le.possiblyEvaluate(new Rr(v+1,{worldview:R}),_),U.textMaxSize=oe.possiblyEvaluate(new Rr(18,{worldview:R}),_);const de=j.get("symbol-placement"),Ae=j.get("text-rotation-alignment")==="map"&&de!=="point",xe=j.get("text-size");let Me=!1;const Le=[];for(const Be of u.features){const ut=j.get("text-font").evaluate(Be,{},_).join(","),Xe=xe.evaluate(Be,{},_)*U.textScaleFactor,ht=U.layoutTextSize.evaluate(Be,{},_)*U.textScaleFactor,_t=U.layoutIconSize.evaluate(Be,{},_)*U.iconScaleFactor,bt={horizontal:{},vertical:void 0},zt=Be.text;let Et,vt=[0,0];if(zt){const yn=zt.toString(),Un=j.get("text-letter-spacing").evaluate(Be,{},_)*zo,sn=j.get("text-line-height").evaluate(Be,{},_)*zo,Qn=h2(yn)?Un:0,Jn=j.get("text-anchor").evaluate(Be,{},_),is=j.get("text-variable-anchor");if(!is){const mt=j.get("text-radial-offset").evaluate(Be,{},_);if(mt)vt=wV(Jn,[mt*zo,TR]);else{const Gt=j.get("text-offset").evaluate(Be,{},_);vt=[Gt[0]*zo,Gt[1]*zo]}}let be=Ae?"center":j.get("text-justify").evaluate(Be,{},_);const ye=de==="point",ft=ye?j.get("text-max-width").evaluate(Be,{},_)*zo:1/0,Ut=mt=>{u.allowVerticalPlacement&&Z1(yn)&&(bt.vertical=yR(zt,s,l,m,ut,ft,sn,Jn,mt,Qn,vt,ql.vertical,!0,ht,Xe,A))};if(!Ae&&is){const mt=be==="auto"?is.map(yi=>CR(yi)):[be];let Gt=!1;for(let yi=0;yi<mt.length;yi++){const fi=mt[yi];if(!bt.horizontal[fi])if(Gt)bt.horizontal[fi]=bt.horizontal[0];else{const cn=yR(zt,s,l,m,ut,ft,sn,"center",fi,Qn,vt,ql.horizontal,!1,ht,Xe,A);cn&&(bt.horizontal[fi]=cn,Gt=cn.positionedLines.length===1)}}Ut("left")}else{if(be==="auto"&&(be=CR(Jn)),ye||j.get("text-writing-mode").indexOf("horizontal")>=0||!Z1(yn)){const mt=yR(zt,s,l,m,ut,ft,sn,Jn,be,Qn,vt,ql.horizontal,!1,ht,Xe,A);mt&&(bt.horizontal[be]=mt)}Ut(ye?"left":be)}}let Ct,at,st,St,Dt,xt,ni=!1;const ai=j.get("icon-text-fit").evaluate(Be,{},_);if(Be.icon&&Be.icon.hasPrimary()){const yn=Zw(Be.icon,u.iconSizeData,z["icon-size"],_,u.zoom,Be,A,U.iconScaleFactor,R);Ct=yn.iconPrimary,st=yn.iconSecondary;const Un=Ct.toString();if(at=p.get(Un),at&&(Dt=j.get("icon-offset").evaluate(Be,{},_),xt=j.get("icon-anchor").evaluate(Be,{},_),Et=oA(m.get(Un),st?m.get(st.toString()):void 0,Dt,xt),ni=at.sdf,u.sdfIcons===void 0?u.sdfIcons=at.sdf:u.sdfIcons!==at.sdf&&di("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(at.pixelRatio!==u.pixelRatio||j.get("icon-rotate").constantOr(1)!==0)&&(u.iconsNeedLinear=!0)),st){const sn=st.toString();St=p.get(sn)}}Me=Me||!(!Be.icon||!Be.icon.hasSecondary());const Qt=ER(bt.horizontal)||bt.vertical;u.iconsInText||(u.iconsInText=!!Qt&&Qt.iconsInText);const Ht=ht*U.textScaleFactor/zo,{defaultShapedIcon:Zi,verticallyShapedIcon:Kt}=Lpe(u,Et,j,Be,_,bt,Ht,Dt,ai);ai!=="none"&&Et&&(aV(Et)||lV(Et))&&(dA(0,at,Ct,Et,Zi,ai,k,p,m),dA(0,St,st,Et,Zi,ai,k,p,m),Kt&&(dA(0,at,Ct,Et,Kt,ai,k,p,m),dA(0,St,st,Et,Kt,ai,k,p,m))),Et=Zi;const{iconBBox:Ii,iconVerticalBBox:tn}=Rpe(u,Et,Kt,j,Be,_,_t,Dt,U,m,xt);Le.push({feature:Be,shapedTextOrientations:bt,shapedText:Qt,shapedIcon:Et,iconPrimary:Ct,iconSecondary:st,iconOffset:Dt,iconA
821nchor:xt,verticallyShapedIcon:Kt,layoutTextSize:ht,layoutIconSize:_t,textOffset:vt,isSDFIcon:ni,iconTextFit:ai,iconCollisionBounds:Ii,iconVerticalCollisionBounds:tn})}return{featureData:Le,sizes:U,hasAnySecondaryIcon:Me,textAlongLine:Ae,symbolPlacement:de}},r.fw=gV,r.fx=function(u,s,l,p,m,_,v,w,A,k){u.iconAtlasPositions=k.iconPositions;const{featureData:R,hasAnySecondaryIcon:j,sizes:z,textAlongLine:U,symbolPlacement:q}=s;for(const X of R){const{shapedIcon:Q,verticallyShapedIcon:ee,feature:oe,shapedTextOrientations:le,shapedText:de,layoutTextSize:Ae,textOffset:xe,isSDFIcon:Me,iconPrimary:Le,iconSecondary:Be,iconTextFit:ut,iconOffset:Xe,iconCollisionBounds:ht,iconVerticalCollisionBounds:_t}=X;TV(Q,k.iconPositions,Le,Be),TV(ee,k.iconPositions,Le,Be),zpe(le,k.iconPositions),jpe(Le,Be,k.iconPositions),(de||Q)&&Ope(u,oe,le,Q,ee,A,z,Ae,0,xe,Me,p,m,v,w,j,ut,Xe,U,q,ht,_t)}l&&u.generateCollisionDebugBuffers(_,u.collisionBoxArray,z.textScaleFactor)},r.fy=li,r.fz=AA,r.g=function(u,s){return Wg(Object.assign(u,{method:"GET"}),s)},r.h=function(u){return u.indexOf("mapbox:")===0},r.i=function(u){return Vr.API_STYLE_REGEX.test(u)&&!ga(u)},r.j=io,r.k=gv,r.l=function(u){return decodeURIComponent(atob(u).split("").map(s=>"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)).join(""))},r.m=function(u,s){return Wg(Object.assign(u,{type:"json"}),s)},r.n=f1,r.o=pl,r.p=function(u,s){return Wg(Object.assign(u,{method:"POST"}),s)},r.q=oa,r.r=hl,r.s=function(u){try{const s=self[u];return s.setItem("_mapbox_test_",1),s.removeItem("_mapbox_test_"),!0}catch{return!1}},r.t=function(){return QD||(QD=new jy),QD},r.u=function(){return function u(s){return s?(s^Math.random()*(16>>s/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,u)}()},r.v=function(u){return!!u&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(u)},r.w=di,r.x=VR,r.y=ey,r.z=Dl}),c(["./shared"],function(r){function x(We){const ie=We?We.url.toString():void 0;return ie?performance.getEntriesByName(ie):[]}function S(We){if(typeof We=="number"||typeof We=="boolean"||typeof We=="string"||We==null)return JSON.stringify(We);if(Array.isArray(We)){let re="[";for(const ge of We)re+=`${S(ge)},`;return`${re}]`}let ie="{";for(const re of Object.keys(We).sort())ie+=`${re}:${S(We[re])},`;return`${ie}}`}function C(We){let ie="";for(const re of r.bw)ie+=`/${S(We[re])}`;return ie}class I{constructor(ie){this.keyCache={},this._layers={},this._layerConfigs={},ie&&this.replace(ie)}replace(ie,re){this._layerConfigs={},this._layers={},this.update(ie,[],re)}update(ie,re,ge){this._options=ge;for(const Re of ie)this._layerConfigs[Re.id]=Re,(this._layers[Re.id]=r.dt(Re,this.scope,null,this._options)).compileFilter(ge),this.keyCache[Re.id]&&delete this.keyCache[Re.id];for(const Re of re)delete this.keyCache[Re],delete this._layerConfigs[Re],delete this._layers[Re];this.familiesBySource={};const ze=function(Re,Ue){const rt={};for(let Ve=0;Ve<Re.length;Ve++){const Ee=Re[Ve];let Ye=Ue&&Ue[Ee.id];Ye||(Ee.type==="symbol"?Ye=Ee.id:(Ye=C(Ee),Ee.type==="line"&&Ee.paint&&function vi(bi){return typeof bi=="string"&&bi==="line-progress"||(Array.isArray(bi)?bi.some(vi):!(!bi||typeof bi!="object")&&Object.values(bi).some(vi))}(Ee.paint["line-width"])&&(Ye+=`/${S(Ee.paint["line-width"])}`))),Ue&&(Ue[Ee.id]=Ye);let It=rt[Ye];It||(It=rt[Ye]=[]),It.push(Ee)}const He=[];for(const Ve in rt)He.push(rt[Ve]);return He}(Object.values(this._layerConfigs),this.keyCache);for(const Re of ze){const Ue=Re.map(It=>this._layers[It.id]),rt=Ue[0];if(rt.visibility==="none")continue;const He=rt.source||"";let Ve=this.familiesBySource[He];Ve||(Ve=this.familiesBySource[He]={});const Ee=rt.sourceLayer||"_geojsonTileLayer";let Ye=Ve[Ee];Ye||(Ye=Ve[Ee]=[]),Ye.push(Ue)}}}const N=1*r.fk;class D{constructor(ie){const re={},ge=[];for(const rt in ie){const He=ie[rt],Ve=re[rt]={};for(const Ee in He.glyphs){const Ye=He.glyphs[+Ee];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const It=Ye.metrics.localGlyph?N:1,vi={x:0,y:0,w:Ye.bitmap.width+2*It,h:Ye.bitmap.height+2*It};ge.push(vi),Ve[Ee]=vi}}const{w:ze,h:Re}=r.G(ge),Ue=new r.fj({width:ze||1,height:Re||1});for(const rt in ie){const He=ie[rt];for(const Ve in He.glyphs){const Ee=He.glyphs[+Ve];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;const Ye=re[rt][Ve],It=Ee.metrics.localGlyph?N:1;r.fj.copy(Ee.bitmap,Ue,{x:0,y:0},{x:Ye.x+It,y:Ye.y+It},Ee.bitmap)}}this.image=Ue,this.positions=re}}function V(We,ie,re){We[ie]?re&&(We[ie].center=re):We[ie]={floorIds:new Set,center:re||[0,0],floors:{}}}function B(We,ie,re,ge){for(const ze of ie)V(We,ze),We[ze].floors[re]=ge,We[ze].floorIds.add(re)}function W(We){return{id:We.properties.id.toString(),center:We.properties.center.toString().split(";").map(Number)}}function $(We){return{id:We.properties.id.toString(),isDefault:!!We.properties.is_default&&We.properties.is_default,connections:We.properties.connected_floor_ids?new Set(We.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:We.properties.conflicted_floor_ids?new Set(We.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:We.properties.building_ids?new Set(We.properties.building_ids.toString().split(";")):new Set,name:We.properties.name.toString(),zIndex:We.properties.z_index}}function G(We,ie){return ie.every(re=>We.properties&&We.properties[re]!=null)}function te(We){return G(We,["type","id","name"])&&We.properties.type==="building"}function ce(We){return G(We,["type","id","name","z_index"])&&We.properties.type==="floor"}r.fi(D,"GlyphAtlas");class _e{constructor(ie){this.tileID=new r.aP(ie.tileID.overscaledZ,ie.tileID.wrap,ie.tileID.canonical.z,ie.tileID.canonical.x,ie.tileID.canonical.y),this.tileZoom=ie.tileZoom,this.uid=ie.uid,this.zoom=ie.zoom,this.lut=ie.lut,this.canonical=ie.tileID.canonical,this.pixelRatio=ie.pixelRatio,this.tileSize=ie.tileSize,this.source=ie.source,this.scope=ie.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ie.showCollisionBoxes,this.collectResourceTiming=!!ie.request&&ie.request.collectResourceTiming,this.promoteId=ie.promoteId,this.isSymbolTile=ie.isSymbolTile,this.tileTransform=r.aY(ie.tileID.canonical,ie.projection),this.projection=ie.projection,this.worldview=ie.worldview,this.localizableLayerIds=ie.localizableLayerIds,this.brightness=ie.brightness,this.extraShadowCaster=!!ie.extraShadowCaster,this.tessellationStep=ie.tessellationStep,this.scaleFactor=ie.scaleFactor,this.worldview=ie.worldview,this.indoor=ie.indoor}parse(ie,re,ge,ze,Re,Ue){this.status="parsing",this.data=ie,this.collisionBoxArray=new r.b2;
821const rt=new r.fl(Object.keys(ie.layers).sort()),He=new r.fm(this.tileID,this.promoteId);He.bucketLayerIDs=[];const Ve={},Ee=new r.fn(256,256),Ye={featureIndex:He,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Ee,availableImages:ge,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const di=this.indoor.indoorState.activeFloorsVisible,Wi=function(ln,Hn,Zr){const _r=function(fr,Mn){if(!fr)return r.w("No source layers defined in indoor specification"),Mn;if(fr.size===0)return Mn;const Ur=fr.difference(Mn);for(const fs of Ur)r.w(`Missing source layer required in indoor specification: ${fs}`);return Mn.intersection(Mn)}(Hn.sourceLayers,new Set(Object.keys(ln.layers))),xs=Hn.indoorState,ps=function(fr,Mn,Ur,fs){const Tr=new Set,Vr=new Set,io=new Set,ga=new Map,fc={},Jh=uo=>{const mc=ga.get(uo)||new Set;for(const ka of Tr)if((ga.get(ka)||new Set).has(uo)||mc.has(ka))return!0;return!1};for(const uo of Mn){const mc=fr.layers[uo];if(mc)for(let ka=0;ka<mc.length;ka++){const $c=mc.feature(ka);if(te($c)){const{id:hl,center:pl}=W($c);V(fc,hl,pl),Tr.add(hl)}else if(ce($c)){const{id:hl,isDefault:pl,connections:fv,conflicts:qg,buildings:Hg,name:Gg,zIndex:Xa}=$($c);B(fc,Hg,hl,{name:Gg,zIndex:Xa}),ga.set(hl,qg),(hl===fs||fv.has(fs))&&Tr.add(hl),Vr.add(hl),pl&&io.add(hl)}}else r.w(`indoor source layer not found: ${uo}`)}if(Ur)for(const uo of Ur)Vr.has(uo)&&(Jh(uo)||Tr.add(uo));for(const uo of io)Tr.has(uo)||Jh(uo)||Tr.add(uo);return{buildings:fc,activeFloors:Tr}}(ln,_r,xs.lastActiveFloors,xs.selectedFloorId);return Zr.send("setIndoorData",ps),ps}(ie,this.indoor,Re);Ye.activeFloors=di?Wi.activeFloors:void 0}const It=[],vi=re.familiesBySource[this.source];for(const di in vi){const Wi=ie.layers[di];if(!Wi)continue;let ln=!1,Hn=!1,Zr=!1;for(const fr of vi[di])fr[0].type==="symbol"?ln=!0:Hn=!0,fr[0].is3D()&&fr[0].type!=="model"&&(Zr=!0);if(this.extraShadowCaster&&!Zr||this.isSymbolTile===!0&&!ln||this.isSymbolTile===!1&&!Hn)continue;Wi.version===1&&r.w(`Vector tile source "${this.source}" layer "${di}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _r=rt.encode(di),xs=[];let ps=!1;for(let fr=0,Mn=0;fr<Wi.length;fr++){const Ur=Wi.feature(fr),fs=He.getId(Ur,di);if(this.localizableLayerIds&&this.localizableLayerIds.has(di)){const Tr=Ur.properties?Ur.properties.worldview:null;if(this.worldview&&typeof Tr=="string")if(Tr==="all")Ur.properties.$localized=!0;else{if(!Tr.split(",").includes(this.worldview))continue;Ur.properties.$localized=!0,Ur.properties.worldview=this.worldview}}!ps&&Ur.properties&&Ur.properties.hasOwnProperty(r.fo)&&(ps=!0),xs.push({feature:Ur,id:fs,index:Mn,sourceLayerIndex:_r}),Mn++}ps&&!Ye.elevationFeatures&&ie.layers.hasOwnProperty(r.fp)&&(Ye.elevationFeatures=r.fq.parseFrom(ie.layers[r.fp],this.canonical));for(const fr of vi[di]){const Mn=fr[0];if(this.extraShadowCaster&&(!Mn.is3D()||Mn.type==="model")||this.isSymbolTile!==void 0&&Mn.type==="symbol"!==this.isSymbolTile||Mn.minzoom&&this.zoom<Math.floor(Mn.minzoom)||Mn.maxzoom&&this.zoom>=Mn.maxzoom||Mn.visibility==="none")continue;Te(fr,this.zoom,Ye.brightness,ge,this.worldview);const Ur=Ve[Mn.id]=Mn.createBucket({index:He.bucketLayerIDs.length,layers:fr,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_r,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ze,worldview:this.worldview});He.bucketLayerIDs.push(fr.map(Tr=>r.B(Tr.id,Tr.scope)));let fs=Ur.prepare?Ur.prepare():null;fs!=null?(fs=fs.then(()=>Ur.populate(xs,Ye,this.tileID.canonical,this.tileTransform)),It.push(fs)):Ur.populate(xs,Ye,this.tileID.canonical,this.tileTransform)}}const bi=()=>{let di,Wi,ln,Hn,Zr,_r;Ee.trim();const xs={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},ps=()=>{if(di)return this.status="done",Ue(di);if(this.extraShadowCaster)this.status="done",Ue(null,{buckets:Object.values(Ve).filter(Mn=>!Mn.isEmpty()),featureIndex:He,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ye.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Wi&&ln&&Hn){const Mn=new D(Wi),Ur=new Map;for(const[Vr,io]of ln.entries()){const{imagePosition:ga}=r.ft(Vr,io,r.fu);Ur.set(Vr,ga)}const fs={};for(const Vr in Ve){const io=Ve[Vr];io instanceof r.b3&&(Te(io.layers,this.zoom,Ye.brightness,ge,this.worldview),fs[Vr]=r.fv(io,Wi,Mn.positions,ln,Ur,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Zr,this.worldview))}const Tr={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(Re,ln,Zr,()=>{Tr.iconsPending=!1,fr(fs,Mn,Tr)}),this.rasterizeIfNeeded(Re,Hn,_r,()=>{Tr.patternsPending=!1,fr(fs,Mn,Tr)})}}
821,fr=(Mn,Ur,fs,Tr)=>{if(fs.iconsPending||fs.patternsPending)return;const Vr=new r.fw(ln,Hn,this.lut);for(const io in Ve){const ga=Ve[io];if(io in Mn)r.fx(ga,Mn[io],this.showCollisionBoxes,ge,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,ln,Vr);else if(ga.hasPattern&&(ga instanceof r.b9||ga instanceof r.ba||ga instanceof r.e9)){Te(ga.layers,this.zoom,Ye.brightness,ge,this.worldview);const fc=Object.fromEntries(Vr.patternPositions);ga.addFeatures(Ye,this.tileID.canonical,fc,ge,this.tileTransform,this.brightness)}}this.status="done",Ue(null,{buckets:Object.values(Ve).filter(io=>!io.isEmpty()),featureIndex:He,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ur.image,lineAtlas:Ee,imageAtlas:Vr,brightness:Ye.brightness})};if(!this.extraShadowCaster){const Mn=r.fr(Ye.glyphDependencies,Tr=>Object.keys(Tr).map(Number));Object.keys(Mn).length?Re.send("getGlyphs",{uid:this.uid,stacks:Mn},(Tr,Vr)=>{di||(di=Tr,Wi=Vr,ps())},void 0,!1,xs):Wi={};const Ur=Array.from(Ye.iconDependencies.keys()).map(Tr=>r.I.parse(Tr));Ur.length?Re.send("getImages",{images:Ur,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Tr,Vr)=>{di||(di=Tr,ln=new Map,Zr=this.updateImageMapAndGetImageTaskQueue(ln,Vr,Ye.iconDependencies),ps())},void 0,!1,xs):(ln=new Map,Zr=new Map);const fs=Array.from(Ye.patternDependencies.keys()).map(Tr=>r.I.parse(Tr));fs.length?Re.send("getImages",{images:fs,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Tr,Vr)=>{di||(di=Tr,Hn=new Map,_r=this.updateImageMapAndGetImageTaskQueue(Hn,Vr,Ye.patternDependencies),ps())},void 0,!1,xs):(Hn=new Map,_r=new Map)}if(Ye.elevationFeatures&&Ye.elevationFeatures.length>0){const Mn=[];for(const fs of Object.values(Ve))if(fs instanceof r.ba){const Tr=fs.getUnevaluatedPortalGraph();Tr&&Mn.push(Tr)}const Ur=r.fs.evaluate(Mn);for(const fs of Object.values(Ve))if(fs instanceof r.ba){const Tr=ie.layers[rt.decode(fs.sourceLayerIndex)];fs.setEvaluatedPortalGraph(Ur,Tr,this.tileID.canonical,Ye.availableImages,Ye.brightness)}}ps()};It.length>0?Promise.allSettled(It).then(bi).catch(Ue):bi()}updateParameters(ie){this.scaleFactor=ie.scaleFactor,this.showCollisionBoxes=ie.showCollisionBoxes,this.projection=ie.projection,this.brightness=ie.brightness,this.tileTransform=r.aY(ie.tileID.canonical,ie.projection),this.extraShadowCaster=ie.extraShadowCaster,this.lut=ie.lut,this.worldview=ie.worldview,this.indoor=ie.indoor}rasterizeIfNeeded(ie,re,ge,ze){Array.from(re.values()).some(Re=>Re.usvg)?this.rasterize(ie,re,ge,ze):ze()}updateImageMapAndGetImageTaskQueue(ie,re,ge){const ze=new Map;for(const Re of re.keys()){const Ue=ge.get(Re)||[];for(const rt of Ue){const He=rt.toString(),Ve=re.get(rt.id.toString());Ve.usvg?ze.has(He)||(ze.set(He,rt),ie.set(He,Object.assign({},Ve))):ie.set(He,Ve)}}return ze}rasterize(ie,re,ge,ze){this.rasterizeTask=ie.send("rasterizeImages",{scope:this.scope,tasks:ge},(Re,Ue)=>{if(!Re)for(const[rt,He]of Ue.entries()){const Ve=Object.assign(re.get(rt),{data:He});re.set(rt,Ve)}ze()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Te(We,ie,re,ge,ze){const Re=new r.ac(ie,{brightness:re,worldview:ze});for(const Ue of We)Ue.recalculate(Re,ge)}class we extends r.E{constructor(ie,re,ge,ze,Re,Ue,rt){super(),this.actor=ie,this.layerIndex=re,this.availableImages=ge,this.availableModels=ze,this.loadVectorData=Ue||r.aL,this.loading={},this.loaded={},this.deduped=new r.aK(ie.scheduler),this.isSpriteLoaded=Re,this.scheduler=ie.scheduler,this.brightness=rt}loadTile(ie,re){const ge=ie.uid,ze=ie&&ie.request,Re=ze&&ze.collectResourceTiming,Ue=this.loading[ge]=new _e(ie);Ue.abort=this.loadVectorData(ie,(rt,He)=>{const Ve=!this.loading[ge];if(delete this.loading[ge],Ue.cancelRasterize(),Ve||rt||!He)return Ue.status="done",Ve||(this.loaded[ge]=Ue),re(rt);const Ee=He.rawData,Ye={},It=r.aM(He.responseHeaders);It&&It.expires&&(Ye.expires=It.expires),It&&It.cacheControl&&(Ye.cacheControl=It.cacheControl),Ue.vectorTile=He.vectorTile||new r.fy(new r.bs(Ee));const vi=()=>{Ue.parse(Ue.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(bi,di)=>{if(bi||!di)return re(bi);const Wi={};if(Re){const ln=x(ze);ln.length>0&&(Wi.resourceTiming=JSON.parse(JSON.stringify(ln)))}re(null,Object.assign({rawTileData:Ee.slice(0),responseHeaders:He.responseHeaders},di,Ye,Wi))})};this.isSpriteLoaded?vi():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(vi,{type:"parseTile",isSymbolTile:ie.isSymbolTile,zoom:ie.tileZoom}):vi()}),this.loaded=this.loaded||{},this.loaded[ge]=Ue})}reloadTile(ie,re){const ge=this.loaded,ze=ie.uid;if(ge&&ge[ze]){const Re=ge[ze];Re.updateParameters(ie);const Ue=(rt,He)=>{const Ve=Re.reloadCallback;Ve&&(delete Re.reloadCallback,Re.parse(Re.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ve)),re(rt,He)};Re.status==="parsing"?Re.reloadCallback=Ue:Re.status==="done"&&(Re.vectorTile?Re.parse(Re.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ue):Ue()
821)}else re(null,void 0)}abortTile(ie,re){const ge=ie.uid,ze=this.loading[ge];ze&&(ze.abort&&ze.abort(),delete this.loading[ge]),re()}removeTile(ie,re){const ge=this.loaded,ze=ie.uid;ge&&ge[ze]&&delete ge[ze],re()}}class Ne{loadTile(ie,re){const{uid:ge,encoding:ze,rawImageData:Re,padding:Ue}=ie,rt=ImageBitmap&&Re instanceof ImageBitmap?this.getImageData(Re,Ue):Re;re(null,new r.fz(ge,rt,ze,Ue<1))}reloadTile(ie,re){re(null,null)}abortTile(ie,re){re()}removeTile(ie,re){re()}getImageData(ie,re){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(ie.width,ie.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=ie.width,this.offscreenCanvas.height=ie.height,this.offscreenCanvasContext.drawImage(ie,0,0,ie.width,ie.height);const ge=this.offscreenCanvasContext.getImageData(-re,-re,ie.width+2*re,ie.height+2*re);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),ge}}r.br.setPbf(r.bs);class pe{constructor(ie){this._mrt=new r.br(ie.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=ie.uid,this.tileID=ie.tileID,this.source=ie.source}parse(ie,re){const ge=this._mrt;this.status="parsing",this._entireBuffer=ie;try{ge.parseHeader(ie),this._isHeaderLoaded=!0;const ze=[];for(const Re in ge.layers){const Ue=ge.getLayer(Re),rt=Ue.getDataRange(Ue.getBandList()),He=ge.createDecodingTask(rt),Ve=ie.slice(rt.firstByte,rt.lastByte+1),Ee=r.br.performDecoding(Ve,He).then(Ye=>He.complete(null,Ye)).catch(Ye=>He.complete(Ye,null));ze.push(Ee)}Promise.allSettled(ze).then(()=>re(null,ge)).catch(Re=>re(Re))}catch(ze){re(ze)}}}class Pe{constructor(ie){this.actor=ie,this.loading={},this.loaded={}}loadTile(ie,re){const ge=ie.uid,ze=ie.request,Re=this.loading[ge]=new pe(ie),{cancel:Ue}=r.bt(ze,(rt,He,Ve)=>{const Ee=!this.loading[ge];if(delete this.loading[ge],Ee||rt||!He)return Re.status="done",Ee||(this.loaded[ge]=Re),re(rt);Re.parse(He,(Ye,It)=>{if(Ye||!It)return re(Ye);re(null,It,Ve)}),this.loaded[ge]=Re});Re.abort=Ue}reloadTile(ie,re){re(null,void 0)}abortTile(ie,re){const ge=ie.uid,ze=this.loading[ge];ze&&(ze.abort&&ze.abort(),delete this.loading[ge]),re()}removeTile(ie,re){const ge=ie.uid;this.loaded[ge]&&delete this.loaded[ge],re()}decodeRasterArray(ie,re){r.br.performDecoding(ie.buffer,ie.task).then(ge=>re(null,ge)).catch(ge=>re(ge))}}const De=r.fA.prototype.toGeoJSON;class Je{constructor(ie){this._feature=ie,this.extent=r.al,this.type=ie.type,this.properties=ie.tags,"id"in ie&&!isNaN(ie.id)&&(this.id=parseInt(ie.id,10))}loadGeometry(){if(this._feature.type===1){const ie=[];for(const re of this._feature.geometry)ie.push([new r.P(re[0],re[1])]);return ie}{const ie=[];for(const re of this._feature.geometry){const ge=[];for(const ze of re)ge.push(new r.P(ze[0],ze[1]));ie.push(ge)}return ie}}toGeoJSON(ie,re,ge){return De.call(this,ie,re,ge)}}class dt{constructor(ie,re){this.name=ie,this.extent=r.al,this.length=re.length,this._jsonFeatures=re}feature(ie){return new Je(this._jsonFeatures[ie])}}class At{constructor(ie){this.layers={},this.extent=r.al;for(const re of Object.keys(ie))this.layers[re]=new dt(re,ie[re])}}const qt=64/4096,kt=128;class Vt{constructor(){this.features=new Map}clear(){this.features.clear()}load(ie=[],re){for(const ge of ie){const ze=ge.id;if(ze==null)continue;let Re=this.features.get(ze);Re&&this.updateCache(Re,re),ge.geometry?(Re=lt(ge),this.updateCache(Re,re),this.features.set(ze,Re)):this.features.delete(ze),this.updateCache(Re,re)}}updateCache(ie,re){for(const{canonical:ge,uid:ze}of Object.values(re)){const{z:Re,x:Ue,y:rt}=ge;Fe(ie,Math.pow(2,Re),Ue,rt)&&delete re[ze]}}getTile(ie,re,ge){const ze=Math.pow(2,ie),Re=[];for(const Ue of this.features.values())Fe(Ue,ze,re,ge)&&Re.push(Ot(Ue,ze,re,ge));return{features:Re}}getFeatures(){return[...this.features.values()]}}function Fe({minX:We,minY:ie,maxX:re,maxY:ge},ze,Re,Ue){return We<(Re+1+qt)/ze&&ie<(Ue+1+qt)/ze&&re>(Re-qt)/ze&&ge>(Ue-qt)/ze}function lt(We){const{id:ie,geometry:re,properties:ge}=We;if(!re)return;if(re.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ze,coordinates:Re}=re,Ue={id:ie,type:1,geometry:[],tags:ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},rt=Ue.geometry;if(ze==="Point")pt(Re,rt,Ue);else if(ze==="MultiPoint")for(const He of Re)pt(He,rt,Ue);else if(ze==="LineString")Ue.type=2,Ge(Re,rt,Ue);else if(ze==="MultiLineString")Ue.type=2,Rt(Re,rt,Ue);else if(ze==="Polygon")Ue.type=3,Rt(Re,rt,Ue,!0);else{if(ze!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Ue.type=3;for(const He of Re)Rt(He,rt,Ue,!0)}return Ue}function pt([We,ie],re,ge){const ze=r.aF(We);let Re=r.aJ(ie);Re=Re<0?0:Re>1?1:Re,re.push(ze,Re),ge.minX=Math.min(ge.minX,ze),ge.minY=Math.min(ge.minY,Re),ge.maxX=Math.max(ge.maxX,ze),ge.maxY=Math.max(ge.maxY,Re)}function Ge(We,ie,re,ge=!1,ze=!1){const Re=[];for(const Ue of We)pt(Ue,Re,re);ie.push(Re),ge&&function(Ue,rt){let He=0;for(let Ve=0,Ee=Ue.length,Ye=Ee-2;Ve<Ee;Ye=Ve,Ve+=2)He+=(Ue[Ve]-Ue[Ye])*(Ue[Ve+1]+Ue[Ye+1]);if(He>0===rt)for(let Ve=0,Ee=Ue.length;Ve<Ee/2;Ve+=2){const Ye=Ue[Ve],It=Ue[Ve+1];Ue[Ve]=Ue[Ee-2-Ve],Ue[Ve+1]=Ue[Ee-1-Ve],Ue[Ee-2-Ve]=Ye,Ue[Ee-1-Ve]=It}}(Re,ze)}function Rt(We,ie,re,ge=!1){for(let ze=0;ze<We.length;ze++)Ge(We[ze],ie,re,ge,ze===0)}function Ot(We,ie,re,ge){const{id:ze,type:Re,geometry:Ue,tags:rt}=We,He=[];if(Re===1)(function(Ve,Ee,Ye,It,vi){for(let bi=0;bi<Ve.length;bi+=2){const di=Math.round(r.al*(Ve[bi+0]*Ee-Ye)),Wi=Math.round(r.al*(Ve[bi+1]*Ee-It));vi.push([di,Wi])}})(Ue,ie,re,ge,He);else for(const Ve of Ue)Ci(Ve,ie,re,ge,He);return{id:ze,type:Re,geometry:He,tags:rt}}function Ci(We,ie,re,ge,ze){const Re=-kt,Ue=r.al+kt;let rt;for(let He=0;He<We.length-2;
821He+=2){let Ve=Math.round(r.al*(We[He+0]*ie-re)),Ee=Math.round(r.al*(We[He+1]*ie-ge)),Ye=Math.round(r.al*(We[He+2]*ie-re)),It=Math.round(r.al*(We[He+3]*ie-ge));const vi=Ye-Ve,bi=It-Ee;Ve<Re&&Ye<Re||(Ve<Re?(Ee+=Math.round(bi*((Re-Ve)/vi)),Ve=Re):Ye<Re&&(It=Ee+Math.round(bi*((Re-Ve)/vi)),Ye=Re),Ee<Re&&It<Re||(Ee<Re?(Ve+=Math.round(vi*((Re-Ee)/bi)),Ee=Re):It<Re&&(Ye=Ve+Math.round(vi*((Re-Ee)/bi)),It=Re),Ve>=Ue&&Ye>=Ue||(Ve>=Ue?(Ee+=Math.round(bi*((Ue-Ve)/vi)),Ve=Ue):Ye>=Ue&&(It=Ee+Math.round(bi*((Ue-Ve)/vi)),Ye=Ue),Ee>=Ue&&It>=Ue||(Ee>=Ue?(Ve+=Math.round(vi*((Ue-Ee)/bi)),Ee=Ue):It>=Ue&&(Ye=Ve+Math.round(vi*((Ue-Ee)/bi)),It=Ue),rt&&Ve===rt[rt.length-1][0]&&Ee===rt[rt.length-1][1]||(rt=[[Ve,Ee]],ze.push(rt)),rt.push([Ye,It])))))}}function Hi({name:We,features:ie},re){re.writeStringField(1,We),re.writeVarintField(5,r.al);const ge=new Map,ze=new Map,Re={keys:ge,values:ze,feature:null};for(const Ue of ie)Re.feature=Ue,re.writeMessage(2,ei,Re);for(const Ue of ge.keys())re.writeStringField(3,Ue);for(const Ue of ze.keys())re.writeMessage(4,Xi,Ue)}function ei(We,ie){const re=We.feature;re.id!==void 0&&Number.isSafeInteger(+re.id)&&ie.writeVarintField(1,+re.id),re.tags&&ie.writeMessage(2,si,We),ie.writeVarintField(3,re.type),ie.writeMessage(4,Ai,re)}function si({keys:We,values:ie,feature:re},ge){for(const ze of Object.keys(re.tags)){let Re=re.tags[ze];if(Re===null)continue;let Ue=We.get(ze);Ue===void 0&&(Ue=We.size,We.set(ze,Ue)),ge.writeVarint(Ue);const rt=typeof Re;rt!=="string"&&rt!=="boolean"&&rt!=="number"&&(Re=JSON.stringify(Re));let He=ie.get(Re);He===void 0&&(He=ie.size,ie.set(Re,He)),ge.writeVarint(He)}}function Oi(We,ie){return(ie<<3)+(7&We)}function Ei(We){return We<<1^We>>31}function Ai(We,ie){const{geometry:re,type:ge}=We;let ze=0,Re=0;if(ge===1){ie.writeVarint(Oi(1,re.length));for(const Ue of re){const rt=Ue[0]-ze,He=Ue[1]-Re;ie.writeVarint(Ei(rt)),ie.writeVarint(Ei(He)),ze+=rt,Re+=He}}else for(const Ue of re){ie.writeVarint(Oi(1,1));const rt=Ue.length-(ge===3?1:0);for(let He=0;He<rt;He++){He===1&&ie.writeVarint(Oi(2,rt-1));const Ve=Ue[He][0]-ze,Ee=Ue[He][1]-Re;ie.writeVarint(Ei(Ve)),ie.writeVarint(Ei(Ee)),ze+=Ve,Re+=Ee}ge===3&&ie.writeVarint(Oi(7,1))}}function Xi(We,ie){const re=typeof We;re==="string"?ie.writeStringField(1,We):re==="boolean"?ie.writeBooleanField(7,We):re==="number"&&(We%1!=0?ie.writeDoubleField(3,We):We<0?ie.writeSVarintField(6,We):ie.writeVarintField(5,We))}const Nn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:We=>We},zi=Math.fround||(Gi=new Float32Array(1),We=>(Gi[0]=+We,Gi[0]));var Gi;const Sr=3,Kr=5,rs=6;class Yn{constructor(ie){this.options=Object.assign(Object.create(Nn),ie),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ie){const{log:re,minZoom:ge,maxZoom:ze}=this.options;re&&console.time("total time");const Re=`prepare ${ie.length} points`;re&&console.time(Re),this.points=ie;const Ue=[];for(let He=0;He<ie.length;He++){const Ve=ie[He];if(!Ve.geometry)continue;const[Ee,Ye]=Ve.geometry.coordinates,It=zi(Qs(Ee)),vi=zi(ot(Ye));Ue.push(It,vi,1/0,He,-1,1),this.options.reduce&&Ue.push(0)}let rt=this.trees[ze+1]=this._createTree(Ue);re&&console.timeEnd(Re);for(let He=ze;He>=ge;He--){const Ve=+Date.now();rt=this.trees[He]=this._createTree(this._cluster(rt,He)),re&&console.log("z%d: %d clusters in %dms",He,rt.numItems,+Date.now()-Ve)}return re&&console.timeEnd("total time"),this}getClusters(ie,re){let ge=((ie[0]+180)%360+360)%360-180;const ze=Math.max(-90,Math.min(90,ie[1]));let Re=ie[2]===180?180:((ie[2]+180)%360+360)%360-180;const Ue=Math.max(-90,Math.min(90,ie[3]));if(ie[2]-ie[0]>=360)ge=-180,Re=180;else if(ge>Re){const Ye=this.getClusters([ge,ze,180,Ue],re),It=this.getClusters([-180,ze,Re,Ue],re);return Ye.concat(It)}const rt=this.trees[this._limitZoom(re)],He=rt.range(Qs(ge),ot(Ue),Qs(Re),ot(ze)),Ve=rt.data,Ee=[];for(const Ye of He){const It=this.stride*Ye;Ee.push(Ve[It+Kr]>1?Ys(Ve,It,this.clusterProps):this.points[Ve[It+Sr]])}return Ee}getChildren(ie){const re=this._getOriginId(ie),ge=this._getOriginZoom(ie),ze="No cluster with the specified id.",Re=this.trees[ge];if(!Re)throw new Error(ze);const Ue=Re.data;if(re*this.stride>=Ue.length)throw new Error(ze);const rt=this.options.radius/(this.options.extent*Math.pow(2,ge-1)),He=Re.within(Ue[re*this.stride],Ue[re*this.stride+1],rt),Ve=[];for(const Ee of He){const Ye=Ee*this.stride;Ue[Ye+4]===ie&&Ve.push(Ue[Ye+Kr]>1?Ys(Ue,Ye,this.clusterProps):this.points[Ue[Ye+Sr]])}if(Ve.length===0)throw new Error(ze);return Ve}getLeaves(ie,re,ge){const ze=[];return this._appendLeaves(ze,ie,re=re||10,ge=ge||0,0),ze}getTile(ie,re,ge){const ze=this.trees[this._limitZoom(ie)],Re=Math.pow(2,ie),{extent:Ue,radiu
vendor: 15,829 bytes, line 821
821s:rt}=this.options,He=rt/Ue,Ve=(ge-He)/Re,Ee=(ge+1+He)/Re,Ye={features:[]};return this._addTileFeatures(ze.range((re-He)/Re,Ve,(re+1+He)/Re,Ee),ze.data,re,ge,Re,Ye),re===0&&this._addTileFeatures(ze.range(1-He/Re,Ve,1,Ee),ze.data,Re,ge,Re,Ye),re===Re-1&&this._addTileFeatures(ze.range(0,Ve,He/Re,Ee),ze.data,-1,ge,Re,Ye),Ye.features.length?Ye:null}getClusterExpansionZoom(ie){let re=this._getOriginZoom(ie)-1;for(;re<=this.options.maxZoom;){const ge=this.getChildren(ie);if(re++,ge.length!==1)break;ie=ge[0].properties.cluster_id}return re}_appendLeaves(ie,re,ge,ze,Re){const Ue=this.getChildren(re);for(const rt of Ue){const He=rt.properties;if(He&&He.cluster?Re+He.point_count<=ze?Re+=He.point_count:Re=this._appendLeaves(ie,He.cluster_id,ge,ze,Re):Re<ze?Re++:ie.push(rt),ie.length===ge)break}return Re}_createTree(ie){const re=new r.c3(ie.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ge=0;ge<ie.length;ge+=this.stride)re.add(ie[ge],ie[ge+1]);return re.finish(),re.data=ie,re}_addTileFeatures(ie,re,ge,ze,Re,Ue){for(const rt of ie){const He=rt*this.stride,Ve=re[He+Kr]>1;let Ee,Ye,It;if(Ve)Ee=Ia(re,He,this.clusterProps),Ye=re[He],It=re[He+1];else{const di=this.points[re[He+Sr]];Ee=di.properties;const[Wi,ln]=di.geometry.coordinates;Ye=Qs(Wi),It=ot(ln)}const vi={type:1,geometry:[[Math.round(this.options.extent*(Ye*Re-ge)),Math.round(this.options.extent*(It*Re-ze))]],tags:Ee};let bi;bi=Ve||this.options.generateId?re[He+Sr]:this.points[re[He+Sr]].id,bi!==void 0&&(vi.id=bi),Ue.features.push(vi)}}_limitZoom(ie){return Math.max(this.options.minZoom,Math.min(Math.floor(+ie),this.options.maxZoom+1))}_cluster(ie,re){const{radius:ge,extent:ze,reduce:Re,minPoints:Ue}=this.options,rt=ge/(ze*Math.pow(2,re)),He=ie.data,Ve=[],Ee=this.stride;for(let Ye=0;Ye<He.length;Ye+=Ee){if(He[Ye+2]<=re)continue;He[Ye+2]=re;const It=He[Ye],vi=He[Ye+1],bi=ie.within(He[Ye],He[Ye+1],rt),di=He[Ye+Kr];let Wi=di;for(const ln of bi){const Hn=ln*Ee;He[Hn+2]>re&&(Wi+=He[Hn+Kr])}if(Wi>di&&Wi>=Ue){let ln,Hn=It*di,Zr=vi*di,_r=-1;const xs=(Ye/Ee<<5)+(re+1)+this.points.length;for(const ps of bi){const fr=ps*Ee;if(He[fr+2]<=re)continue;He[fr+2]=re;const Mn=He[fr+Kr];Hn+=He[fr]*Mn,Zr+=He[fr+1]*Mn,He[fr+4]=xs,Re&&(ln||(ln=this._map(He,Ye,!0),_r=this.clusterProps.length,this.clusterProps.push(ln)),Re(ln,this._map(He,fr)))}He[Ye+4]=xs,Ve.push(Hn/Wi,Zr/Wi,1/0,xs,-1,Wi),Re&&Ve.push(_r)}else{for(let ln=0;ln<Ee;ln++)Ve.push(He[Ye+ln]);if(Wi>1)for(const ln of bi){const Hn=ln*Ee;if(!(He[Hn+2]<=re)){He[Hn+2]=re;for(let Zr=0;Zr<Ee;Zr++)Ve.push(He[Hn+Zr])}}}}return Ve}_getOriginId(ie){return ie-this.points.length>>5}_getOriginZoom(ie){return(ie-this.points.length)%32}_map(ie,re,ge){if(ie[re+Kr]>1){const Ue=this.clusterProps[ie[re+rs]];return ge?Object.assign({},Ue):Ue}const ze=this.points[ie[re+Sr]].properties,Re=this.options.map(ze);return ge&&Re===ze?Object.assign({},Re):Re}}function Ys(We,ie,re){return{type:"Feature",id:We[ie+Sr],properties:Ia(We,ie,re),geometry:{type:"Point",coordinates:[(ge=We[ie],360*(ge-.5)),Pt(We[ie+1])]}};var ge}function Ia(We,ie,re){const ge=We[ie+Kr],ze=ge>=1e4?`${Math.round(ge/1e3)}k`:ge>=1e3?Math.round(ge/100)/10+"k":ge,Re=We[ie+rs],Ue=Re===-1?{}:Object.assign({},re[Re]);return Object.assign(Ue,{cluster:!0,cluster_id:We[ie+Sr],point_count:ge,point_count_abbreviated:ze})}function Qs(We){return We/360+.5}function ot(We){const ie=Math.sin(We*Math.PI/180),re=.5-.25*Math.log((1+ie)/(1-ie))/Math.PI;return re<0?0:re>1?1:re}function Pt(We){const ie=(180-360*We)*Math.PI/180;return 360*Math.atan(Math.exp(ie))/Math.PI-90}function $t(We,ie,re,ge){let ze=ge;const Re=ie+(re-ie>>1);let Ue,rt=re-ie;const He=We[ie],Ve=We[ie+1],Ee=We[re],Ye=We[re+1];for(let It=ie+3;It<re;It+=3){const vi=Li(We[It],We[It+1],He,Ve,Ee,Ye);if(vi>ze)Ue=It,ze=vi;else if(vi===ze){const bi=Math.abs(It-Re);bi<rt&&(Ue=It,rt=bi)}}ze>ge&&(Ue-ie>3&&$t(We,ie,Ue,ge),We[Ue+2]=ze,re-Ue>3&&$t(We,Ue,re,ge))}function Li(We,ie,re,ge,ze,Re){let Ue=ze-re,rt=Re-ge;if(Ue!==0||rt!==0){const He=((We-re)*Ue+(ie-ge)*rt)/(Ue*Ue+rt*rt);He>1?(re=ze,ge=Re):He>0&&(re+=Ue*He,ge+=rt*He)}return Ue=We-re,rt=ie-ge,Ue*Ue+rt*rt}function wi(We,ie,re,ge){const ze={id:We??null,type:ie,geometry:re,tags:ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ie==="Point"||ie==="MultiPoint"||ie==="LineString")pi(ze,re);else if(ie==="Polygon")pi(ze,re[0]);else if(ie==="MultiLineString")for(const Re of re)pi(ze,Re);else if(ie==="MultiPolygon")for(const Re of re)pi(ze,Re[0]);return ze}function pi(We,ie){for(let re=0;re<ie.length;re+=3)We.minX=Math.min(We.minX,ie[re]),We.minY=Math.min(We.minY,ie[re+1]),We.maxX=Math.max(We.maxX,ie[re]),We.maxY=Math.max(We.maxY,ie[re+1])}function en(We,ie,re,ge){if(!ie.geometry)return;const ze=ie.geometry.coordinates;if(ze&&ze.length===0)return;const Re=ie.geometry.type,Ue=Math.pow(re.tolerance/((1<<re.maxZoom)*re.extent),2);let rt=[],He=ie.id;if(re.promoteId?He=ie.properties[re.promoteId]:re.generateId&&(He=ge||0),Re==="Point")jn(ze,rt);else if(Re==="MultiPoint")for(const Ve of ze)jn(Ve,rt);else if(Re==="LineString")ss(ze,rt,Ue,!1);else if(Re==="MultiLineString"){if(re.lineMetrics){for(const Ve of ze)rt=[],ss(Ve,rt,Ue,!1),We.push(wi(He,"LineString",rt,ie.properties));return}es(ze,rt,Ue,!1)}else if(Re==="Polygon")es(ze,rt,Ue,!0);else{if(Re!=="MultiPolygon"){if(Re==="GeometryCollection"){for(const Ve of ie.geometry.geometries)en(We,{id:He,geometry:Ve,properties:ie.properties},re,ge);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Ve of ze){const Ee=[];es(Ve,Ee,Ue,!0),rt.push(Ee)}}We.push(wi(He,Re,rt,ie.properties))}function jn(We,ie){ie.push(dl(We[0]),ta(We[1]),0)}function ss(We,ie,re,ge){let ze,Re,Ue=0;for(let He=0;He<We.length;He++){const Ve=dl(We[He][0]),Ee=ta(We[He][1]);ie.push(Ve,Ee,0),He>0&&(Ue+=ge?(ze*Ee-Ve*Re)/2:Math.sqrt(Math.pow(Ve-ze,2)+Math.pow(Ee-Re,2))),ze=Ve,Re=Ee}const rt=ie.length-3;ie[2]=1,$t(ie,0,rt,re),ie[rt+2]=1,ie.size=Math.abs(Ue),ie.start=0,ie.end=ie.size}function es(We,ie,re,ge){for(let ze=0;ze<We.length;ze++){const Re=[];ss(We[ze],Re,re,ge),ie.push(Re)}}function dl(We){return We/360+.5}function ta(We){const ie=Math.sin(We*Math.PI/180),re=.5-.25*Math.log((1+ie)/(1-ie))/Math.PI;return re<0?0:re>1?1:re}function Fr(We,ie,re,ge,ze,Re,Ue,rt){if(ge/=ie,Re>=(re/=ie)&&Ue<ge)return We;if(Ue<re||Re>=ge)return null;const He=[];for(const Ve of We){const Ee=Ve.geometry;let Ye=Ve.type;const It=ze===0?Ve.minX:Ve.minY,vi=ze===0?Ve.maxX:Ve.maxY;if(It>=re&&vi<ge){He.push(Ve);continue}if(vi<re||It>=ge)continue;let bi=[];if(Ye==="Point"||Ye==="MultiPoint")co(Ee,bi,re,ge,ze);else if(Ye==="LineString")qo(Ee,bi,re,ge,ze,!1,rt.lineMetrics);else if(Ye==="MultiLineString")Qe(Ee,bi,re,ge,ze,!1);else if(Ye==="Polygon")Qe(Ee,bi,re,ge,ze,!0);else if(Ye==="MultiPolygon")for(const di of Ee){const Wi=[];Qe(di,Wi,re,ge,ze,!0),Wi.length&&bi.push(Wi)}if(bi.length){if(rt.lineMetrics&&Ye==="LineString"){for(const di of bi)He.push(wi(Ve.id,Ye,di,Ve.tags));continue}Ye!=="LineString"&&Ye!=="MultiLineString"||(bi.length===1?(Ye="LineString",bi=bi[0]):Ye="MultiLineString"),Ye!=="Point"&&Ye!=="MultiPoint"||(Ye=bi.length===3?"Point":"MultiPoint"),He.push(wi(Ve.id,Ye,bi,Ve.tags))}}return He.length?He:null}function co(We,ie,re,ge,ze){for(let Re=0;Re<We.length;Re+=3){const Ue=We[Re+ze];Ue>=re&&Ue<=ge&&Di(ie,We[Re],We[Re+1],We[Re+2])}}function qo(We,ie,re,ge,ze,Re,Ue){let rt=ia(We);const He=ze===0?bn:Br;let Ve,Ee,Ye=We.start;for(let Wi=0;Wi<We.length-3;Wi+=3){const ln=We[Wi],Hn=We[Wi+1],Zr=We[Wi+2],_r=We[Wi+3],xs=We[Wi+4],ps=ze===0?ln:Hn,fr=ze===0?_r:xs;let Mn=!1;Ue&&(Ve=Math.sqrt(Math.pow(ln-_r,2)+Math.pow(Hn-xs,2))),ps<re?fr>re&&(Ee=He(rt,ln,Hn,_r,xs,re),Ue&&(rt.start=Ye+Ve*Ee)):ps>ge?fr<ge&&(Ee=He(rt,ln,Hn,_r,xs,ge),Ue&&(rt.start=Ye+Ve*Ee)):Di(rt,ln,Hn,Zr),fr<re&&ps>=re&&(Ee=He(rt,ln,Hn,_r,xs,re),Mn=!0),fr>ge&&ps<=ge&&(Ee=He(rt,ln,Hn,_r,xs,ge),Mn=!0),!Re&&Mn&&(Ue&&(rt.end=Ye+Ve*Ee),ie.push(rt),rt=ia(We)),Ue&&(Ye+=Ve)}let It=We.length-3;const vi=We[It],bi=We[It+1],di=ze===0?vi:bi;di>=re&&di<=ge&&Di(rt,vi,bi,We[It+2]),It=rt.length-3,Re&&It>=3&&(rt[It]!==rt[0]||rt[It+1]!==rt[1])&&Di(rt,rt[0],rt[1],rt[2]),rt.length&&ie.push(rt)}function ia(We){const ie=[];return ie.size=We.size,ie.start=We.start,ie.end=We.end,ie}function Qe(We,ie,re,ge,ze,Re){for(const Ue of We)qo(Ue,ie,re,ge,ze,Re,!1)}function Di(We,ie,re,ge){We.push(ie,re,ge)}function bn(We,ie,re,ge,ze,Re){const Ue=(Re-ie)/(ge-ie);return Di(We,Re,re+(ze-re)*Ue,1),Ue}function Br(We,ie,re,ge,ze,Re){const Ue=(Re-re)/(ze-re);return Di(We,ie+(ge-ie)*Ue,Re,1),Ue}function na(We,ie){const re=[];for(let ge=0;ge<We.length;ge++){const ze=We[ge],Re=ze.type;let Ue;if(Re==="Point"||Re==="MultiPoint"||Re==="LineString")Ue=yo(ze.geometry,ie);else if(Re==="MultiLineString"||Re==="Polygon"){Ue=[];for(const rt of ze.geometry)Ue.push(yo(rt,ie))}else if(Re==="MultiPolygon"){Ue=[];for(const rt of ze.geometry){const He=[];for(const Ve of rt)He.push(yo(Ve,ie));Ue.push(He)}}re.push(wi(ze.id,Re,Ue,ze.tags))}return re}function yo(We,ie){const re=[];re.size=We.size,We.start!==void 0&&(re.start=We.start,re.end=We.end);for(let ge=0;ge<We.length;ge+=3)re.push(We[ge]+ie,We[ge+1],We[ge+2]);return re}function Mo(We,ie){if(We.transformed)return We;const re=1<<We.z,ge=We.x,ze=We.y;for(const Re of We.features){const Ue=Re.geometry,rt=Re.type;if(Re.geometry=[],rt===1)for(let He=0;He<Ue.length;He+=2)Re.geometry.push(hu(Ue[He],Ue[He+1],ie,re,ge,ze));else for(let He=0;He<Ue.length;He++){const Ve=[];for(let Ee=0;Ee<Ue[He].length;Ee+=2)Ve.push(hu(Ue[He][Ee],Ue[He][Ee+1],ie,re,ge,ze));Re.geometry.push(Ve)}}return We.transformed=!0,We}function hu(We,ie,re,ge,ze,Re){return[Math.round(re*(We*ge-ze)),Math.round(re*(ie*ge-Re))]}function qs(We,ie,re,ge,ze){const Re=ie===ze.maxZoom?0:ze.tolerance/((1<<ie)*ze.extent),Ue={features:[],numPoints:0,numSimplified:0,numFeatures:We.length,source:null,x:re,y:ge,z:ie,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const rt of We)pu(Ue,rt,Re,ze);return Ue}function pu(We,ie,re,ge){const ze=ie.geometry,Re=ie.type,Ue=[];if(We.minX=Math.min(We.minX,ie.minX),We.minY=Math.min(We.minY,ie.minY),We.maxX=Math.max(We.maxX,ie.maxX),We.maxY=Math.max(We.maxY,ie.maxY),Re==="Point"||Re==="MultiPoint")for(let rt=0;rt<ze.length;rt+=3)Ue.push(ze[rt],ze[rt+1]),We.numPoints++,We.numSimplified++;else if(Re==="LineString")Hd(Ue,ze,We,re,!1,!1);else if(Re==="MultiLineString"||Re==="Polygon")for(let rt=0;rt<ze.length;rt++)Hd(Ue,ze[rt],We,re,Re==="Polygon",rt===0);else if(Re==="MultiPolygon")for(let rt=0;rt<ze.length;rt++){const He=ze[rt];for(let Ve=0;Ve<He.length;Ve++)Hd(Ue,He[Ve],We,re,!0,Ve===0)}if(Ue.length){let rt=ie.tags||null;if(Re==="LineString"&&ge.lineMetrics){rt={};for(const Ve in ie.tags)rt[Ve]=ie.tags[Ve];rt.mapbox_clip_start=ze.start/ze.size,rt.mapbox_clip_end=ze.end/ze.size}const He={geometry:Ue,type:Re==="Polygon"||Re==="MultiPolygon"?3:Re==="LineString"||Re==="MultiLineString"?2:1,tags:rt};ie.id!==null&&(He.id=ie.id),We.features.push(He)}}function Hd(We,ie,re,ge,ze,Re){const Ue=ge*ge;if(ge>0&&ie.size<(ze?Ue:ge))return void(re.numPoints+=ie.length/3);const rt=[];for(let He=0;He<ie.length;He+=3)(ge===0||ie[He+2]>Ue)&&(re.numSimplified++,rt.push(ie[He],ie[He+1])),re.numPoints++;ze&&function(He,Ve){let Ee=0;for(let Ye=0,It=He.length,vi=It-2;Ye<It;vi=Ye,Ye+=2)Ee+=(He[Ye]-He[vi])*(He[Ye+1]+He[vi+1]);if(Ee>0===Ve)for(let Ye=0,It=He.length;Ye<It/2;Ye+=2){const vi=He[Ye],bi=He[Ye+1];He[Ye]=He[It-2-Ye],He[Ye+1]=He[It-1-Ye],He[It-2-Ye]=vi,He[It-1-Ye]=bi}}(rt,Re),We.push(rt)}const Tt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Nl{constructor(ie,re){const ge=(re=this.options=function(Re,Ue){for(const rt in Ue)Re[rt]=Ue[rt];return Re}(Object.create(Tt),re)).debug;if(ge&&console.time("preprocess data"),re.maxZoom<0||re.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(re.promoteId&&re.generateId)throw new Error("promoteId and generateId cannot be used together.");let ze=function(Re,Ue){const rt=[];if(Re.type==="FeatureCollection")for(let He=0;He<Re.features.length;He++)en(rt,Re.features[He],Ue,He);else en(rt,Re.type==="Feature"?Re:{geometry:Re},Ue);return rt}(ie,re);this.tiles={},this.tileCoords=[],ge&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",re.indexMaxZoom,re.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ze=function(Re,Ue){const rt=Ue.buffer/Ue.extent;let He=Re;const Ve=Fr(Re,1,-1-rt,rt,0,-1,2,Ue),Ee=Fr(Re,1,1-rt,2+rt,0,-1,2,Ue);return(Ve||Ee)&&(He=Fr(Re,1,-rt,1+rt,0,-1,2,Ue)||[],Ve&&(He=na(Ve,1).concat(He)),Ee&&(He=He.concat(na(Ee,-1)))),He}(ze,re),ze.length&&this.splitTile(ze,0,0,0),ge&&(ze.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(ie,re,ge,ze,Re,Ue,rt){const He=[ie,re,ge,ze],Ve=this.options,Ee=Ve.debug;for(;He.length;){ze=He.pop(),ge=He.pop(),re=He.pop(),ie=He.pop();const Ye=1<<re,It=Gd(re,ge,ze);let vi=this.tiles[It];if(!vi&&(Ee>1&&console.time("creation"),vi=this.tiles[It]=qs(ie,re,ge,ze,Ve),this.tileCoords.push({z:re,x:ge,y:ze}),Ee)){Ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",re,ge,ze,vi.numFeatures,vi.numPoints,vi.numSimplified),console.timeEnd("creation"));const Mn=`z${re}`;this.stats[Mn]=(this.stats[Mn]||0)+1,this.total++}if(vi.source=ie,Re==null){if(re===Ve.indexMaxZoom||vi.numPoints<=Ve.indexMaxPoints)continue}else{if(re===Ve.maxZoom||re===Re)continue;if(Re!=null){const Mn=Re-re;if(ge!==Ue>>Mn||ze!==rt>>Mn)continue}}if(vi.source=null,ie.length===0)continue;Ee>1&&console.time("clipping");const bi=.5*Ve.buffer/Ve.extent,di=.5-bi,Wi=.5+bi,ln=1+bi;let Hn=null,Zr=null,_r=null,xs=null,ps=Fr(ie,Ye,ge-bi,ge+Wi,0,vi.minX,vi.maxX,Ve),fr=Fr(ie,Ye,ge+di,ge+ln,0,vi.minX,vi.maxX,Ve);ie=null,ps&&(Hn=Fr(ps,Ye,ze-bi,ze+Wi,1,vi.minY,vi.maxY,Ve),Zr=Fr(ps,Ye,ze+di,ze+ln,1,vi.minY,vi.maxY,Ve),ps=null),fr&&(_r=Fr(fr,Ye,ze-bi,ze+Wi,1,vi.minY,vi.maxY,Ve),xs=Fr(fr,Ye,ze+di,ze+ln,1,vi.minY,vi.maxY,Ve),fr=null),Ee>1&&console.timeEnd("clipping"),He.push(Hn||[],re+1,2*ge,2*ze),He.push(Zr||[],re+1,2*ge,2*ze+1),He.push(_r||[],re+1,2*ge+1,2*ze),He.push(xs||[],re+1,2*ge+1,2*ze+1)}}getTile(ie,re,ge){ie=+ie,re=+re,ge=+ge;const ze=this.options,{extent:Re,debug:Ue}=ze;if(ie<0||ie>24)return null;const rt=1<<ie,He=Gd(ie,re=re+rt&rt-1,ge);if(this.tiles[He])return Mo(this.tiles[He],Re);Ue>1&&console.log("drilling down to z%d-%d-%d",ie,re,ge);let Ve,Ee=ie,Ye=re,It=ge;for(;!Ve&&Ee>0;)Ee--,Ye>>=1,It>>=1,Ve=this.tiles[Gd(Ee,Ye,It)];return Ve&&Ve.source?(Ue>1&&(console.log("found parent tile z%d-%d-%d",Ee,Ye,It),console.time("drilling down")),this.splitTile(Ve.source,Ee,Ye,It,ie,re,ge),Ue>1&&console.timeEnd("drilling down"),this.tiles[He]?Mo(this.tiles[He],Re):null):null}}function Gd(We,ie,re){return 32*((1<<We)*re+ie)+We}function Wd(We,ie){const re=We.tileID.canonical;if(!this._geoJSONIndex)return void ie(null,null);const ge=this._geoJSONIndex.getTile(re.z,re.x,re.y);if(!ge)return void ie(null,null);const ze=Ve=>Ve.tags&&"3d_elevation_id"in Ve.tags&&"source"in Ve.tags&&Ve.tags.source==="elevation",Re=ge.features.filter(Ve=>ze(Ve));let Ue={_geojsonTileLayer:ge.features};Re.length>0&&(Ue={_geojsonTileLayer:ge.features.filter(Ve=>!ze(Ve)),hd_road_elevation:Re});const rt=new At(Ue),He=function(Ve){const Ee=new r.bs;for(const Ye of Object.keys(Ve))Ee.writeMessage(3,Hi,{name:Ye,features:Ve[Ye]});return Ee.finish()}(Ue).buffer;ie(null,{vectorTile:rt,rawData:He})}class Pn extends we{constructor(ie,re,ge,ze,Re,Ue,rt){super(ie,re,ge,ze,Re,Wd,rt),Ue&&(this.loadGeoJSON=Ue),this._dynamicIndex=new Vt}loadData(ie,re){const ge=ie&&ie.request,ze=ge&&ge.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(ie,(Re,Ue)=>{if(Re||!Ue)return re(Re);
821if(typeof Ue!="object")return re(new Error(`Input data given to '${ie.source}' is not a valid GeoJSON object.`));{try{if(ie.filter){const He=r.U(ie.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(He.result==="error")throw new Error(He.value.map(Ve=>`${Ve.key}: ${Ve.message}`).join(", "));Ue.features=Ue.features.filter(Ve=>He.value.evaluate({zoom:0},Ve))}ie.dynamic?(Ue.type==="Feature"&&(Ue={type:"FeatureCollection",features:[Ue]}),ie.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Ue.features,this.loaded),ie.cluster&&(Ue.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=ie.cluster?new Yn(function({superclusterOptions:He,clusterProperties:Ve}){if(!Ve||!He)return He;const Ee={},Ye={},It={accumulated:null,zoom:0},vi={properties:null},bi=Object.keys(Ve);for(const di of bi){const[Wi,ln]=Ve[di],Hn=r.U(ln),Zr=r.U(typeof Wi=="string"?[Wi,["accumulated"],["get",di]]:Wi);Ee[di]=Hn.value,Ye[di]=Zr.value}return He.map=di=>{vi.properties=di;const Wi={};for(const ln of bi)Wi[ln]=Ee[ln].evaluate(It,vi);return Wi},He.reduce=(di,Wi)=>{vi.properties=Wi;for(const ln of bi)It.accumulated=di[ln],di[ln]=Ye[ln].evaluate(It,vi)},He}(ie)).load(Ue.features):ie.dynamic?this._dynamicIndex:function(He,Ve){return new Nl(He,Ve)}(Ue,ie.geojsonVtOptions)}catch(He){return re(He)}const rt={};if(ze){const He=x(ge);He&&(rt.resourceTiming={},rt.resourceTiming[ie.source]=JSON.parse(JSON.stringify(He)))}re(null,rt)}})}reloadTile(ie,re){const ge=this.loaded;return ge&&ge[ie.uid]?ie.partial?re(null,void 0):super.reloadTile(ie,re):this.loadTile(ie,re)}loadGeoJSON(ie,re){if(ie.request)r.m(ie.request,re);else{if(typeof ie.data!="string")return re(new Error(`Input data given to '${ie.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return re(null,JSON.parse(ie.data))}catch{return re(new Error(`Input data given to '${ie.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(ie,re){try{re(null,this._geoJSONIndex.getClusterExpansionZoom(ie.clusterId))}catch(ge){re(ge)}}getClusterChildren(ie,re){try{re(null,this._geoJSONIndex.getChildren(ie.clusterId))}catch(ge){re(ge)}}getClusterLeaves(ie,re){try{re(null,this._geoJSONIndex.getLeaves(ie.clusterId,ie.limit,ie.offset))}catch(ge){re(ge)}}}class Ms{constructor(ie,re,ge){this.tileID=new r.aP(ie.tileID.overscaledZ,ie.tileID.wrap,ie.tileID.canonical.z,ie.tileID.canonical.x,ie.tileID.canonical.y),this.tileZoom=ie.tileZoom,this.uid=ie.uid,this.zoom=ie.zoom,this.canonical=ie.tileID.canonical,this.pixelRatio=ie.pixelRatio,this.tileSize=ie.tileSize,this.source=ie.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=ie.projection,this.brightness=re,this.worldview=ge}parse(ie,re,ge,ze){this.status="parsing";const Re=new r.aP(ge.tileID.overscaledZ,ge.tileID.wrap,ge.tileID.canonical.z,ge.tileID.canonical.x,ge.tileID.canonical.y),Ue=[],rt=re.familiesBySource[ge.source],He=new r.fm(Re,ge.promoteId);He.bucketLayerIDs=[],He.is3DTile=!0,r.fB(ie).then(Ve=>{if(!Ve)return ze(new Error("Could not parse tile"));const Ee=Ve.json.extensionsUsed&&Ve.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ve.json.asset.extras&&Ve.json.asset.extras.MAPBOX_mesh_features,Ye=Ve.json.extensionsUsed&&Ve.json.extensionsUsed.includes("EXT_meshopt_compression"),It=new r.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const vi in rt)for(const bi of rt[vi]){const di=bi[0];He.bucketLayerIDs.push(bi.map(Hn=>r.B(Hn.id,Hn.scope))),di.recalculate(It,[]);const Wi=r.fC(Ve,1/r.d6(ge.tileID.canonical)),ln=new r.fD(bi,Wi,Re,Ee,Ye,this.brightness,He,this.worldview);Ee||(ln.needsUpload=!0),Ue.push(ln),ln.evaluate(di)}this.status="done",ze(null,{buckets:Ue,featureIndex:He,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ve=>ze(new Error(Ve.message)))}}class Vc{constructor(ie,re,ge,ze,Re,Ue,rt,He){this.actor=ie,this.layerIndex=re,this.availableImages=ge,this.availableModels=ze,this.brightness=rt,this.loading={},this.loaded={},this.worldview=He}loadTile(ie,re){const ge=ie.uid,ze=this.loading[ge]=new Ms(ie,this.brightness,this.worldview);r.bt(ie.request,(Re,Ue)=>{const rt=!this.loading[ge];return delete this.loading[ge],rt||Re?(ze.status="done",rt||(this.loaded[ge]=ze),re(Re)):Ue&&Ue.byteLength!==0?void ze.parse(Ue,this.layerIndex,ie,(He,Ve)=>{ze.status="done",this.loaded=this.loaded||{},this.loaded[ge]=ze,He||!Ve?re(He):re(null,Ve)}):(ze.status="done",this.loaded[ge]=ze,re())})}reloadTile(ie,re){const ge=this.loaded,ze=ie.uid;if(ge&&ge[ze]){const Re=ge[ze];Re.projection=ie.projection,Re.brightness=ie.brightness;const Ue=(rt,He)=>{Re.reloadCallback&&(delete Re.reloadCallback,this.loadTile(ie,re)),re(rt,He)};Re.status==="parsing"?Re.reloadCallback=Ue:Re.status==="done"&&this.loadTile(ie,re)}}abortTile(ie,re){const ge=ie.uid;this.loading[ge]&&delete this.loading[ge],re()}removeTile(ie,re){const ge=this.loaded,ze=ie.uid;ge&&ge[ze]&&delete ge[ze],re()}}class Kd{constructor(ie){this.self=ie,this.actor=new r.fF(ie,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new r.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=r.cl({name:"mercator"}),this.workerSourceTypes={vector:we,geojson:Pn,"raster-dem":Ne,"raster-array":Pe,"batched-model":Vc},this.workerSources={}
821,this.self.registerWorkerSource=(re,ge)=>{if(this.workerSourceTypes[re])throw new Error(`Worker source with name "${re}" already registered.`);this.workerSourceTypes[re]=ge},this.self.registerRTLTextPlugin=re=>{if(r.fG.isParsed())throw new Error("RTL text plugin already registered.");r.fG.setState({pluginStatus:r.fH.parsed,pluginURL:r.fG.getPluginURL()}),r.fG.applyArabicShaping=re.applyArabicShaping,r.fG.processBidirectionalText=re.processBidirectionalText,r.fG.processStyledBidirectionalText=re.processStyledBidirectionalText;for(const ge of this.rtlPluginParsingListeners)ge(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ie,re,ge){delete this.layerIndexes[ie],delete this.availableImages[ie],delete this.availableModels[ie],delete this.workerSources[ie],ge()}checkIfReady(ie,re,ge){ge()}setReferrer(ie,re){this.referrer=re}spriteLoaded(ie,re){this.isSpriteLoaded[ie]||(this.isSpriteLoaded[ie]={});const{scope:ge,isLoaded:ze}=re;if(this.isSpriteLoaded[ie][ge]=ze,this.workerSources[ie]&&this.workerSources[ie][ge])for(const Re in this.workerSources[ie][ge]){const Ue=this.workerSources[ie][ge][Re];for(const rt in Ue){const He=Ue[rt];He instanceof we&&(He.isSpriteLoaded=ze,He.fire(new r.z("isSpriteLoaded")))}}}setImages(ie,re,ge){this.availableImages[ie]||(this.availableImages[ie]={});const{scope:ze,images:Re}=re;if(this.availableImages[ie][ze]=Re,this.workerSources[ie]&&this.workerSources[ie][ze]){for(const Ue in this.workerSources[ie][ze]){const rt=this.workerSources[ie][ze][Ue];for(const He in rt)rt[He].availableImages=Re}ge()}else ge()}setModels(ie,{scope:re,models:ge},ze){if(this.availableModels[ie]||(this.availableModels[ie]={}),this.availableModels[ie][re]=ge,this.workerSources[ie]&&this.workerSources[ie][re]){for(const Re in this.workerSources[ie][re]){const Ue=this.workerSources[ie][re][Re];for(const rt in Ue)Ue[rt].availableModels=ge}ze()}else ze()}setProjection(ie,re){this.projections[ie]=r.cl(re)}setBrightness(ie,re,ge){this.brightness=re,ge()}setWorldview(ie,re,ge){this.worldview=re,ge()}setLayers(ie,re,ge){this.getLayerIndex(ie,re.scope).replace(re.layers,re.options),ge()}updateLayers(ie,re,ge){this.getLayerIndex(ie,re.scope).update(re.layers,re.removedIds,re.options),ge()}loadTile(ie,re,ge){re.projection=this.projections[ie]||this.defaultProjection,this.getWorkerSource(ie,re.type,re.source,re.scope).loadTile(re,ge)}decodeRasterArray(ie,re,ge){this.getWorkerSource(ie,re.type,re.source,re.scope).decodeRasterArray(re,ge)}reloadTile(ie,re,ge){re.projection=this.projections[ie]||this.defaultProjection,this.getWorkerSource(ie,re.type,re.source,re.scope).reloadTile(re,ge)}abortTile(ie,re,ge){this.getWorkerSource(ie,re.type,re.source,re.scope).abortTile(re,ge)}removeTile(ie,re,ge){this.getWorkerSource(ie,re.type,re.source,re.scope).removeTile(re,ge)}removeSource(ie,re,ge){if(!(this.workerSources[ie]&&this.workerSources[ie][re.scope]&&this.workerSources[ie][re.scope][re.type]&&this.workerSources[ie][re.scope][re.type][re.source]))return;const ze=this.workerSources[ie][re.scope][re.type][re.source];delete this.workerSources[ie][re.scope][re.type][re.source],ze.removeSource!==void 0?ze.removeSource(re,ge):ge()}loadWorkerSource(ie,re,ge){try{this.self.importScripts(re.url),ge()}catch(ze){ge(ze.toString())}}syncRTLPluginState(ie,re,ge){if(r.fG.isParsed())ge(null,!0);else if(r.fG.isParsing())this.rtlPluginParsingListeners.push(ge);else try{r.fG.setState(re);const ze=r.fG.getPluginURL();!r.fG.isLoaded()||r.fG.isParsed()||r.fG.isParsing()||ze==null||(r.fG.setState({pluginStatus:r.fH.parsing,pluginURL:r.fG.getPluginURL()}),this.self.importScripts(ze),r.fG.isParsed()?ge(null,!0):this.rtlPluginParsingListeners.push(ge))}catch(ze){ge(ze.toString())}}setDracoUrl(ie,re){this.dracoUrl=re}getAvailableImages(ie,re){this.availableImages[ie]||(this.availableImages[ie]={});let ge=this.availableImages[ie][re];return ge||(ge=[]),ge}getAvailableModels(ie,re){this.availableModels[ie]||(this.availableModels[ie]={});let ge=this.availableModels[ie][re];return ge||(ge={}),ge}getLayerIndex(ie,re){this.layerIndexes[ie]||(this.layerIndexes[ie]={});let ge=this.layerIndexes[ie][re];return ge||(ge=this.layerIndexes[ie][re]=new I,ge.scope=re),ge}getWorkerSource(ie,re,ge,ze){const Re=this.workerSources;return Re[ie]||(Re[ie]={}),Re[ie][ze]||(Re[ie][ze]={}),Re[ie][ze][re]||(Re[ie][ze][re]={}),this.isSpriteLoaded[ie]||(this.isSpriteLoaded[ie]={}),Re[ie][ze][re][ge]||(Re[ie][ze][re][ge]=new this.workerSourceTypes[re]({send:(Ue,rt,He,Ve,Ee,Ye)=>this.actor.send(Ue,rt,He,ie,Ee,Ye),scheduler:this.actor.scheduler},this.getLayerIndex(ie,ze),this.getAvailableImages(ie,ze),this.getAvailableModels(ie,ze),this.isSpriteLoaded[ie][ze],void 0,this.brightness,this.worldview)),Re[ie][ze][re][ge]}rasterizeImagesWorker(ie,re,ge){const ze=new Map;for(const[Re,{image:Ue,imageVariant:rt}]of re.tasks.entries()){const He=this.imageRasterizer.rasterize(rt,Ue,re.scope,ie);ze.set(Re,He)}ge(void 0,ze)}removeRasterizedImages(ie,re,ge){this.imageRasterizer.removeImagesFromCacheByIds(re.imageIds,re.scope,ie),ge()}enforceCacheSizeLimit(ie,re){r.fI(re)}getWorkerPerformanceMetrics(ie,re,ge){ge(void 0,void 0)}}
821return r.fE(self)&&(self.worker=new Kd(self)),Kd}),c(["./shared"],function(r){var x="3.16.0";const S={create:"create",load:"load",fullLoad:"fullLoad"},C={mark(g){performance.mark(g)},measure(g,a,h){performance.measure(g,a,h)}};function I(g){const a=g.name.split("?")[0];return r.a(a)&&a.includes("mapbox-gl.js")?"javascript":r.a(a)&&a.includes("mapbox-gl.css")?"css":r.b(a)?"fontRange":r.c(a)?"sprite":r.i(a)?"style":r.d(a)?"tilejson":"other"}var N,D={},V=function(){if(N)return D;function g(y){return!a(y)}function a(y){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var T,E,P=new Blob([""],{type:"text/javascript"}),M=URL.createObjectURL(P);try{E=new Worker(M),T=!0}catch{T=!1}return E&&E.terminate(),URL.revokeObjectURL(M),T}()?function(){var T=document.createElement("canvas");T.width=T.height=1;var E=T.getContext("2d");if(!E)return!1;var P=E.getImageData(0,0,1,1);return P&&P.width===T.width}()?(h[b=y&&y.failIfMajorPerformanceCaveat]===void 0&&(h[b]=function(T){var E,P=function(M){var L=document.createElement("canvas"),O=Object.create(g.webGLContextAttributes);return O.failIfMajorPerformanceCaveat=M,L.getContext("webgl2",O)}(T);if(!P)return!1;try{E=P.createShader(P.VERTEX_SHADER)}catch{return!1}return!(!E||P.isContextLost())&&(P.shaderSource(E,"void main() {}"),P.compileShader(E),P.getShaderParameter(E,P.COMPILE_STATUS)===!0)}(b)),h[b]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var b}N=1,D.supported=g,D.notSupportedReason=a;var h={};return g.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},D}();function B(g,a,h){const y=document.createElement(g);return a!=null&&(y.className=a),h&&h.appendChild(y),y}function W(g,a,h){const y=document.createElementNS("http://www.w3.org/2000/svg",g);for(const b of Object.keys(a))y.setAttributeNS(null,b,String(a[b]));return h&&h.appendChild(y),y}const $=typeof document<"u"?document.documentElement&&document.documentElement.style:null,G=$&&$.userSelect!==void 0?"userSelect":"WebkitUserSelect";let te;function ce(){$&&G&&(te=$[G],$[G]="none")}function _e(){$&&G&&($[G]=te)}function Te(g){g.preventDefault(),g.stopPropagation(),window.removeEventListener("click",Te,!0)}function we(){window.addEventListener("click",Te,!0),window.setTimeout(()=>{window.removeEventListener("click",Te,!0)},0)}function Ne(g,a){const h=g.getBoundingClientRect();return De(g,h,a)}function pe(g,a){const h=g.getBoundingClientRect(),y=[];for(let b=0;b<a.length;b++)y.push(De(g,h,a[b]));return y}function Pe(g){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&g.button===2&&g.ctrlKey?0:g.button}function De(g,a,h){const y=g.offsetWidth===a.width?1:g.offsetWidth/a.width;return new r.P((h.clientX-a.left)*y,(h.clientY-a.top)*y)}const Je="01",dt="NO_ACCESS_TOKEN";class At{constructor(a,h,y){this._transformRequestFn=a,this._customAccessToken=h,this._silenceAuthErrors=!!y,this._createSkuToken()}_createSkuToken(){const a=function(){let h="";for(let y=0;y<10;y++)h+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Je,h].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(a,h){return this._transformRequestFn&&this._transformRequestFn(a,h)||{url:a}}normalizeStyleURL(a,h){if(!r.h(a))return a;const y=kt(a);return y.params.push(`sdk=js-${x}`),y.path=`/styles/v1${y.path}`,this._makeAPIURL(y,this._customAccessToken||h)}normalizeGlyphsURL(a,h){if(!r.h(a))return a;const y=kt(a);return y.path=`/fonts/v1${y.path}`,this._makeAPIURL(y,this._customAccessToken||h)}normalizeModelURL(a,h){if(!r.h(a))return a;const y=kt(a);return y.path=`/models/v1${y.path}`,this._makeAPIURL(y,this._customAccessToken||h)}normalizeSourceURL(a,h,y,b){if(!r.h(a))return a;const T=kt(a);return T.path=`/v4/${T.authority}.json`,T.params.push("secure"),y&&T.params.push(`language=${y}`),b&&T.params.push(`worldview=${b}`),this._makeAPIURL(T,this._customAccessToken||h)}normalizeIconsetURL(a,h){const y=kt(a);return r.h(a)?(y.path=`/styles/v1${y.path}/iconset.pbf`,this._makeAPIURL(y,this._customAccessToken||h)):Vt(y)}normalizeSpriteURL(a,h,y,b){const T=kt(a);return r.h(a)?(T.path=`/styles/v1${T.path}/sprite${h}${y}`,this._makeAPIURL(T,this._customAccessToken||b)):(T.path+=`${h}${y}`,Vt(T))}normalizeTileURL(a,h,y){if(this._isSkuTokenExpired()&&this._createSkuToken(),a&&!r.h(a))return a;const b=kt(a);b.path=b.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${h||y&&b.authority!=="raster"&&y===512?"@2x":""}${r.k.supported?".webp":"$1"}`),b.authority==="raster"?b.path=`/${r.e.RASTER_URL_PREFIX}${b.path}`:b.authority==="rasterarrays"?b.path=`/${r.e.RASTERARRAYS_URL_PREFIX}${b.path}`:b.authority==="3dtiles"?b.path=`/${r.e.TILES3D_URL_PREFIX}${b.path}`:(b.path=b.path.replace(/^.+\/v4\//,"/"),b.path=`/${r.e.TILE_URL_VERSION}${b.path}`);const T=this._customAccessToken||function(E){for(const P of E){const M=P.match(/^access_token=(.*)$/);if(M)return M[1]}return null}(b.params)||r.e.ACCESS_TOKEN;return r.e.REQUIRE_ACCESS_TOKEN&&T&&this._skuToken&&b.params.push(`sku=${this._skuToken}`),this._makeAPIURL(b,T)}canonicalizeTileURL(a,h){const y=kt(a);if(!y.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!y.path.match(/\.[\w]+$/))return a;let b="mapbox://";y.path.match(/^\/raster\/v1\//)?b+=`raster/${y.path.replace(`/${r.e.RASTER_URL_PREFIX}/`,"")}`:y.path.match(/^\/rasterarrays\/v1\//)?b+=`rasterarrays/${y.path.replace(`/${r.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:b+=`tiles/${y.path.replace(`/${r.e.TILE_URL_VERSION}/`,"")}`;let T=y.params;return h&&(T=T.filter(E=>!E.match(/^access_token=/))),T.length&&(b+=`?${T.join("&")}`),b}canonicalizeTileset(a,h){const y=!!h&&r.h(h),b=[];for(const T of a.tiles||[])r.j(T)?b.push(this.canonicalizeTileURL(T,y)):b.push(T);return b}_makeAPIURL(a,h){const y="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",b=kt(r.e.API_URL);if(a.protocol=b.protocol,a.authority=b.authority,a.protocol==="http"){const T=a.params.indexOf("secure");T>=0&&a.params.splice(T,1)}
821if(b.path!=="/"&&(a.path=`${b.path}${a.path}`),!r.e.REQUIRE_ACCESS_TOKEN)return Vt(a);if(h=h||r.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!h)throw new Error(`An API access token is required to use Mapbox GL. ${y}`);if(h[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${y}`)}return a.params=a.params.filter(T=>T.indexOf("access_token")===-1),a.params.push(`access_token=${h||""}`),Vt(a)}}const qt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function kt(g){const a=g.match(qt);if(!a)throw new Error("Unable to parse URL object");return{protocol:a[1],authority:a[2],path:a[3]||"/",params:a[4]?a[4].split("&"):[]}}function Vt(g){const a=g.params.length?`?${g.params.join("&")}`:"";return`${g.protocol}://${g.authority}${g.path}${a}`}const Fe="mapbox.eventData";function lt(g){if(!g)return null;const a=g.split(".");if(!a||a.length!==3)return null;try{return JSON.parse(r.l(a[1]))}catch{return null}}class pt{constructor(a){this.type=a,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(a){const h=lt(r.e.ACCESS_TOKEN);let y="";return y=h&&h.u?r.f(h.u):r.e.ACCESS_TOKEN||"",a?`${Fe}.${a}:${y}`:`${Fe}:${y}`}fetchEventData(){const a=r.s("localStorage"),h=this.getStorageKey(),y=this.getStorageKey("uuid"),b=this.getStorageKey("uuidTimestamp");if(a)try{const T=localStorage.getItem(h);T&&(this.eventData=JSON.parse(T));const E=localStorage.getItem(y);E&&(this.anonId=E);const P=localStorage.getItem(b);P&&(this.anonIdTimestamp=Number(P));const M=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<M)&&this.refreshUUID()}catch{r.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=r.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const a=r.s("localStorage"),h=this.getStorageKey(),y=this.getStorageKey("uuid"),b=this.getStorageKey("uuidTimestamp"),T=this.anonId,E=this.anonIdTimestamp;if(a&&T)try{localStorage.setItem(y,T),Object.keys(this.eventData).length>=1&&localStorage.setItem(h,JSON.stringify(this.eventData)),E&&localStorage.setItem(b,E.toString())}catch{r.w("Unable to write to LocalStorage")}}processRequests(a){}postEvent(a,h,y,b){if(!r.e.EVENTS_URL)return;const T=kt(r.e.EVENTS_URL);T.params.push(`access_token=${b||r.e.ACCESS_TOKEN||""}`);const E={event:this.type,created:new Date(a).toISOString()},P=h?Object.assign(E,h):E,M={url:Vt(T),headers:{"Content-Type":"text/plain"},body:JSON.stringify([P])};this.pendingRequest=r.p(M,L=>{this.pendingRequest=null,y(L),this.saveEventData(),this.processRequests(b)})}queueRequest(a,h){this.queue.push(a),this.processRequests(h)}}const Ge=new class extends pt{constructor(g){super("appUserTurnstile"),this._customAccessToken=g}postTurnstileEvent(g,a){r.e.EVENTS_URL&&r.e.ACCESS_TOKEN&&Array.isArray(g)&&g.some(h=>r.h(h)||r.j(h))&&this.queueRequest(Date.now(),a)}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const a=lt(r.e.ACCESS_TOKEN),h=a?a.u:r.e.ACCESS_TOKEN;let y=h!==this.eventData.tokenU;r.v(this.anonId)||(this.refreshUUID(),y=!0);const b=this.queue.shift();if(this.eventData.lastSuccess){const T=new Date(this.eventData.lastSuccess),E=new Date(b),P=(b-this.eventData.lastSuccess)/864e5;y=y||P>=1||P<-1||T.getDate()!==E.getDate()}else y=!0;y?this.postEvent(b,{sdkIdentifier:"mapbox-gl-js",sdkVersion:x,skuId:Je,"enabled.telemetry":!1,userId:this.anonId},T=>{T||(this.eventData.lastSuccess=b,this.eventData.tokenU=h)},g):this.processRequests()}},Rt=Ge.postTurnstileEvent.bind(Ge),Ot=new class extends pt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(g,a,h,y){this.skuToken=a,this.errorCb=y,r.e.EVENTS_URL&&(h||r.e.ACCESS_TOKEN?this.queueRequest({id:g,timestamp:Date.now()},h):this.errorCb(new Error(dt)))}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;const{id:a,timestamp:h}=this.queue.shift();a&&this.success[a]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),r.v(this.anonId)||this.refreshUUID(),this.postEvent(h,{sdkIdentifier:"mapbox-gl-js",sdkVersion:x,skuId:Je,skuToken:this.skuToken,userId:this.anonId},y=>{y?this.errorCb(y):a&&(this.success[a]=!0)},g))}remove(){this.errorCb=null}},Ci=Ot.postMapLoadEvent.bind(Ot),Hi=new class extends pt{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(g){let a=this.mapInstanceIdMap.get(g);return a||(a=r.u(),this.mapInstanceIdMap.set(g,a)),a}getEventId(g){const a=this.eventIdPerMapInstanceMap.get(g)||0;return this.eventIdPerMapInstanceMap.set(g,a+1),a}postStyleLoadEvent(g,a){const{map:h,style:y,importedStyles:b}=a;if(!r.e.EVENTS_URL||!g&&!r.e.ACCESS_TOKEN)return;const T=this.getMapInstanceId(h),E={mapInstanceId:T,eventId:this.getEventId(T),style:y};b.length&&(E.importedStyles=b),this.queueRequest({timestamp:Date.now(),payload:E},g)}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:a,payload:h}=this.queue.shift();this.postEvent(a,h,()=>{},g)}},ei=Hi.postStyleLoadEvent.bind(Hi),si=new class extends pt{constructor(g){super("metrics"),g&&(this.data=g)}postMetricsEvent(g){if(!r.e.EVENTS_URL||!g&&!r.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),r.v(this.anonId)||this.refreshUUID();const a=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:a},g)}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:a,payload:h}=this.queue.shift();this.postEvent(a,h,()=>{},g)}}
vendor: 5,675 bytes, line 821
821({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Oi=si.postMetricsEvent.bind(si),Ei=new class extends pt{constructor(){super("gljs.performance")}postPerformanceEvent(g,a){r.e.EVENTS_URL&&(g||r.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:a},g)}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:a,performanceData:h}=this.queue.shift(),y=function(b){const T=performance.getEntriesByType("resource"),E=performance.getEntriesByType("mark"),P=function(Z){const Y={};if(Z){for(const J in Z)if(J!=="other")for(const se of Z[J]){const ne=`${J}ResolveRangeMin`,ae=`${J}ResolveRangeMax`,fe=`${J}RequestCount`,ue=`${J}RequestCachedCount`;Y[ne]=Math.min(Y[ne]||1/0,se.startTime),Y[ae]=Math.max(Y[ae]||-1/0,se.responseEnd);const Ce=me=>{Y[me]===void 0&&(Y[me]=0),++Y[me]};se.transferSize!==void 0&&se.transferSize===0&&Ce(ue),Ce(fe)}}return Y}(function(Z,Y){const J={};if(Z)for(const se of Z){const ne=Y(se);J[ne]===void 0&&(J[ne]=[]),J[ne].push(se)}return J}(T,I)),M=window.devicePixelRatio,L=navigator.connection||navigator.mozConnection||navigator.webkitConnection,O=L?L.effectiveType:void 0,H={counters:[],metadata:[],attributes:[]},F=(Z,Y,J)=>{J!=null&&Z.push({name:Y,value:J.toString()})};for(const Z in P)F(H.counters,Z,P[Z]);if(b.interactionRange[0]!==1/0&&b.interactionRange[1]!==-1/0&&(F(H.counters,"interactionRangeMin",b.interactionRange[0]),F(H.counters,"interactionRangeMax",b.interactionRange[1])),E)for(const Z of Object.values(S)){const Y=E.find(J=>J.name===Z);Y&&F(H.counters,Z,Y.startTime)}return F(H.counters,"visibilityHidden",b.visibilityHidden),F(H.attributes,"style",function(Z){if(Z)for(const Y of Z){const J=Y.name.split("?")[0];if(r.i(J)){const se=J.split("/").slice(-2);if(se.length===2)return`mapbox://styles/${se[0]}/${se[1]}`}}}(T)),F(H.attributes,"terrainEnabled",b.terrainEnabled?"true":"false"),F(H.attributes,"fogEnabled",b.fogEnabled?"true":"false"),F(H.attributes,"projection",b.projection),F(H.attributes,"zoom",b.zoom),F(H.metadata,"devicePixelRatio",M),F(H.metadata,"connectionEffectiveType",O),F(H.metadata,"navigatorUserAgent",navigator.userAgent),F(H.metadata,"screenWidth",window.screen.width),F(H.metadata,"screenHeight",window.screen.height),F(H.metadata,"windowWidth",window.innerWidth),F(H.metadata,"windowHeight",window.innerHeight),F(H.metadata,"mapWidth",b.width/M),F(H.metadata,"mapHeight",b.height/M),F(H.metadata,"webglRenderer",b.renderer),F(H.metadata,"webglVendor",b.vendor),F(H.metadata,"sdkVersion",x),F(H.metadata,"sdkIdentifier","mapbox-gl-js"),H}(h);for(const b of y.metadata);for(const b of y.counters);for(const b of y.attributes);this.postEvent(a,y,()=>{},g)}},Ai=Ei.postPerformanceEvent.bind(Ei),Xi=new class extends pt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(g,a,h,y){if(!r.e.API_URL||!r.e.SESSION_PATH)return;const b=kt(r.e.API_URL+r.e.SESSION_PATH);b.params.push(`sku=${a||""}`),b.params.push(`access_token=${y||r.e.ACCESS_TOKEN||""}`);const T={url:Vt(b),headers:{"Content-Type":"text/plain"}};this.pendingRequest=r.g(T,E=>{this.pendingRequest=null,h(E),this.saveEventData(),this.processRequests(y)})}getSessionAPI(g,a,h,y){this.skuToken=a,this.errorCb=y,r.e.SESSION_PATH&&r.e.API_URL&&(h||r.e.ACCESS_TOKEN?this.queueRequest({id:g,timestamp:Date.now()},h):this.errorCb(new Error(dt)))}processRequests(g){if(this.pendingRequest||this.queue.length===0)return;const{id:a,timestamp:h}=this.queue.shift();a&&this.success[a]||this.getSession(h,this.skuToken,y=>{y?this.errorCb(y):a&&(this.success[a]=!0)},g)}remove(){this.errorCb=null}},Nn=Xi.getSessionAPI.bind(Xi),zi=new Set;function Gi(g,a){a?zi.add(g):zi.delete(g)}class Sr{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(a,h){this._updatedSourceCaches[a]=h,this.setDirty()}discardSourceCacheUpdate(a){delete this._updatedSourceCaches[a]}updateLayer(a){const h=a.scope;this._updatedLayers[h]=this._updatedLayers[h]||new Set,this._updatedLayers[h].add(a.id),this.setDirty()}removeLayer(a){const h=a.scope;this._removedLayers[h]=this._removedLayers[h]||{},this._updatedLayers[h]=this._updatedLayers[h]||new Set,this._removedLayers[h][a.id]=a,this._updatedLayers[h].delete(a.id),this._updatedPaintProps.delete(a.fqid),this.setDirty()}getRemovedLayer(a){return this._removedLayers[a.scope]?this._removedLayers[a.scope][a.id]:null}discardLayerRemoval(a){this._removedLayers[a.scope]&&delete this._removedLayers[a.scope][a.id]}getLayerUpdatesByScope(){const a={};for(const h in this._updatedLayers)a[h]=a[h]||{},a[h].updatedIds=Array.from(this._updatedLayers[h].values());for(const h in this._removedLayers)a[h]=a[h]||{},a[h].removedIds=Object.keys(this._removedLayers[h]);return a}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(a){this._updatedPaintProps.add(a.fqid),this.setDirty()}getUpdatedImages(a){return this._updatedImages[a]?Array.from(this._updatedImages[a].values()):[]}updateImage(a,h){this._updatedImages[h]=this._updatedImages[h]||new Set,this._updatedImages[h].add(r.I.toString(a)),this.setDirty()}resetUpdatedImages(a){this._updatedImages[a]&&this._updatedImages[a].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Kr(g){const{userImage:a}=g;return!!(a&&a.render&&a.render())&&(g.data.replace(new Uint8Array(a.data.buffer)),!0)}
821class rs extends r.E{constructor(a){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=a,a!=="raster"&&r.r()&&(this.imageRasterizerDispatcher=new r.D(r.t(),this,"Image Rasterizer Worker",1))}addScope(a){this.loaded.set(a,!1),this.imageProviders.set(a,new Map),this.images.set(a,new Map),this.updatedImages.set(a,new Set),this.callbackDispatchedThisFrame.set(a,new Set),this.patterns.set(a,new Map),this.atlasImage.set(a,new r.q({width:1,height:1}))}removeScope(a){this.loaded.delete(a),this.imageProviders.delete(a),this.images.delete(a),this.updatedImages.delete(a),this.callbackDispatchedThisFrame.delete(a),this.patterns.delete(a),this.atlasImage.delete(a);const h=this.atlasTexture.get(a);h&&(h.destroy(),this.atlasTexture.delete(a))}addImageProvider(a,h){this.imageProviders.has(h)||this.imageProviders.set(h,new Map),this.imageProviders.get(h).set(a.id,a)}removeImageProvider(a,h){this.imageProviders.has(h)&&this.imageProviders.get(h).delete(a)}getPendingImageProviders(){const a=[];for(const h of this.imageProviders.values())for(const y of h.values())y.hasPendingRequests()&&a.push(y);return a}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new r.x),this._imageRasterizer}isLoaded(){for(const a of this.loaded.keys())if(!this.loaded.get(a))return!1;return!0}setLoaded(a,h){if(this.loaded.get(h)!==a&&(this.loaded.set(h,a),a)){for(const{ids:y,callback:b}of this.requestors)this._notify(y,h,b);this.requestors=[]}}hasImage(a,h){return!!this.getImage(a,h)}getImage(a,h){return this.images.get(h).get(a.toString())}addImage(a,h,y){this._validate(a,y)&&this.images.get(h).set(a.toString(),y)}_validate(a,h){let y=!0;return this._validateStretch(h.stretchX,h.data&&h.data.width)||(this.fire(new r.y(new Error(`Image "${a.name}" has invalid "stretchX" value`))),y=!1),this._validateStretch(h.stretchY,h.data&&h.data.height)||(this.fire(new r.y(new Error(`Image "${a.name}" has invalid "stretchY" value`))),y=!1),this._validateContent(h.content,h)||(this.fire(new r.y(new Error(`Image "${a.name}" has invalid "content" value`))),y=!1),y}_validateStretch(a,h){if(!a)return!0;let y=0;for(const b of a){if(b[0]<y||b[1]<b[0]||h<b[1])return!1;y=b[1]}return!0}_validateContent(a,h){return a?a.length!==4||!h.usvg&&(a[0]<0||h.data.width<a[0]||a[1]<0||h.data.height<a[1]||a[2]<0||h.data.width<a[2]||a[3]<0||h.data.height<a[3])?!1:!(a[2]<a[0]||a[3]<a[1]):!0}updateImage(a,h,y){const b=this.images.get(h).get(a.toString());y.version=b.version+1,this.images.get(h).set(a.toString(),y),this.updatedImages.get(h).add(a),this.removeFromImageRasterizerCache(a,h)}clearUpdatedImages(a){this.updatedImages.get(a).clear()}removeFromImageRasterizerCache(a,h){this.spriteFormat!=="raster"&&(r.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[a],scope:h}):this.imageRasterizer.removeImagesFromCacheByIds([a],h))}removeImage(a,h){const y=this.images.get(h),b=y.get(a.toString());y.delete(a.toString()),this.patterns.get(h).delete(a.toString()),this.removeFromImageRasterizerCache(a,h),b.userImage&&b.userImage.onRemove&&b.userImage.onRemove()}listImages(a){return Array.from(this.images.get(a).keys()).map(h=>r.I.from(h))}getImages(a,h,y){const b=[],T=[],E=this.imageProviders.get(h);for(const O of a){if(!O.iconsetId){b.push(O);continue}const H=E.get(O.iconsetId);H&&(this.getImage(O,h)?T.push(O):H.addPendingRequest(O))}if(b.length===0)return void this._notify(T,h,y);let P=!0;const M=!!this.loaded.get(h),L=this.images.get(h);if(!M)for(const O of b)L.has(O.toString())||(P=!1);M||P?this._notify(b,h,y):this.requestors.push({ids:b,scope:h,callback:y})}rasterizeImages(a,h){const y=new Map,{tasks:b,scope:T}=a;for(const[E,P]of b.entries()){const M=this.getImage(P.id,T);M&&y.set(E,{image:M,imageVariant:P})}this._rasterizeImages(T,y,h)}_rasterizeImages(a,h,y){if(r.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:h,scope:a},y);else{const b=new Map;for(const[T,{image:E,imageVariant:P}
vendor: 4,553 bytes, line 821
821]of h.entries())b.set(T,this.imageRasterizer.rasterize(P,E,a,0));y(void 0,b)}}getUpdatedImages(a){return this.updatedImages.get(a)||new Set}_notify(a,h,y){const b=this.images.get(h),T=new Map;for(const E of a){if(!b.get(E.toString())){if(E.iconsetId)continue;this.fire(new r.z("styleimagemissing",{id:E.name}))}const P=b.get(E.toString());if(!P){r.w(`Image "${E.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 M={data:P.usvg?null:P.data.clone(),pixelRatio:P.pixelRatio,sdf:P.sdf,usvg:P.usvg,version:P.version,stretchX:P.stretchX,stretchY:P.stretchY,content:P.content,hasRenderCallback:!!(P.userImage&&P.userImage.render)};P.usvg&&Object.assign(M,{width:P.icon.usvg_tree.width,height:P.icon.usvg_tree.height}),T.set(r.I.toString(E),M)}y(null,T)}getPixelSize(a){const{width:h,height:y}=this.atlasImage.get(a);return{width:h,height:y}}getPattern(a,h,y){const b=a.toString(),T=this.patterns.get(h),E=T.get(b),P=this.getImage(a,h);if(!P)return null;if(E){if(E.position.version===P.version)return E.position;E.position.version=P.version}else{if(P.usvg&&!P.data){const M=this.getPatternInFlightId(b,h);if(this.patternsInFlight.has(M))return null;this.patternsInFlight.add(M);const L=new r.A(a).scaleSelf(r.o.devicePixelRatio),O=new Map([[L.toString(),{image:P,imageVariant:L}]]);return this._rasterizeImages(h,O,(H,F)=>this.storePatternImage(L,h,P,y,F)),null}this.storePattern(a,h,P)}return this._updatePatternAtlas(h,y),T.get(b).position}getPatternInFlightId(a,h){return r.B(a,h)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(a,h,y,b,T){const E=a.toString(),P=T?T.get(E):void 0;P&&(y.data=P,this.storePattern(a.id,h,y),this._updatePatternAtlas(h,b),this.patternsInFlight.delete(this.getPatternInFlightId(a.id.toString(),h)))}storePattern(a,h,y){const b={w:y.data.width+2*r.C,h:y.data.height+2*r.C,x:0,y:0},T=new r.F(b,y,r.C);this.patterns.get(h).set(a.toString(),{bin:b,position:T})}destroyAtlasTextures(){for(const a of this.atlasTexture.values())a&&a.destroy();this.atlasTexture.clear()}bind(a,h){const y=a.gl;let b=this.atlasTexture.get(h);b?this.dirty&&(b.update(this.atlasImage.get(h)),this.dirty=!1):(b=new r.T(a,this.atlasImage.get(h),y.RGBA8),this.atlasTexture.set(h,b)),b.bind(y.LINEAR,y.CLAMP_TO_EDGE)}_updatePatternAtlas(a,h){const y=this.patterns.get(a),b=Array.from(y.values()).map(({bin:L})=>L),{w:T,h:E}=r.G(b),P=this.atlasImage.get(a);P.resize({width:T||1,height:E||1});const M=this.images.get(a);for(const[L,{bin:O,position:H}]of y.entries()){let F=H.padding;const Z=O.x+F,Y=O.y+F,J=M.get(L).data,se=J.width,ne=J.height;F=F>1?F-1:F,r.q.copy(J,P,{x:0,y:0},{x:Z,y:Y},{width:se,height:ne},h),r.q.copy(J,P,{x:0,y:ne-F},{x:Z,y:Y-F},{width:se,height:F},h),r.q.copy(J,P,{x:0,y:0},{x:Z,y:Y+ne},{width:se,height:F},h),r.q.copy(J,P,{x:se-F,y:0},{x:Z-F,y:Y},{width:F,height:ne},h),r.q.copy(J,P,{x:0,y:0},{x:Z+se,y:Y},{width:F,height:ne},h),r.q.copy(J,P,{x:se-F,y:ne-F},{x:Z-F,y:Y-F},{width:F,height:F},h),r.q.copy(J,P,{x:0,y:ne-F},{x:Z+se,y:Y-F},{width:F,height:F},h),r.q.copy(J,P,{x:0,y:0},{x:Z+se,y:Y+ne},{width:F,height:F},h),r.q.copy(J,P,{x:se-F,y:0},{x:Z-F,y:Y+ne},{width:F,height:F},h)}this.dirty=!0}beginFrame(){for(const a of this.images.keys())this.callbackDispatchedThisFrame.set(a,new Set)}dispatchRenderCallbacks(a,h){const y=this.images.get(h);for(const b of a){if(this.callbackDispatchedThisFrame.get(h).has(b.toString()))continue;this.callbackDispatchedThisFrame.get(h).add(b.toString());const T=y.get(b.toString());Kr(T)&&this.updateImage(b,h,T)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Yn(g){const a=g.value,h=g.valueSpec,y=g.style,b=g.styleSpec,T=g.key,E=g.arrayElementValidator||bn;if(!Array.isArray(a))return[new r.V(T,a,`array expected, ${r.K(a)} found`)];if(h.length&&a.length!==h.length)return[new r.V(T,a,`array length ${h.length} expected, length ${a.length} found`)];if(h["min-length"]&&a.length<h["min-length"])return[new r.V(T,a,`array length at least ${h["min-length"]} expected, length ${a.length} found`)];let P={type:h.value,values:h.values,minimum:h.minimum,maximum:h.maximum,function:void 0};b.$version<7&&(P.function=h.function),r.H(h.value)&&(P=h.value);let M=[];for(let L=0;L<a.length;L++)M=M.concat(E({array:a,arrayIndex:L,value:a[L],valueSpec:P,style:y,styleSpec:b,key:`${T}[${L}]`},!0));return M}function Ys(g){const a=g.key,h=g.value,y=g.valueSpec;
821if(!r.L(h))return[new r.V(a,h,`number expected, ${r.K(h)} found`)];if(h!=h)return[new r.V(a,h,"number expected, NaN found")];if("minimum"in y){let b=y.minimum;if(Array.isArray(y.minimum)&&(b=y.minimum[g.arrayIndex]),h<b)return[new r.V(a,h,`${h} is less than the minimum value ${b}`)]}if("maximum"in y){let b=y.maximum;if(Array.isArray(y.maximum)&&(b=y.maximum[g.arrayIndex]),h>b)return[new r.V(a,h,`${h} is greater than the maximum value ${b}`)]}return[]}function Ia(g){const a=g.key,h=g.value;if(!r.H(h))return[new r.V(a,h,`object expected, ${r.K(h)} found`)];const y=g.valueSpec,b=r.J(h.type);let T,E,P,M={};const L=b!=="categorical"&&h.property===void 0,O=!L,H=function(J){const se=J.stops;return Array.isArray(se)&&Array.isArray(se[0])&&r.H(se[0][0])}(h),F=Br({key:g.key,value:g.value,valueSpec:g.styleSpec.function,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{stops:function(J){if(b==="identity")return[new r.V(J.key,J.value,'identity function may not have a "stops" property')];let se=[];const ne=J.value;return se=se.concat(Yn({key:J.key,value:ne,valueSpec:J.valueSpec,style:J.style,styleSpec:J.styleSpec,arrayElementValidator:Z})),Array.isArray(ne)&&ne.length===0&&se.push(new r.V(J.key,ne,"array must have at least one stop")),se},default:function(J){return bn({key:J.key,value:J.value,valueSpec:y,style:J.style,styleSpec:J.styleSpec})}}});return b==="identity"&&L&&F.push(new r.V(g.key,g.value,'missing required property "property"')),b==="identity"||h.stops||F.push(new r.V(g.key,g.value,'missing required property "stops"')),b==="exponential"&&y.expression&&!r.M(y)&&F.push(new r.V(g.key,g.value,"exponential functions not supported")),g.styleSpec.$version>=8&&(O&&!r.N(y)?F.push(new r.V(g.key,g.value,"property functions not supported")):L&&!r.O(y)&&F.push(new r.V(g.key,g.value,"zoom functions not supported"))),b!=="categorical"&&!H||h.property!==void 0||F.push(new r.V(g.key,g.value,'"property" property is required')),F;function Z(J){let se=[];const ne=J.value,ae=J.key;if(!Array.isArray(ne))return[new r.V(ae,ne,`array expected, ${r.K(ne)} found`)];if(ne.length!==2)return[new r.V(ae,ne,`array length 2 expected, length ${ne.length} found`)];if(H){if(!r.H(ne[0]))return[new r.V(ae,ne,`object expected, ${r.K(ne[0])} found`)];const fe=ne[0];if(fe.zoom===void 0)return[new r.V(ae,ne,"object stop key must have zoom")];if(fe.value===void 0)return[new r.V(ae,ne,"object stop key must have value")];const ue=r.J(fe.zoom);if(typeof ue!="number")return[new r.V(ae,fe.zoom,"stop zoom values must be numbers")];if(P&&P>ue)return[new r.V(ae,fe.zoom,"stop zoom values must appear in ascending order")];ue!==P&&(P=ue,E=void 0,M={}),se=se.concat(Br({key:`${ae}[0]`,value:ne[0],valueSpec:{zoom:{}},style:J.style,styleSpec:J.styleSpec,objectElementValidators:{zoom:Ys,value:Y}}))}else se=se.concat(Y({key:`${ae}[0]`,value:ne[0],style:J.style,styleSpec:J.styleSpec},ne));return r.Q(r.S(ne[1]))?se.concat([new r.V(`${ae}[1]`,ne[1],"expressions are not allowed in function stops.")]):se.concat(bn({key:`${ae}[1]`,value:ne[1],valueSpec:y,style:J.style,styleSpec:J.styleSpec}))}function Y(J,se){const ne=r.K(J.value),ae=r.J(J.value),fe=J.value!==null?J.value:se;if(T){if(ne!==T)return[new r.V(J.key,fe,`${ne} stop domain type must match previous stop domain type ${T}`)]}else T=ne;if(ne!=="number"&&ne!=="string"&&ne!=="boolean"&&typeof ae!="number"&&typeof ae!="string"&&typeof ae!="boolean")return[new r.V(J.key,fe,"stop domain value must be a number, string, or boolean")];if(ne!=="number"&&b!=="categorical"){let ue=`number expected, ${ne} found`;return r.N(y)&&b===void 0&&(ue+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new r.V(J.key,fe,ue)]}return b!=="categorical"||ne!=="number"||typeof ae=="number"&&isFinite(ae)&&Math.floor(ae)===ae?b!=="categorical"&&ne==="number"&&typeof ae=="number"&&typeof E=="number"&&E!==void 0&&ae<E?[new r.V(J.key,fe,"stop domain values must appear in ascending order")]:(E=ae,b==="categorical"&&ae in M?[new r.V(J.key,fe,"stop domain values must be unique")]:(M[ae]=!0,[])):[new r.V(J.key,fe,`integer expected, found ${String(ae)}`)]}}function Qs(g){const a=(g.expressionContext==="property"?r.W:r.U)(r.S(g.value),g.valueSpec);if(a.result==="error")return a.value.map(y=>new r.V(`${g.key}${y.key}`,g.value,y.message));const h=a.value.expression||a.value._styleExpression.expression;if(g.expressionContext==="property"&&g.propertyKey==="text-font"&&!h.outputDefined())return[new r.V(g.key,g.value,`Invalid data expression for "${g.propertyKey}". Output values must be contained as literals within the expression.`)];if(g.expressionContext==="property"&&g.propertyType==="layout"&&!r.Z(h))return[new r.V(g.key,g.value,'"feature-state" data expressions are not supported with layout properties.')];if(g.expressionContext==="filter")return ot(h,g);if(g.expressionContext==="appearance")return Pt(h,g);if(g.expressionContext&&g.expressionContext.indexOf("cluster")===0){if(!r.X(h,["zoom","feature-state"]))return[new r.V(g.key,g.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(g.expressionContext==="cluster-initial"&&!r.Y(h))return[new r.V(g.key,g.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ot(g,a){const h=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(a.valueSpec&&a.valueSpec.expression)for(const b of a.valueSpec.expression.parameters)h.delete(b);if(h.size===0)return[];const y=[];return g instanceof r._&&h.has(g.name)?[new r.V(a.key,a.value,`["${g.name}"] expression is not supported in a filter for a ${a.object.type}
821 layer with id: ${a.object.id}`)]:(g.eachChild(b=>{y.push(...ot(b,a))}),y)}function Pt(g,a){const h=new Set;if(a.valueSpec&&a.valueSpec.expression)for(const b of a.valueSpec.expression.parameters)h.add(b);if(h.size===0)return[];const y=[];return g instanceof r._&&!h.has(g.name)?[new r.V(a.key,a.value,`["${g.name}"] is not an allowed parameter`)]:(g.eachChild(b=>{y.push(...Pt(b,a))}),y)}function $t(g){const a=g.key,h=g.value,y=g.valueSpec,b=[];return Array.isArray(y.values)?y.values.indexOf(r.J(h))===-1&&b.push(new r.V(a,h,`expected one of [${y.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(y.values).indexOf(r.J(h))===-1&&b.push(new r.V(a,h,`expected one of [${Object.keys(y.values).join(", ")}], ${JSON.stringify(h)} found`)),b}function Li(g){return r.a2(r.S(g.value))?Qs(Object.assign({},g,{expressionContext:"filter",valueSpec:g.styleSpec[`filter_${g.layerType||"fill"}`]})):wi(g)}function wi(g){const a=g.value,h=g.key;if(!Array.isArray(a))return[new r.V(h,a,`array expected, ${r.K(a)} found`)];if(a.length<1)return[new r.V(h,a,"filter array must have at least 1 element")];const y=g.styleSpec;let b=$t({key:`${h}[0]`,value:a[0],valueSpec:y.filter_operator});switch(r.J(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&r.J(a[1])==="$type"&&b.push(new r.V(h,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":a.length!==3&&b.push(new r.V(h,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&(r.a0(a[1])||b.push(new r.V(`${h}[1]`,a[1],`string expected, ${r.K(a[1])} found`)));for(let T=2;T<a.length;T++)r.J(a[1])==="$type"?b=b.concat($t({key:`${h}[${T}]`,value:a[T],valueSpec:y.geometry_type})):r.a0(a[T])||r.L(a[T])||r.$(a[T])||b.push(new r.V(`${h}[${T}]`,a[T],`string, number, or boolean expected, ${r.K(a[T])} found.`));break;case"any":case"all":case"none":for(let T=1;T<a.length;T++)b=b.concat(wi({key:`${h}[${T}]`,value:a[T],style:g.style,styleSpec:g.styleSpec}));break;case"has":case"!has":a.length!==2?b.push(new r.V(h,a,`filter array for "${a[0]}" operator must have 2 elements`)):r.a0(a[1])||b.push(new r.V(`${h}[1]`,a[1],`string expected, ${r.K(a[1])} found`))}return b}function pi(g,a){const h=g.key,y=g.style,b=g.layer,T=g.styleSpec,E=g.value,P=g.objectKey,M=T[`${a}_${g.layerType}`];if(!M)return[];const L=P.match(/^(.*)-use-theme$/);if(L&&M[L[1]])return r.Q(r.S(E))?[].concat(bn({key:h,value:E,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:y,styleSpec:T,expressionContext:"property",propertyType:a,propertyKey:P})):bn({key:h,value:E,valueSpec:{type:"string"},style:y,styleSpec:T});const O=P.match(/^(.*)-transition$/);if(a==="paint"&&O&&M[O[1]]&&M[O[1]].transition)return bn({key:h,value:E,valueSpec:T.transition,style:y,styleSpec:T});const H=g.valueSpec||M[P];if(!H)return[new r.a3(h,E,`unknown property "${P}"`)];let F;if(r.a0(E)&&r.N(H)&&!H.tokens&&(F=/^{([^}]+)}$/.exec(E))){const Y=`\`{ "type": "identity", "property": ${F?JSON.stringify(F[1]):'"_"'} }\``;return[new r.V(h,E,`"${P}" does not support interpolation syntax 822Use an identity property function instead: ${Y}.`)]}const Z=[];if(g.layerType==="symbol")P!=="text-field"||!y||y.glyphs||y.imports||Z.push(new r.V(h,E,'use of "text-field" requires a style "glyphs" property')),P==="text-font"&&r.a4(r.S(E))&&r.J(E.type)==="identity"&&Z.push(new r.V(h,E,'"text-font" does not support identity functions'));else if(g.layerType==="model"&&a==="paint"&&b&&b.layout&&b.layout.hasOwnProperty("model-id")&&r.N(H)&&(r.a5(H)||r.O(H))){const Y=r.W(r.S(E),H).value,J="expression"in Y&&Y.expression||"_styleExpression"in Y&&Y._styleExpression&&Y._styleExpression.expression;J&&!r.X(J,["measure-light"])&&(P==="model-emissive-strength"&&r.Y(J)&&r.Z(J)||Z.push(new r.V(h,E,`${P} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return Z.concat(bn({key:g.key,value:E,valueSpec:H,style:y,styleSpec:T,expressionContext:"property",propertyType:a,propertyKey:P}))}function en(g){return pi(g,"paint")}function jn(g){return pi(g,"layout")}function ss(g){let a=[];const h=g.value,y=g.key,b=g.style,T=g.styleSpec;if(!r.H(h))return[new r.V(y,h,"object expected")];h.type||h.ref||a.push(new r.V(y,h,'either "type" or "ref" is required'));let E=r.J(h.type);const P=r.J(h.ref);
822if(h.id){const M=r.J(h.id);for(let L=0;L<g.arrayIndex;L++){const O=b.layers[L];r.J(O.id)===M&&a.push(new r.V(y,h.id,`duplicate layer id "${M}", previously used at line ${O.id.__line__}`))}}if("ref"in h){let M;["type","source","source-layer","filter","layout"].forEach(L=>{L in h&&a.push(new r.V(y,h[L],`"${L}" is prohibited for ref layers`))}),b.layers.forEach(L=>{r.J(L.id)===P&&(M=L)}),M?M.ref?a.push(new r.V(y,h.ref,"ref cannot reference another ref layer")):E=r.J(M.type):typeof P=="string"&&a.push(new r.V(y,h.ref,`ref layer "${P}" not found`))}else if(E!=="background"&&E!=="sky"&&E!=="slot")if(h.source)if(r.a0(h.source)){const M=b.sources&&b.sources[h.source],L=M&&r.J(M.type);M?L==="vector"&&E==="raster"?a.push(new r.V(y,h.source,`layer "${h.id}" requires a raster source`)):L==="raster"&&E!=="raster"?a.push(new r.V(y,h.source,`layer "${h.id}" requires a vector source`)):L!=="vector"||h["source-layer"]?L==="raster-dem"&&E!=="hillshade"?a.push(new r.V(y,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):L!=="raster-array"||["raster","raster-particle"].includes(E)?E==="line"&&h.paint&&(h.paint["line-gradient"]||h.paint["line-trim-offset"])&&L==="geojson"&&!M.lineMetrics?a.push(new r.V(y,h,`layer "${h.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):E==="raster-particle"&&L!=="raster-array"&&a.push(new r.V(y,h.source,`layer "${h.id}" requires a 'raster-array' source.`)):a.push(new r.V(y,h.source,"raster-array source can only be used with layer type 'raster'.")):a.push(new r.V(y,h,`layer "${h.id}" must specify a "source-layer"`)):a.push(new r.V(y,h.source,`source "${h.source}" not found`))}else a.push(new r.V(`${y}.source`,h.source,'"source" must be a string'));else a.push(new r.V(y,h,'missing required property "source"'));return a=a.concat(Br({key:y,value:h,valueSpec:T.layer,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":()=>[],type:()=>bn({key:`${y}.type`,value:h.type,valueSpec:T.layer.type,style:g.style,styleSpec:g.styleSpec,object:h,objectKey:"type"}),filter:M=>Li(Object.assign({layerType:E},M)),layout:M=>Br({layer:h,key:M.key,value:M.value,valueSpec:{},style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":L=>jn(Object.assign({layerType:E},L))}}),paint:M=>Br({layer:h,key:M.key,value:M.value,valueSpec:{},style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":L=>en(Object.assign({layerType:E,layer:h},L))}}),appearances(M){const L=Yn({key:M.key,value:M.value,valueSpec:M.valueSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:F=>function(Z){const{key:Y,layer:J,layerType:se}=Z,ne=r.J(Z.value),ae=r.J(ne.name),fe=r.J(ne.condition),ue=Br({key:Y,value:ne,valueSpec:Z.styleSpec.appearance,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{condition:Ce=>function(me){const Ie=[];return Ie.push(...Qs({key:me.key,value:me.object.condition,valueSpec:r.a6.appearance.condition,expressionContext:"appearance"})),Ie}(Object.assign({layer:J,layerType:se},Ce)),properties:Ce=>function(me){const Ie=[],{styleSpec:Se,layer:ve,layerType:ke}=me,Ke=Se[`paint_${ke}`],$e=Se[`layout_${ke}`],ct=me.object[me.objectKey];for(const it in ct){const gt=it in Ke?"paint":it in $e?"layout":void 0;if(!gt){Ie.push(new r.V(me.key,it,`unknown property "${it}" for layer type "${ke}"`));continue}const jt=Object.assign({},me,{key:`${me.key}.${it}`,object:ct,objectKey:it,layer:ve,layerType:ke,value:ct[it],valueSpec:gt==="paint"?Ke[it]:$e[it]});Ie.push(...pi(jt,gt))}return Ie}(Object.assign({layer:J,layerType:se},Ce))}});return ae!=="hidden"&&fe===void 0&&ue.push(new r.V(Z.key,"name",'Appearance with name different than "hidden" must have a condition')),ue}(Object.assign({layerType:E,layer:h},F))}),O=Array.isArray(M.value)?M.value:[],H=new Set;return O.forEach((F,Z)=>{const Y=r.J(F.name);if(Y)if(H.has(Y)){const J=r.J(h.id);L.push(new r.V(M.key,Y,`Duplicated appearance name "${Y}" for layer "${J}"`))}else H.add(Y)}),L}}})),a}function es({key:g,value:a}){return r.a0(a)?[]:[new r.V(g,a,`string expected, ${r.K(a)} found`)]}const dl={promoteId:function g({key:a,value:h}
822){if(r.a0(h))return es({key:a,value:h});if(Array.isArray(h)){const b=[],T=r.S(h),E=r.U(T);return E.result==="error"&&E.value.forEach(P=>{b.push(new r.V(`${a}${P.key}`,null,`${P.message}`))}),r.X(E.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"])||b.push(new r.V(`${a}`,null,"promoteId expression should be only feature dependent")),b}if(!r.H(h))return[new r.V(a,h,`string, expression or object expected, "${r.K(h)}" found`)];const y=[];for(const b in h)y.push(...g({key:`${a}.${b}`,value:h[b]}));return y}};function ta(g){const a=g.value,h=g.key,y=g.styleSpec,b=g.style;if(!r.H(a))return[new r.V(h,a,`object expected, ${r.K(a)} found`)];if(!("type"in a))return[new r.V(h,a,'"type" is required')];const T=r.J(a.type);let E=[];switch(["vector","raster","raster-dem","raster-array"].includes(T)&&("url"in a||"tiles"in a||E.push(new r.a3(h,a,'Either "url" or "tiles" is required.'))),T){case"vector":case"raster":case"raster-dem":case"raster-array":return E=E.concat(Br({key:h,value:a,valueSpec:y[`source_${T.replace("-","_")}`],style:g.style,styleSpec:y,objectElementValidators:dl})),E;case"geojson":if(E=Br({key:h,value:a,valueSpec:y.source_geojson,style:b,styleSpec:y,objectElementValidators:dl}),"cluster"in a&&"clusterProperties"in a){if(!r.H(a.clusterProperties))return[new r.V(`${h}.clusterProperties`,a,`object expected, ${r.K(a)} found`)];for(const P in a.clusterProperties){const M=a.clusterProperties[P];if(!Array.isArray(M))return[new r.V(`${h}.clusterProperties.${P}`,M,"array expected")];const[L,O]=M,H=typeof L=="string"?[L,["accumulated"],["get",P]]:L;E.push(...Qs({key:`${h}.${P}.map`,value:O,expressionContext:"cluster-map"})),E.push(...Qs({key:`${h}.${P}.reduce`,value:H,expressionContext:"cluster-reduce"}))}}return E;case"video":return Br({key:h,value:a,valueSpec:y.source_video,style:b,styleSpec:y});case"image":return Br({key:h,value:a,valueSpec:y.source_image,style:b,styleSpec:y});case"canvas":return[new r.V(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $t({key:`${h}.type`,value:a.type,valueSpec:{values:Fr(y)}})}}function Fr(g){return g.source.reduce((a,h)=>{const y=g[h];return y.type.type==="enum"&&(a=a.concat(Object.keys(y.type.values||{}))),a},[])}function co(g){const a=g.value,h=g.styleSpec,y=h.light,b=g.style;if(a===void 0)return[];if(!r.H(a))return[new r.V("light",a,`object expected, ${r.K(a)} found`)];let T=[];for(const E in a){const P=E.match(/^(.*)-transition$/),M=E.match(/^(.*)-use-theme$/);T=T.concat(M&&y[M[1]]?bn({key:E,value:a[E],valueSpec:{type:"string"},style:b,styleSpec:h}):P&&y[P[1]]&&y[P[1]].transition?bn({key:E,value:a[E],valueSpec:h.transition,style:b,styleSpec:h}):y[E]?bn({key:E,value:a[E],valueSpec:y[E],style:b,styleSpec:h}):[new r.V(E,a[E],`unknown property "${E}"`)])}return T}function qo(g){const a=g.value;if(!a)return[];const h=g.key;if(!r.H(a))return[new r.V(h,a,`object expected, ${r.K(a)} found`)];let y=[];const b=g.styleSpec,T=b["light-3d"],E=g.style,P=g.style.lights;for(const O of["type","id"])if(!(O in a))return y=y.concat([new r.V(h,a,`missing property "${O}"`)]),y;if(!r.a0(a.type))return y=y.concat([new r.V(`${h}.type`,a.type,"string expected")]),y;if(P)for(let O=0;O<g.arrayIndex;O++){const H=r.J(a.type),F=P[O];r.J(F.type)===H&&y.push(new r.V(h,a.id,`duplicate light type "${a.type}", previously defined at line ${F.id.__line__}`))}const M=`properties_light_${a.type}`;if(!(M in b))return y=y.concat([new r.V(`${h}.type`,a,`Invalid light type ${a.type}`)]),y;const L=b[M];for(const O in a)if(O==="properties"){const H=a[O];if(!r.H(H))return y=y.concat([new r.V("properties",H,`object expected, ${r.K(H)} found`)]),y;for(const F in H){const Z=F.match(/^(.*)-transition$/),Y=F.match(/^(.*)-use-theme$/);y=y.concat(Y&&L[Y[1]]?bn({key:O,value:H[F],valueSpec:{type:"string"},style:E,styleSpec:b}):Z&&L[Z[1]]&&L[Z[1]].transition?bn({key:O,value:a[O],valueSpec:b.transition,style:E,styleSpec:b}
822):L[F]?bn({key:F,value:H[F],valueSpec:L[F],style:E,styleSpec:b}):[new r.a3(g.key,H[F],`unknown property "${F}"`)])}}else y=y.concat(T[O]?bn({key:O,value:a[O],valueSpec:T[O],style:E,styleSpec:b}):[new r.a3(O,a[O],`unknown property "${O}"`)]);return y}function ia(g){const a=g.value,h=g.key,y=g.style,b=g.styleSpec,T=b.terrain;if(a==null)return[];if(!r.H(a))return[new r.V("terrain",a,`object expected, ${r.K(a)} found`)];let E=[];for(const P in a){const M=P.match(/^(.*)-transition$/),L=P.match(/^(.*)-use-theme$/);E=E.concat(L&&T[L[1]]?bn({key:P,value:a[P],valueSpec:{type:"string"},style:y,styleSpec:b}):M&&T[M[1]]&&T[M[1]].transition?bn({key:P,value:a[P],valueSpec:b.transition,style:y,styleSpec:b}):T[P]?bn({key:P,value:a[P],valueSpec:T[P],style:y,styleSpec:b}):[new r.a3(P,a[P],`unknown property "${P}"`)])}if(a.source)if(r.a0(a.source)){const P=y.sources&&y.sources[a.source],M=P&&r.J(P.type);P?M!=="raster-dem"&&E.push(new r.V(`${h}.source`,a.source,`terrain cannot be used with a source of type ${M}, it only be used with a "raster-dem" source type`)):E.push(new r.V(`${h}.source`,a.source,`source "${a.source}" not found`))}else E.push(new r.V(`${h}.source`,a.source,"source must be a string"));else E.push(new r.V(h,a,'terrain is missing required property "source"'));return E}function Qe(g){const a=g.value,h=g.style,y=g.styleSpec,b=y.fog;if(a===void 0)return[];if(!r.H(a))return[new r.V("fog",a,`object expected, ${r.K(a)} found`)];let T=[];for(const E in a){const P=E.match(/^(.*)-transition$/),M=E.match(/^(.*)-use-theme$/);T=T.concat(M&&b[M[1]]?bn({key:E,value:a[E],valueSpec:{type:"string"},style:h,styleSpec:y}):P&&b[P[1]]&&b[P[1]].transition?bn({key:E,value:a[E],valueSpec:y.transition,style:h,styleSpec:y}):b[E]?bn({key:E,value:a[E],valueSpec:b[E],style:h,styleSpec:y}):[new r.a3(E,a[E],`unknown property "${E}"`)])}return T}const Di={"*":()=>[],array:Yn,boolean:function(g){const a=g.value,h=g.key;return r.$(a)?[]:[new r.V(h,a,`boolean expected, ${r.K(a)} found`)]},number:Ys,color:function({key:g,value:a}){return r.a0(a)?r.a1.parseCSSColor(a)===null?[new r.V(g,a,`color expected, "${a}" found`)]:[]:[new r.V(g,a,`color expected, ${r.K(a)} found`)]},enum:$t,filter:Li,function:Ia,layer:ss,object:Br,source:ta,model:r.a7,light:co,"light-3d":qo,terrain:ia,fog:Qe,string:es,formatted:function(g){return es(g).length===0?[]:Qs(g)},resolvedImage:function(g){return es(g).length===0?[]:Qs(g)},projection:function(g){const a=g.value,h=g.styleSpec,y=h.projection,b=g.style;if(r.H(a)){let T=[];for(const E in a)T=T.concat(bn({key:E,value:a[E],valueSpec:y[E],style:b,styleSpec:h}));return T}return r.a0(a)?[]:[new r.V("projection",a,`object or string expected, ${r.K(a)} found`)]},import:function(g){const a=g.key,{value:h,styleSpec:y}=g;if(!r.H(h))return[new r.V(a,h,"import must be an object")];const{data:b,...T}=h;Object.defineProperty(T,"__line__",{value:h.__line__,enumerable:!1});let E=Br(Object.assign({},g,{value:T,valueSpec:y.import}));return r.J(T.id)===""&&E.push(new r.V(`${g.key}.id`,T,"import id can't be an empty string")),b&&(E=E.concat(yo(b,y,{key:`${g.key}.data`}))),E},iconset:function(g){const a=g.value,h=g.key,y=g.styleSpec,b=g.style;if(!r.H(a))return[new r.V(h,a,"object expected")];if(!a.type)return[new r.V(h,a,'"type" is required')];const T=r.J(a.type);let E=[];if(E=E.concat(Br({key:h,value:a,valueSpec:y[`iconset_${T}`],style:b,styleSpec:y})),function(P,M){return!(P!=="source"||!M.source)}(T,a)){const P=b.sources&&b.sources[a.source],M=P&&r.J(P.type);P?M!=="raster-array"&&E.push(new r.V(h,a.source,`iconset cannot be used with a source of type ${String(M)}, it only be used with a "raster-array" source type`)):E.push(new r.V(h,a.source,`source "${a.source}" not found`))}return E}};function bn(g,a=!1){const h=g.value,y=g.valueSpec,b=g.styleSpec;if(y.expression){if(r.a4(r.J(h)))return Ia(g);if(r.Q(r.S(h)))return Qs(g)}if(y.type&&Di[y.type]){const T=Di[y.type](g);return a===!0&&T.length>0&&Array.isArray(g.value)?Qs(g):T}return Br(Object.assign({},g,{valueSpec:y.type?b[y.type]:y}))}function Br(g){const a=g.key,h=g.value,y=g.valueSpec||{},b=g.objectElementValidators||{},T=g.style,E=g.styleSpec;if(!r.H(h))return[new r.V(a,h,`object expected, ${r.K(h)} found`)];let P=[];for(const M in h){const L=M.split(".")[0];let O;b[L]?O=b[L]:y[L]?O=bn:b["*"]?O=b["*"]:y["*"]&&(O=bn),O?P=P.concat(O({key:(a&&`${a}.`)+M,value:h[M],valueSpec:y[L]||y["*"],style:T,styleSpec:E,object:h,objectKey:M},h)):P.push(new r.a3(a,h[M],`unknown property "${M}"`))}for(const M in y){if(b[M])continue;const L=y[M];L.required&&L.default===void 0&&h[M]===void 0&&P.push(new r.V(a,h,`missing required property "${M}"`))}return P}
822function na({key:g,value:a}){const h=es({key:g,value:a});if(h.length)return h;const y=a;return y.indexOf("{fontstack}")===-1&&h.push(new r.V(g,a,'"glyphs" url must include a "{fontstack}" token')),y.indexOf("{range}")===-1&&h.push(new r.V(g,a,'"glyphs" url must include a "{range}" token')),h}function yo(g,a=r.a6,h={}){return Br({key:h.key||"",value:g,valueSpec:Object.assign(a.$root,{"*":{type:"*"}}),styleSpec:a,style:g,objectElementValidators:{glyphs:na}})}function Mo(g,a=r.a6){return We(yo(g,a))}const hu=g=>We(ta(g)),qs=g=>We(co(g)),pu=g=>We(qo(g)),Hd=g=>We(ia(g)),Tt=g=>We(Qe(g)),Nl=g=>We(function(a){const h=a.value,y=a.style,b=a.styleSpec,T=b.snow;if(h===void 0)return[];if(!r.H(h))return[new r.V("snow",h,`object expected, ${r.K(h)} found`)];let E=[];for(const P in h){const M=P.match(/^(.*)-transition$/);E=E.concat(M&&T[M[1]]&&T[M[1]].transition?bn({key:P,value:h[P],valueSpec:b.transition,style:y,styleSpec:b}):T[P]?bn({key:P,value:h[P],valueSpec:T[P],style:y,styleSpec:b}):[new r.a3(P,h[P],`unknown property "${P}"`)])}return E}(g)),Gd=g=>We(function(a){const h=a.value,y=a.style,b=a.styleSpec,T=b.rain;if(h===void 0)return[];if(!r.H(h))return[new r.V("rain",h,`object expected, ${r.K(h)} found`)];let E=[];for(const P in h){const M=P.match(/^(.*)-transition$/);E=E.concat(M&&T[M[1]]&&T[M[1]].transition?bn({key:P,value:h[P],valueSpec:b.transition,style:y,styleSpec:b}):T[P]?bn({key:P,value:h[P],valueSpec:T[P],style:y,styleSpec:b}):[new r.a3(P,h[P],`unknown property "${P}"`)])}return E}(g)),Wd=g=>We(ss(g)),Pn=g=>We(Li(g)),Ms=g=>We(en(g)),Vc=g=>We(jn(g)),Kd=g=>We(r.a7(g));function We(g){return g.slice().sort((a,h)=>a.line&&h.line?a.line-h.line:0)}function ie(g,a){let h=!1;if(a&&a.length)for(const y of a)y instanceof r.a3?r.w(y.message):(g.fire(new r.y(new Error(y.message))),h=!0);return h}const re=r.a6.light;let ge;class ze extends r.E{constructor(a,h="flat"){super(),this._transitionable=new r.a8(ge||(ge=new r.a9({anchor:new r.aa(re.anchor),position:new r.ab(re.position),color:new r.aa(re.color),intensity:new r.aa(re.intensity)}))),this.setLight(a,h),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(a,h,y={}){this._validate(qs,a,y)||(this._transitionable.setTransitionOrValue(a),this.id=h
822)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,h,y){return(!y||y.validate!==!1)&&ie(this,a.call(Mo,Object.assign({value:h,style:{glyphs:!0,sprite:!0},styleSpec:r.a6})))}}const Re=r.a6.terrain;let Ue=class extends r.E{constructor(g,a,h,y,b){super(),this.scope=h,this._transitionable=new r.a8(new r.a9({source:new r.aa(Re.source),exaggeration:new r.aa(Re.exaggeration)}),h,y),this._transitionable.setTransitionOrValue(g,y),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=a,this.worldview=b}get(){return this._transitionable.serialize()}set(g,a){this._transitionable.setTransitionOrValue(g,a)}updateTransitions(g){this._transitioning=this._transitionable.transitioned(g,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(g){this.properties=this._transitioning.possiblyEvaluate(g)}getExaggeration(g){return this._transitioning.possiblyEvaluate(new r.ac(g,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const g=this._transitionable._values.exaggeration;if(!g)return null;const a=g.value.expression;if(!a)return null;let h=-1,y=-1,b=1;for(const T of a.zoomStops)b=a.evaluate(new r.ac(T,{worldview:this.worldview})),b>.01?(h=T,y=-1):y=T;return b<.01&&h>0&&y>h?[h,y]:null}isZoomDependent(){const g=this._transitionable._values.exaggeration;return g!=null&&g.value!=null&&g.value.expression!=null&&g.value.expression instanceof r.ad}};const rt=45,He=65,Ve=.05;function Ee(g,a,h,y){const b=r.ah(rt,He,h),[T,E]=Ye(g,y);let P=1-Math.min(1,Math.exp((a-T)/(E-T)*-6));return P*=P*P,P=Math.min(1,1.00747*P),P*b*g.alpha}function Ye(g,a){const h=.5/Math.tan(.5*a);return[g.range[0]+h,g.range[1]+h]}function It(g,a,h,y,b){const T=r.af([],[a,h,y],b.mercatorFogMatrix);return Ee(g,r.ag(T),b.pitch,b._fov)}function vi(g,a,h,y,b,T,E){const P=[[h,y,0],[b,y,0],[b,T,0],[h,T,0]];let M=Number.MAX_VALUE,L=-Number.MAX_VALUE;for(const O of P){const H=r.af([],O,a),F=r.ag(H);M=Math.min(M,F),L=Math.max(L,F)}return[Ee(g,M,E.pitch,E._fov),Ee(g,L,E.pitch,E._fov)]}const bi=r.a6.fog;class di extends r.E{constructor(a,h,y,b){super();const T=new r.a9({range:new r.aa(bi.range),color:new r.aa(bi.color),"color-use-theme":new r.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new r.aa(bi["high-color"]),"high-color-use-theme":new r.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new r.aa(bi["space-color"]),"space-color-use-theme":new r.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new r.aa(bi["horizon-blend"]),"star-intensity":new r.aa(bi["star-intensity"]),"vertical-range":new r.aa(bi["vertical-range"])});this._transitionable=new r.a8(T,y,new Map(b)),this.set(a,b),this._transitioning=this._transitionable.untransitioned(),this._transform=h,this.properties=new r.ai(T),this.scope=y}get state(){const a=this._transform,h=a.projection.name==="globe",y=r.aj(a.zoom),b=this.properties.get("range"),T=[.5,3];return{range:h?[r.ak(T[0],b[0],y),r.ak(T[1],b[1],y)]:b,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(a,h,y={}){if(this._validate(Tt,a,y))return;const b=Object.assign({},a);for(const T of Object.keys(bi))b[T]===void 0&&(b[T]=bi[T].default);this._options=b,this._transitionable.setTransitionOrValue(this._options,h)}getOpacity(a){if(!this._transform.projection.supportsFog)return 0;const h=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:r.ah(rt,He,a))*h.a}getOpacityAtLatLng(a,h){return this._transform.projection.supportsFog?function(y,b,T){const E=r.ae.fromLngLat(b),P=T.elevation?T.elevation.getAtPointOrZero(E):0;return It(y,E.x,E.y,P,T)}(this.state,a,h):0}getOpacityForTile(a){if(!this._transform.projection.supportsFog)return[1,1];const h=this._transform.calculateFogTileMatrix(a.toUnwrapped());return vi(this.state,h,0,0,r.al,r.al,this._transform)}getOpacityForBounds(a,h,y,b,T){return this._transform.projection.supportsFog?vi(this.state,a,h,y,b,T,this._transform):[1,1]}getFovAdjustedRange(a){return this._transform.projection.supportsFog?Ye(this.state,a):[0,1]}isVisibleOnFrustum(a){if(!this._transform.projection.supportsFog)return!1;const h=[4,5,6,7];for(const y of h){const b=a.points[y];let T;if(b[2]>=0)T=b;else{const E=a.points[y-4];T=r.am(E,b,E[2]/(E[2]-b[2]))}if(It(this.state,T[0],T[1],0,this._transform)>=Ve)return!0}return!1}updateConfig(a){this._transitionable.setTransitionOrValue(this._options,new Map(a))}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,h,y){return(!y||y.validate!==!1)&&ie(this,a.call(Mo,Object.assign({value:h,style:{glyphs:!0,sprite:!0},styleSpec:r.a6})))}}let Wi,ln,Hn,Zr,_r=class extends r.E{constructor(g,a,h,y){super();const b=Wi||(Wi=new r.a9({density:new r.aa(r.a6.snow.density),intensity:new r.aa(r.a6.snow.intensity),color:new r.aa(r.a6.snow.color),opacity:new r.aa(r.a6.snow.opacity),vignette:new r.aa(r.a6.snow.vignette),"vignette-color":new r.aa(r.a6.snow["vignette-color"]),"center-thinning":new r.aa(r.a6.snow["center-thinning"]),direction:new r.aa(r.a6.snow.direction),"flake-size":new r.aa(r.a6.snow["flake-size"])}));this._transitionable=new r.a8(b,h,new Map(y)),this.set(g,y),this._transitioning=this._transitionable.untransitioned(),this.properties=new r.ai(b),this.scope=h}get state(){const g=this.properties.get("opacity"),a=this.properties.get("color"),h=this.properties.get("direction"),y=r.an(h[0]),b=-Math.max(r.an(h[1]),.01),T=[Math.cos(y)*Math.cos(b),Math.sin(y)*Math.cos(b),Math.sin(b)],E=this.properties.get("vignette"),P=this.properties.get("vignette-color");return P.a=E,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new r.ao(a.r,a.g,a.b,a.a*g),direction:T,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:P}}get(){return this._transitionable.serialize()}set(g,a,h={}
vendor: 4,874 bytes, line 822
822){if(this._validate(Nl,g,h))return;const y=Object.assign({},g),b=r.a6.snow;for(const T of Object.keys(b))y[T]===void 0&&(y[T]=b[T].default);this._options=y,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(g){this._transitionable.setTransitionOrValue(this._options,new Map(g))}updateTransitions(g){this._transitioning=this._transitionable.transitioned(g,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(g){this.properties=this._transitioning.possiblyEvaluate(g)}_validate(g,a,h){return(!h||h.validate!==!1)&&ie(this,g.call(Mo,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:r.a6})))}},xs=class extends r.E{constructor(g,a,h,y){super();const b=ln||(ln=new r.a9({density:new r.aa(r.a6.rain.density),intensity:new r.aa(r.a6.rain.intensity),color:new r.aa(r.a6.rain.color),opacity:new r.aa(r.a6.rain.opacity),vignette:new r.aa(r.a6.rain.vignette),"vignette-color":new r.aa(r.a6.rain["vignette-color"]),"center-thinning":new r.aa(r.a6.rain["center-thinning"]),direction:new r.aa(r.a6.rain.direction),"droplet-size":new r.aa(r.a6.rain["droplet-size"]),"distortion-strength":new r.aa(r.a6.rain["distortion-strength"])}));this._transitionable=new r.a8(b,h,new Map(y)),this.set(g,y),this._transitioning=this._transitionable.untransitioned(),this.properties=new r.ai(b),this.scope=h}get state(){const g=this.properties.get("opacity"),a=this.properties.get("color"),h=this.properties.get("direction"),y=r.an(h[0]),b=-Math.max(r.an(h[1]),.01),T=[Math.cos(y)*Math.cos(b),Math.sin(y)*Math.cos(b),Math.sin(b)],E=this.properties.get("vignette-color");return E.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new r.ao(a.r,a.g,a.b,a.a*g),direction:T,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:E}}get(){return this._transitionable.serialize()}set(g,a,h={}){if(this._validate(Gd,g,h))return;const y=Object.assign({},g),b=r.a6.rain;for(const T of Object.keys(b))y[T]===void 0&&(y[T]=b[T].default);this._options=y,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(g){this._transitionable.setTransitionOrValue(this._options,new Map(g))}updateTransitions(g){this._transitioning=this._transitionable.transitioned(g,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(g){this.properties=this._transitioning.possiblyEvaluate(g)}_validate(g,a,h){return(!h||h.validate!==!1)&&ie(this,g.call(Mo,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:r.a6})))}};class ps extends r.E{constructor(a,h,y,b){super(),this.scope=y,this._options=a,this.properties=new r.ai(h),this._transitionable=new r.a8(h,y,new Map(b)),this._transitionable.setTransitionOrValue(a.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(a){this._transitionable.setTransitionOrValue(this._options.properties,new Map(a))}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(a,h){this._options=a,this._transitionable.setTransitionOrValue(a.properties,h)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class fr{constructor(a,h,y){this.screenBounds=a,this.cameraPoint=y.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=h,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,y)}static createFromScreenPoints(a,h){let y,b;if(a instanceof r.P||typeof a[0]=="number"){const T=r.P.convert(a);y=[T],b=h.isPointAboveHorizon(T)}else{const T=r.P.convert(a[0]),E=r.P.convert(a[1]),P=T.add(E)._div(2);y=[T,E],b=r.aq(T,E).every(M=>h.isPointAboveHorizon(M))&&h.isPointAboveHorizon(P)}return new fr(y,b,h)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(a){return r.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],a)}bufferedCameraGeometry(a){const h=this.screenBounds[0],y=this.screenBounds.length===1?this.screenBounds[0].add(new r.P(1,1)):this.screenBounds[1],b=r.aq(h,y,0,!1);return this.cameraPoint.y>y.y&&(this.cameraPoint.x>h.x&&this.cameraPoint.x<y.x?b.splice(3,0,this.cameraPoint):this.cameraPoint.x>=y.x?b[2]=this.cameraPoint:this.cameraPoint.x<=h.x&&(b[3]=this.cameraPoint)),r.ar(b,a)}bufferedCameraGeometryGlobe(a){const h=this.screenBounds[0],y=this.screenBounds.length===1?this.screenBounds[0].add(new r.P(1,1)):this.screenBounds[1],b=r.aq(h,y,a),T=this.cameraPoint.clone();
822switch(3*((T.y>h.y)+(T.y>y.y))+((T.x>h.x)+(T.x>y.x))){case 0:b[0]=T,b[4]=T.clone();break;case 1:b.splice(1,0,T);break;case 2:b[1]=T;break;case 3:b.splice(4,0,T);break;case 5:b.splice(2,0,T);break;case 6:b[3]=T;break;case 7:b.splice(3,0,T);break;case 8:b[2]=T}return b}containsTile(a,h,y,b=0){const T=Math.max(a.queryPadding,a.evaluateQueryRenderedFeaturePadding())/h._pixelsPerMercatorPixel+1,E=y?this._bufferedCameraMercator(T,h):this._bufferedScreenMercator(T,h);let P=a.tileID.wrap+(E.unwrapped?b:0);const M=E.polygon.map(se=>r.as(a.tileTransform,se,P));if(!r.at(M,0,0,r.al,r.al))return;P=a.tileID.wrap+(this.screenGeometryMercator.unwrapped?b:0);const L=this.screenGeometryMercator.polygon.map(se=>r.au(a.tileTransform,se,P)),O=L.map(se=>new r.P(se[0],se[1])),H=h.getFreeCameraOptions().position||new r.ae(0,0,0),F=r.au(a.tileTransform,H,P),Z=L.map(se=>{const ne=r.av(se,se,F);return r.aw(ne,ne),new r.ax(F,ne)}),Y=r.ay(a,1,h.zoom)*h._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:O,tilespaceRays:Z,bufferedTilespaceGeometry:M,bufferedTilespaceBounds:(J=r.az(M),J.min.x=r.aA(J.min.x,0,r.al),J.min.y=r.aA(J.min.y,0,r.al),J.max.x=r.aA(J.max.x,0,r.al),J.max.y=r.aA(J.max.y,0,r.al),J),tile:a,tileID:a.tileID,pixelToTileUnitsFactor:Y};var J}_bufferedScreenMercator(a,h){const y=fs(a);if(this._screenRaycastCache[y])return this._screenRaycastCache[y];{let b;return b=h.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(a),h):{polygon:this.bufferedScreenGeometry(a).map(T=>h.pointCoordinate3D(T)),unwrapped:!0},this._screenRaycastCache[y]=b,b}}_bufferedCameraMercator(a,h){const y=fs(a);if(this._cameraRaycastCache[y])return this._cameraRaycastCache[y];{let b;return b=h.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(a),h):{polygon:this.bufferedCameraGeometry(a).map(T=>h.pointCoordinate3D(T)),unwrapped:!0},this._cameraRaycastCache[y]=b,b}}_projectAndResample(a,h){const y=function(T,E){const P=r.aB([],E.pixelMatrix,E.globeMatrix),M=[0,-r.aD,0,1],L=[0,r.aD,0,1],O=[0,0,0,1];r.aC(M,M,P),r.aC(L,L,P),r.aC(O,O,P);const H=new r.P(M[0]/M[3],M[1]/M[3]),F=new r.P(L[0]/L[3],L[1]/L[3]),Z=r.aE(T,H)&&M[3]<O[3],Y=r.aE(T,F)&&L[3]<O[3];if(!Z&&!Y)return null;const J=function(Ie,Se,ve){for(let ke=1;ke<Ie.length;ke++){const Ke=Ur(Se.pointCoordinate3D(Ie[ke-1]).x),$e=Ur(Se.pointCoordinate3D(Ie[ke]).x);if(ve<0){if(Ke<$e)return{idx:ke,t:-Ke/($e-1-Ke)}}else if($e<Ke)return{idx:ke,t:(1-Ke)/($e+1-Ke)}}return null}(T,E,Z?-1:1);if(!J)return null;const{idx:se,t:ne}=J;let ae=se>1?Mn(T.slice(0,se),E):[],fe=se<T.length?Mn(T.slice(se),E):[];ae=ae.map(Ie=>new r.P(Ur(Ie.x),Ie.y)),fe=fe.map(Ie=>new r.P(Ur(Ie.x),Ie.y));const ue=[...ae];ue.length===0&&ue.push(fe[fe.length-1]);const Ce=r.ak(ue[ue.length-1].y,(fe.length===0?ae[0]:fe[0]).y,ne);let me;return me=Z?[new r.P(0,Ce),new r.P(0,0),new r.P(1,0),new r.P(1,Ce)]:[new r.P(1,Ce),new r.P(1,1),new r.P(0,1),new r.P(0,Ce)],ue.push(...me),fe.length===0?ue.push(ae[0]):ue.push(...fe),{polygon:ue.map(Ie=>new r.ae(Ie.x,Ie.y)),unwrapped:!1}}(a,h);if(y)return y;const b=function(T,E){let P=!1,M=-1/0,L=0;for(let H=0;H<T.length-1;H++)T[H].x>M&&(M=T[H].x,L=H);for(let H=0;H<T.length-1;H++){const F=(L+H)%(T.length-1),Z=T[F],Y=T[F+1];Math.abs(Z.x-Y.x)>.5&&(Z.x<Y.x?(Z.x+=1,F===0&&(T[T.length-1].x+=1)):(Y.x+=1,F+1===T.length-1&&(T[0].x+=1)),P=!0)}const O=r.aF(E.center.lng);return P&&O<Math.abs(O-1)&&T.forEach(H=>{H.x-=1}),{polygon:T,unwrapped:P}}(Mn(a,h).map(T=>new r.P(Ur(T.x),T.y)),h);return{polygon:b.polygon.map(T=>new r.ae(T.x,T.y)),unwrapped:b.unwrapped}}}function Mn(g,a){return r.aG(g,h=>{const y=a.pointCoordinate3D(h);h.x=y.x,h.y=y.y},1/256)}function Ur(g){return g<0?1+g%1:g%1}function fs(g){return 100*g|0}function Tr(g,a,h,y,b){const T=function(P,M){if(P)return b(P);if(M){if(g.url&&M.tiles&&g.tiles&&delete g.tiles,M.variants){if(!Array.isArray(M.variants))return b(new Error("variants must be an array"));for(const O of M.variants){if(O==null||typeof O!="object"||O.constructor!==Object)return b(new Error("variant must be an object"));if(!Array.isArray(O.capabilities))return b(new Error("capabilities must be an array"));if(O.capabilities.length===1&&O.capabilities[0]==="meshopt"){M=Object.assign(M,O);break}}}const L=r.aH(Object.assign({},M,g),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);L.tiles=a.canonicalizeTileset(L,g.url),b(null,L)}},E=function(P,M,L){if(!P)return null;if(!M&&!L)return P;
822L=L||P.worldview_default;const O=Object.values(P.language||{});if(O.length===0)return null;const H=Object.values(P.worldview||{});if(H.length===0)return null;const F=O.every(Y=>Y===M),Z=H.every(Y=>Y===L);return F&&Z?P:M in(P.language_options||{})||L in(P.worldview_options||{})?null:P.language_options&&P.worldview_options?P:null}(g.data,h,y);return E?r.o.frame(()=>T(null,E)):g.url?r.m(a.transformRequest(a.normalizeSourceURL(g.url,null,h,y),r.R.Source),T):r.o.frame(()=>{const{data:P,...M}=g;T(null,M)})}function Vr(g,a){const h=Math.pow(2,a.z),y=Math.floor(r.aF(g.getWest())*h),b=Math.floor(r.aJ(g.getNorth())*h),T=Math.ceil(r.aF(g.getEast())*h),E=Math.ceil(r.aJ(g.getSouth())*h);return a.x>=y&&a.x<T&&a.y>=b&&a.y<E}class io{constructor(a,h,y){this.bounds=a?r.aI.convert(this.validateBounds(a)):null,this.minzoom=h||0,this.maxzoom=y||24}validateBounds(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]}addExtraBounds(a){if(a){this.extraBounds||(this.extraBounds=[]);for(const h of a)this.extraBounds.push(r.aI.convert(this.validateBounds(h)))}}contains(a){if(a.z>this.maxzoom||a.z<this.minzoom||this.bounds&&!Vr(this.bounds,a))return!1;if(!this.extraBounds)return!0;for(const h of this.extraBounds)if(Vr(h,a))return!0;return!1}static fromTileJSON(a){if(!a.bounds&&!a.extra_bounds)return null;const h=new io(a.bounds,a.minzoom,a.maxzoom);return h.addExtraBounds(a.extra_bounds),h}}class ga extends r.E{constructor(a,h,y,b){if(super(),this.id=a,this.dispatcher=y,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,r.aH(h,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},h),this._collectResourceTiming=!!h.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(b),this._tileWorkers={},this._deduped=new r.aK}load(a){this._loaded=!1,this.fire(new r.z("dataloading",{dataType:"source"}));const h=Array.isArray(this.map._language)?this.map._language.join():this.map._language,y=this.map.getWorldview();this._tileJSONRequest=Tr(this._options,this.map._requestManager,h,y,(b,T)=>{if(this._tileJSONRequest=null,this._loaded=!0,b)h&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${h}`),y&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${y}`),this.fire(new r.y(b));else if(T){if(Object.assign(this,T),this.hasWorldviews=!!T.worldview_options,T.worldview_default&&(this.worldviewDefault=T.worldview_default),T.vector_layers){this.vectorLayers=T.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const E of T.vector_layers)this.vectorLayerIds.push(E.id),T.worldview&&T.worldview[E.source]&&this.localizableLayerIds.add(E.id)}this.tileBounds=io.fromTileJSON(T),Rt(T.tiles,this.map._requestManager._customAccessToken),this.fire(new r.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.z("data",{dataType:"source",sourceDataType:"content"}))}a&&a(b)})}loaded(){return this._loaded}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}onAdd(a){this.map=a,this.load()}reload(){this.cancelTileJSONRequest();const a=r.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(a))}setTiles(a){return this._options.tiles=a,this.reload(),this}setUrl(a){return this.url=a,this._options.url=a,this.reload(),this}onRemove(a){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(a,h){const y=a.tileID.canonical.url(this.tiles,this.scheme),b=this.map._requestManager.normalizeTileURL(y),T=this.map._requestManager.transformRequest(b,r.R.Tile),E=this.map.style?this.map.style.getLut(this.scope):null,P=E?{image:E.image.clone()}:null,M={request:T,data:void 0,uid:a.uid,tileID:a.tileID,tileZoom:a.tileZoom,zoom:a.tileID.overscaledZ,maxZoom:this.maxzoom,lut:P,tileSize:this.tileSize*a.tileID.overscaleFactor(),type:this.t
822ype,source:this.id,scope:this.scope,pixelRatio:r.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:a.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:a.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&&r.h(y)&&(M.localizableLayerIds=this.localizableLayerIds),M.request.collectResourceTiming=this._collectResourceTiming,a.actor&&a.state!=="expired")a.state==="loading"?a.reloadCallback=h:a.request=a.actor.send("reloadTile",M,L.bind(this));else if(a.actor=this._tileWorkers[b]=this._tileWorkers[b]||this.dispatcher.getActor(),this.dispatcher.ready)a.request=a.actor.send("loadTile",M,L.bind(this),void 0,!0);else{const O=r.aL.call({deduped:this._deduped},M,(H,F)=>{if(H||!F)L.call(this,H);else{const Z=r.aM(F.responseHeaders);M.data={cacheControl:Z.cacheControl,expires:Z.expires,rawData:F.rawData.slice(0)},a.actor&&a.actor.send("loadTile",M,L.bind(this),void 0,!0)}},!0);a.request={cancel:O}}function L(O,H){return delete a.request,a.aborted?h(null):O&&O.status!==404?h(O):(H&&H.resourceTiming&&(a.resourceTiming=H.resourceTiming),this.map._refreshExpiredTiles&&H&&a.setExpiryData(H),a.loadVectorData(H,this.map.painter),r.aN(this.dispatcher),h(null,H),void(a.reloadCallback&&(this.loadTile(a,a.reloadCallback),a.reloadCallback=null)))}}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.t
822ype,source:this.id,scope:this.scope})}unloadTile(a,h){a.actor&&a.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id,scope:this.scope}),a.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class fc extends r.E{constructor(a,h,y,b){super(),this.id=a,this.dispatcher=y,this.setEventedParent(b),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"},h),Object.assign(this,r.aH(h,["url","scheme","tileSize"]))}load(a){this._loaded=!1,this.fire(new r.z("dataloading",{dataType:"source"}));const h=this.map.getWorldview();this._tileJSONRequest=Tr(this._options,this.map._requestManager,null,h,(y,b)=>{this._tileJSONRequest=null,this._loaded=!0,y?this.fire(new r.y(y)):b&&(Object.assign(this,b),b.raster_layers&&(this.rasterLayers=b.raster_layers,this.rasterLayerIds=this.rasterLayers.map(T=>T.id)),this.tileBounds=io.fromTileJSON(b),Rt(b.tiles),this.fire(new r.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.z("data",{dataType:"source",sourceDataType:"content"}))),a&&a(y)})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}reload(){this.cancelTileJSONRequest();const a=r.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(a))}setTiles(a){return this._options.tiles=a,this.reload(),this}setUrl(a){return this.url=a,this._options.url=a,this.reload(),this}onRemove(a){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a,h){const y=r.o.devicePixelRatio>=2,b=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),y,this.tileSize);a.request=r.n(this.map._requestManager.transformRequest(b,r.R.Tile),(T,E,P)=>{if(delete a.request,a.aborted)return a.state="unloaded",h(null);if(T)return a.state="errored",h(T);if(!E)return h(null);const M=r.aM(P);this.map._refreshExpiredTiles&&a.setExpiryData(M),a.setTexture(E,this.map.painter),a.state="loaded",r.aN(this.dispatcher),h(null)})}abortTile(a,h){a.request&&(a.request.cancel(),delete a.request),h&&h()}unloadTile(a,h){a.texture&&a.texture instanceof r.T?(a.destroy(!0),a.texture&&a.texture instanceof r.T&&this.map.painter.saveTileTexture(a.texture)):a.destroy(),h&&h()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Jh([g,a],h,y,{scaled:b=!0}={}){const{tileSize:T,buffer:E}=y,{x:P,y:M,z:L}=h;if(!isFinite(P)||!isFinite(M)||!isFinite(L))throw new Error("Invalid MRT header");const O=2**L,H=O*r.aF(g),F=O*r.aJ(a);return function([Z,Y],J,{scaled:se=!0}={}){if(!J)throw new Error("bandView is undefined");const{data:ne,tileSize:ae,buffer:fe,offset:ue,scale:Ce,dimension:me}=J;if(Z<-fe||Z>ae+fe||Y<-fe||Y>ae+fe)throw new Error(`Point (${Z}, ${Y}) out of bounds for tileSize=${ae}, buffer=${fe}`);const Ie=(Y+fe)*(ae+2*fe)+(Z+fe);if(new Uint32Array(ne.buffer)[Ie]===4294967295)return null;let Se=[];Se=se?[]:new J.data.constructor(me);for(let ve=0;ve<me;ve++)Se[ve]=Math.round(1e12*(ne[me*Ie+ve]*Ce+ue))/1e12;return Se}([Math.min(Math.max(-E,Math.floor((H-P)*T)),T-1+E),Math.min(Math.max(-E,Math.floor((F-M)*T)),T-1+E)],y,{scaled:b})}class uo extends fc{constructor(a,h,y,b){super(a,h,y,b),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},h)}triggerRepaint(a){const h=this.map.painter._terrain,y=this.map.style.getSourceCache(this.id);h&&h.enabled&&y&&h._clearRenderCacheForTile(y.id,a.tileID),this.map.triggerRepaint()}loadTile(a,h){const y=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),b=this.map._requestManager.transformRequest(y,r.R.Tile),T={request:b,uid:a.uid,tileID:a.tileID,type:this.t
822ype,source:this.id,scope:this.scope,partial:this.partial};a.source=this.id,a.scope=this.scope,a.requestParams=b,a.actor||(a.actor=this.dispatcher.getActor());const E=(P,M,L)=>{if(delete a.request,a.aborted)return a.state="unloaded",h(null);if(P)return P.name==="AbortError"?void 0:(a.state="errored",h(P));if(this.map._refreshExpiredTiles&&M){const O=r.aM(L);a.setExpiryData(O)}if(this.partial&&a.state!=="expired")a.state="empty";else if(!this.partial){if(!M)return h(null);a.state="loaded",a._isHeaderLoaded=!0,a._mrt=M}h(null)};a.request=this.partial?a.fetchHeader(void 0,E.bind(this)):a.actor.send("loadTile",T,E.bind(this),void 0,!0)}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(a,h){const y=a.texturePerLayer;if(a.flushAllQueues(),y.size){a.destroy(!0);for(const b of y.values())this.map.painter.saveTileTexture(b)}else a.destroy()}prepareTile(a,h,y,b){a._isHeaderLoaded&&(a.state!=="empty"&&(a.state="reloading"),a.fetchBandForRender(h,y,b,(T,E)=>{if(T)return a.state="errored",this.fire(new r.y(T)),void this.triggerRepaint(a);E&&(a._isHeaderLoaded=!0,a.setTexturePerLayer(y,E,this.map.painter),a.state="loaded",this.triggerRepaint(a))}))}getInitialBand(a){if(!this.rasterLayers)return 0;const h=this.rasterLayers.find(({id:T})=>T===a),y=h&&h.fields,b=y&&y.bands&&y.bands;return b?b[0]:0}getTextureDescriptor(a,h,y){if(!a)return;const b=h.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!b)return;let T=null;h instanceof r.aQ?T=h.paint.get("raster-array-band"):h instanceof r.aR&&(T=h.paint.get("raster-particle-array-band"));const E=T||this.getInitialBand(b);if(E==null)return;if(!a.textureDescriptorPerLayer.get(h.id))return void this.prepareTile(a,b,h.id,E);if(a.updateNeeded(h.id,E)&&!y)return;const P=a.textureDescriptorPerLayer.get(h.id);return Object.assign({},P,{texture:a.texturePerLayer.get(h.id)})}getImages(a,h){const y=new Map;for(const b of a)for(const T of h){const[E,P]=T.split("/"),M=b.getLayer(E);if(!M||!M.hasBand(P)||!M.hasDataForBand(P))continue;const{bytes:L,tileSize:O,buffer:H}=M.getBandView(P),F=O+2*H,Z={data:new r.q({width:F,height:F},L),pixelRatio:2,sdf:!1,usvg:!1,version:0};y.set(T,Z)}return y}queryRasterArrayValueByBandId(a,h,y){const b=h._mrt;return new Promise(T=>{const E={},P=new Set;for(const[M,L]of Object.entries(b.layers)){if(y.layerName&&M!==y.layerName)continue;const O={};E[M]=O;for(const{bands:H}of L.dataIndex)for(const F of H)y.bands&&!y.bands.includes(F)||(P.add(r.B(M,F)),h.fetchBand(M,null,F,Z=>{r.o.frame(()=>{O[F]=Z?null:Jh([a.lng,a.lat],b,L.getBandView(F)),P.delete(r.B(M,F)),P.size===0&&T(E)})},!1))}P.size===0&&T(E)})}_loadTileForQuery(a,h){if(this._loadTileLoaded[a.uid])return void h(null,a._mrt);if(this._loadTilePending[a.uid])return void this._loadTilePending[a.uid].push(h);this._loadTilePending[a.uid]=[h];const y=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),b=this.map._requestManager.transformRequest(y,r.R.Tile);a.actor.send("loadTile",{request:b,uid:a.uid,tileID:a.tileID,type:this.t
822ype,source:this.id,scope:this.scope,partial:!1},(T,E,P)=>{if(T)return this._loadTilePending[a.uid].forEach(M=>M(T,null)),void delete this._loadTilePending[a.uid];if(!E)return this._loadTilePending[a.uid].forEach(M=>M(null,null)),void delete this._loadTilePending[a.uid];if(this.map._refreshExpiredTiles&&E){const M=r.aM(P);a.setExpiryData(M)}a._mrt=E,a._isHeaderLoaded=!0,a.state="loaded",this._loadTilePending[a.uid].forEach(M=>M(null,E)),this._loadTileLoaded[a.uid]=!0,delete this._loadTilePending[a.uid]},void 0,!0)}queryRasterArrayValueByAllBands(a,h,y){return new Promise((b,T)=>{this._loadTileForQuery(h,(E,P)=>{E?T(E):b(P?this.queryRasterArrayValueByBandId(a,h,y):null)})})}queryRasterArrayValue(a,h){const y=r.aS.convert(a),b=this.findLoadedParent(y);return b&&b._mrt?h.bands||!this.partial?this.queryRasterArrayValueByBandId(y,b,h):this.queryRasterArrayValueByAllBands(y,b,h):Promise.resolve(null)}findLoadedParent(a){const h=r.ae.fromLngLat(a,this.map.transform.tileSize),y=this.maxzoom+1,b=1<<y,T=Math.floor(h.x),E=Math.floor((h.x-T)*b),P=Math.floor(h.y*b),M=this.map.style.getSourceCache(this.id),L=new r.aP(y,T,y,E,P);return M.findLoadedParent(L,this.minzoom)}}const mc={vector:ga,raster:fc,"raster-dem":class extends fc{constructor(g,a,h,y){super(g,a,h,y),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox"}loadTile(g,a){const h=this.map._requestManager.normalizeTileURL(g.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function y(b,T){b&&(g.state="errored",a(b)),T&&(g.dem=T,g.dem.onDeserialize(),g.needsHillshadePrepare=!0,g.needsDEMTextureUpload=!0,g.state="loaded",a(null))}g.request=r.n(this.map._requestManager.transformRequest(h,r.R.Tile),(function(b,T,E){if(delete g.request,g.aborted)g.state="unloaded",a(null);else if(b)g.state="errored",a(b);else if(T){const P=r.aM(E);this.map._refreshExpiredTiles&&g.setExpiryData(P);const M=ImageBitmap&&T instanceof ImageBitmap&&r.r(),L=1-(T.width-r.aO(T.width))/2;L<1||g.neighboringTiles||(g.neighboringTiles=this._getNeighboringTiles(g.tileID));const O=M?T:r.o.getImageData(T,L),H={uid:g.uid,tileID:g.tileID,source:this.id,type:this.t
822ype,scope:this.scope,rawImageData:O,encoding:this.encoding,padding:L};g.actor&&g.state!=="expired"||(g.actor=this.dispatcher.getActor(),g.actor.send("loadTile",H,y.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(g){const a=g.canonical,h=Math.pow(2,a.z),y=(a.x-1+h)%h,b=a.x===0?g.wrap-1:g.wrap,T=(a.x+1+h)%h,E=a.x+1===h?g.wrap+1:g.wrap,P={};return P[new r.aP(g.overscaledZ,b,a.z,y,a.y).key]={backfilled:!1},P[new r.aP(g.overscaledZ,E,a.z,T,a.y).key]={backfilled:!1},a.y>0&&(P[new r.aP(g.overscaledZ,b,a.z,y,a.y-1).key]={backfilled:!1},P[new r.aP(g.overscaledZ,g.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},P[new r.aP(g.overscaledZ,E,a.z,T,a.y-1).key]={backfilled:!1}),a.y+1<h&&(P[new r.aP(g.overscaledZ,b,a.z,y,a.y+1).key]={backfilled:!1},P[new r.aP(g.overscaledZ,g.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},P[new r.aP(g.overscaledZ,E,a.z,T,a.y+1).key]={backfilled:!1}),P}},"raster-array":uo,geojson:class extends r.E{constructor(g,a,h,y){super(),this.id=g,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=h.getActor(),this.setEventedParent(y),this._data=a.data,this._options=Object.assign({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.minzoom!==void 0&&(this.minzoom=a.minzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const b=r.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(a.buffer!==void 0?a.buffer:128)*b,tolerance:(a.tolerance!==void 0?a.tolerance:.375)*b,extent:r.al,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:a.clusterMaxZoom!==void 0?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:r.al,radius:(a.clusterRadius!==void 0?a.clusterRadius:50)*b,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter,dynamic:a.dynamic},a.workerOptions)}onAdd(g){this.map=g,this.setData(this._data)}setData(g){return this._data=g,this._updateWorkerData(),this}updateData(g){if(!this._options.dynamic)return this.fire(new r.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof g!="string"&&(g.type==="Feature"&&(g={type:"FeatureCollection",features:[g]}),g.type!=="FeatureCollection"))return this.fire(new r.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof g!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const a=new Map;for(const h of this._data.features)a.set(h.id,h);for(const h of g.features)a.set(h.id,h);this._data.features=[...a.values()]}else this._data=g;return this._updateWorkerData(!0),this}getClusterExpansionZoom(g,a){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:g,source:this.id,scope:this.scope},a),this}getClusterChildren(g,a){return this.actor.send("geojson.getClusterChildren",{clusterId:g,source:this.id,scope:this.scope},a),this}getClusterLeaves(g,a,h,y){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:g,limit:a,offset:h},y),this}_updateWorkerData(g=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new r.z("dataloading",{dataType:"source"})),this._loaded=!1;const a=Object.assign({append:g},this.workerOptions);a.scope=this.scope;const h=this._data;typeof h=="string"?(a.request=this.map._requestManager.transformRequest(r.o.resolveURL(h),r.R.Source),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(h),this._pendingLoad=this.actor.send(`${this.type}.loadData`,a,(y,b)=>{if(this._loaded=!0,this._pendingLoad=null,y)this.fire(new r.y(y));else{const T={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&b&&b.resourceTiming&&b.resourceTiming[this.id]&&(T.resourceTiming=b.resourceTiming[this.id]),g&&(this._partialReload=!0),this.fire(new r.z("data",T)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(g),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const g=r.B(this.id,this.scope);this.map.style.clearSource(g),this._updateWorkerData()}loadTile(g,a){const h=g.actor?"reloadTile":"loadTile";g.actor=this.actor;const y=this.map.style?this.map.style.getLut(this.scope):null,b=y?{image:y.image.clone()}
822:null,T=this._partialReload,E={type:this.type,uid:g.uid,tileID:g.tileID,tileZoom:g.tileZoom,zoom:g.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:b,scope:this.scope,pixelRatio:r.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:g.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:T,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};g.request=this.actor.send(h,E,(P,M)=>T&&!M?(g.state="loaded",a(null)):(delete g.request,g.destroy(),g.aborted?a(null):P?a(P):(g.loadVectorData(M,this.map.painter,h==="reloadTile"),a(null))),void 0,h==="loadTile")}abortTile(g){g.request&&(g.request.cancel(),delete g.request),g.aborted=!0}unloadTile(g,a){this.actor.send("removeTile",{uid:g.uid,type:this.type,source:this.id,scope:this.scope}),g.destroy()}onRemove(g){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
822,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends r.aT{constructor(g,a,h,y){super(g,a,h,y),this.roundZoom=!0,this.type="video",this.options=a}load(){this._loaded=!1;const g=this.options;this.urls=[];for(const a of g.urls)this.urls.push(this.map._requestManager.transformRequest(a,r.R.Source).url);r.aU(this.urls,(a,h)=>{this._loaded=!0,a?this.fire(new r.y(a)):h&&(this.video=h,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(g){if(this.video){const a=this.video.seekable;g<a.start(0)||g>a.end(0)?this.fire(new r.y(new r.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=g}}getVideo(){return this.video}onAdd(g){this.map||(this.map=g,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 g=this.map.painter.context,a=g.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new r.T(g,this.video,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(g)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:r.aT,model:r.aW,"batched-model":class extends r.E{constructor(g,a,h,y){super(),this.type="batched-model",this.id=g,this.tileSize=512,this._options=a,this.tiles=this._options.tiles,this.maxzoom=a.maxzoom||19,this.minzoom=a.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=h,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(y)}onAdd(g){this.map=g,this.load()}reload(){this.cancelTileJSONRequest();const g=r.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(g))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(g){this._loaded=!1,this.fire(new r.z("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,h=this.map.getWorldview();this._tileJSONRequest=Tr(this._options,this.map._requestManager,a,h,(y,b)=>{this._tileJSONRequest=null,this._loaded=!0,y?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),h&&h.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${h}`),this.fire(new r.y(y))):b&&(Object.assign(this,b),b.bounds&&(this.tileBounds=new io(b.bounds,this.minzoom,this.maxzoom)),Rt(b.tiles,this.map._requestManager._customAccessToken),this.fire(new r.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.z("data",{dataType:"source",sourceDataType:"content"}))),g&&g(y)})}hasTransition(){return!1}hasTile(g){return!this.tileBounds||this.tileBounds.contains(g.canonical)}loaded(){return this._loaded}loadTile(g,a){const h=this.map._requestManager.normalizeTileURL(g.tileID.canonical.url(this.tiles,this.scheme)),y={request:this.map._requestManager.transformRequest(h,r.R.Tile),data:void 0,uid:g.uid,tileID:g.tileID,tileZoom:g.tileZoom,zoom:g.tileID.overscaledZ,tileSize:this.tileSize*g.tileID.overscaleFactor(),type:this.t
822ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:g.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:r.o.devicePixelRatio,promoteId:this.promoteId};if(g.actor&&g.state!=="expired")if(g.state==="loading")g.reloadCallback=a;else{if(g.buckets){const T=Object.values(g.buckets);for(const E of T)E.dirty=!0;return void(g.state="loaded")}g.request=g.actor.send("reloadTile",y,b.bind(this))}else g.actor=this.dispatcher.getActor(),g.request=g.actor.send("loadTile",y,b.bind(this),void 0,!0);function b(T,E){return g.aborted?a(null):T&&T.status!==404?a(T):(this.map._refreshExpiredTiles&&E&&g.setExpiryData(E),g.loadModelData(E,this.map.painter),g.state="loaded",void a(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends r.aT{constructor(g,a,h,y){super(g,a,h,y),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(T=>typeof T!="number"))||this.fire(new r.y(new r.V(`sources.${g}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new r.y(new r.V(`sources.${g}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new r.y(new r.V(`sources.${g}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof HTMLCanvasElement||this.fire(new r.y(new r.V(`sources.${g}`,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 r.y(new r.V(`sources.${g}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.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 r.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(g){this.map=g,this.load(),this.canvas&&this.animate&&this.play()}onRemove(g){this.pause()}prepare(){let g=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,g=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,g=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context;this.texture?!g&&!this._playing||this.texture instanceof r.aV||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new r.T(a,this.canvas,a.gl.RGBA8,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const g of[this.canvas.width,this.canvas.height])if(isNaN(g)||g<=0)return!0;return!1}},custom:class extends r.E{constructor(g,a,h,y){super(),this.id=g,this.type="custom",this._dataType="raster",this._dispatcher=h,this._implementation=a,this.setEventedParent(y),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new r.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new r.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new io(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,r.aH(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return r.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new r.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new r.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(g){this.map=g,this._loaded=!1,this.fire(new r.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(g),this.load()}onRemove(g){this._implementation.onRemove&&this._implementation.onRemove(g)}hasTile(g){if(this._implementation.hasTile){const{x:a,y:h,z:y}=g.canonical;return this._implementation.hasTile({x:a,y:h,z:y})}return!this.tileBounds||this.tileBounds.contains(g.canonical)}loadTile(g,a){const{x:h,y,z:b}=g.tileID.canonical,T=new AbortController;g.request=Promise.resolve(this._implementation.loadTile({x:h,y,z:b},{signal:T.signal})).then((function(E){return delete g.request,g.aborted?(g.state="unloaded",a(null)):E===void 0?(g.state="errored",a(null)):E===null?(this.loadTileData(g,{width:this.tileSize,height:this.tileSize,data:null}),g.state="loaded",a(null)):function(P){return P instanceof ImageData||P instanceof HTMLCanvasElement||P instanceof ImageBitmap||P instanceof HTMLImageElement}(E)?(this.loadTileData(g,E),g.state="loaded",void a(null)):(g.state="errored",a(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(E=>{E.name!=="AbortError"&&(g.state="errored",a(E))}),g.request.cancel=()=>T.abort()}loadTileData(g,a){g.setTexture(a,this.map.painter)}unloadTile(g,a){if(g.texture&&g.texture instanceof r.T?(g.destroy(!0),g.texture&&g.texture instanceof r.T&&this.map.painter.saveTileTexture(g.texture)):g.destroy(),this._implementation.unloadTile){const{x:h,y,z:b}=g.tileID.canonical;this._implementation.unloadTile({x:h,y,z:b})}a&&a()}abortTile(g,a){g.request&&g.request.cancel&&(g.request.cancel(),delete g.request),a&&a()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(g=>({x:g.canonical.x,y:g.canonical.y,z:g.canonical.z}))}_clearTiles(){const g=r.B(this.id,this.scope);this.map.style.clearSource(g)}
vendor: 18,460 bytes, line 822
822_update(){this.fire(new r.z("data",{dataType:"source",sourceDataType:"content"}))}}},ka=function(g,a,h,y){const b=new mc[a.type](g,a,h,y);if(b.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${b.id}`);return r.aX(["load","abort","unload","serialize","prepare"],b),b};function $c(g,a,h=""){return`${h}:${a.id||""}:${a.layer.id}:${function(y){if("layerId"in y)return`layer:${y.layerId}`;{const{featuresetId:b,importId:T}=y;return`featureset:${b}${T?`:import:${T}`:""}`}}(g.target)}`}function hl(g,a,h,y=""){if(g.uniqueFeatureID){const b=$c(g,a,y);if(h.has(b))return!0;h.add(b)}return!1}function pl(g,a,h,y,b=!1){const T=a.sourceCache.transform,E=a.sourceCache.tilesIn(g,a.has3DLayers,b);E.sort(Hg);const P=[];for(const M of E){const L=M.tile.queryRenderedFeatures(a,M,h,y,T,b);Object.keys(L).length&&P.push({wrappedTileID:M.tile.tileID.wrapped().key,queryResults:L})}for(const M in a.layers){const L=a.layers[M];if(L.styleLayer){const O=L.styleLayer.queryRenderedFeatures(g,a.sourceCache,y);Object.keys(O).length&&P.push({wrappedTileID:0,queryResults:O})}}return P.length===0?{}:function(M){const L={},O={};for(const H of M){const F=H.queryResults,Z=H.wrappedTileID,Y=O[Z]=O[Z]||{};for(const J in F){const se=F[J],ne=Y[J]=Y[J]||{},ae=L[J]=L[J]||[];for(const fe of se)ne[fe.featureIndex]||(ne[fe.featureIndex]=!0,ae.push(fe))}}return L}(P)}function fv(g,a,h,y,b,T){const E={},P=y.queryRenderedSymbols(g),M=[];for(const L of Object.keys(P).map(Number))M.push(b[L]);M.sort(Hg);for(const L of M){const O=L.featureIndex.lookupSymbolFeatures(P[L.bucketInstanceId],L.bucketIndex,L.sourceLayerIndex,a,h,T);for(const H in O){const F=E[H]=E[H]||[],Z=O[H];Z.sort((Y,J)=>{const se=L.featureSortOrder;if(se){const ne=se.indexOf(Y.featureIndex);return se.indexOf(J.featureIndex)-ne}return J.featureIndex-Y.featureIndex});for(const Y of Z)F.push(Y)}}return E}function qg(g,a){const h=g.getRenderableIds().map(T=>g.getTileByID(T)),y=[],b={};for(let T=0;T<h.length;T++){const E=h[T],P=E.tileID.canonical.key;b[P]||(b[P]=!0,E.querySourceFeatures(y,a))}return y}function Hg(g,a){const h=g.tileID,y=a.tileID;return h.overscaledZ-y.overscaledZ||h.canonical.y-y.canonical.y||h.wrap-y.wrap||h.canonical.x-y.canonical.x}function Gg(g,a){const h={};if(!a)return h;for(const y of g){const b=y.layerIds.map(T=>a.getLayer(T)).filter(Boolean);if(b.length!==0){y.layers=b,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(T=>b.filter(E=>E.id===T)[0]));for(const T of b)h[T.fqid]=y}}return h}const Xa=32,qc=33,Pa=new Uint16Array(8184);for(let g=0;g<2046;g++){let a=g+2,h=0,y=0,b=0,T=0,E=0,P=0;for(1&a?b=T=E=Xa:h=y=P=Xa;(a>>=1)>1;){const L=h+b>>1,O=y+T>>1;1&a?(b=h,T=y,h=E,y=P):(h=b,y=T,b=E,T=P),E=L,P=O}const M=4*g;Pa[M+0]=h,Pa[M+1]=y,Pa[M+2]=b,Pa[M+3]=T}const Ml=new Uint16Array(2178),Hu=new Uint8Array(1089),ep=new Uint16Array(1089);function mv(g){return g===0?-.03125:g===32?.03125:0}const gv={type:2,extent:r.al,loadGeometry:()=>[[new r.P(0,0),new r.P(r.al+1,0),new r.P(r.al+1,r.al+1),new r.P(0,r.al+1),new r.P(0,0)]]};class fu{constructor(a,h,y,b,T,E){this.tileID=a,this.uid=r.b1(),this.uses=0,this.tileSize=h,this.tileZoom=y,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=T,b&&b.style&&(this._lastUpdatedBrightness=b.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",b&&b.transform&&(this.projection=b.transform.projection),this.worldview=E,this._hasAppearances=null}registerFadeDuration(a){const h=a+this.timeAdded;h<r.o.now()||this.fadeEndTime&&h<this.fadeEndTime||(this.fadeEndTime=h)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=r.aY(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(a,h,y){if(this.unloadVectorData(),this.state="loaded",a){a.featureIndex&&(this.latestFeatureIndex=a.featureIndex,a.rawTileData?(this.latestRawTileData=a.rawTileData,this.latestFeatureIndex.rawTileData=a.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=a.collisionBoxArray,this.buckets=Gg(a.buckets,h.style),this.hasSymbolBuckets=!1;for(const b in this.buckets){const T=this.buckets[b];if(T instanceof r.b3){if(this.hasSymbolBuckets=!0,!y)break;T.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const b in this.buckets){const T=this.buckets[b];if(T instanceof r.b3&&T.hasRTLText){this.hasRTLText=!0,r.b4();break}}this.queryPadding=0;for(const b in this.buckets){const T=this.buckets[b],E=h.style.getOwnLayer(b);if(!E)continue;const P=E.queryRadius(T);this.queryPadding=Math.max(this.queryPadding,P)}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage),a.lineAtlas&&(this.lineAtlas=a.lineAtlas),this._lastUpdatedBrightness=a.brightness}else this.collisionBoxArray=new r.b2}unloadVectorData(){if(this.hasData()){for(const a in this.buckets)this.buckets[a].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(a,h,y){a&&(a.resourceTiming&&(this.resourceTiming=a.resourceTiming),this.buckets=Object.assign({},this.buckets,Gg(a.buckets,h.style)),a.featureIndex&&(this.latestFeatureIndex=a.featureIndex))}getBucket(a){return this.buckets[a.fqid]}upload(a,h){for(const T in this.buckets){const E=this.buckets[T];if(E.uploadPending()){let P={},M=[],L={zoom:0,pitch:0,brightness:0,worldview:""};if(h){if(h.style){M=h.style.listImages();const O=E.layers[0],H=O.sourceLayer||"_geojsonTileLayer",F=h.style.getLayerSourceCache(O);F&&(P=F._state.getState(H,void 0))}L={zoom:h.transform.zoom||0,pitch:h.transform.pitch||0,brightness:h.style.getBrightness()||0,worldview:h.worldview||""}}E.upload(a,this.tileID.canonical,P,M,L)}}const y=a.gl,b=this.imageAtlas;b&&!b.uploaded&&(this.imageAtlasTexture=new r.T(a,b.image,y.RGBA8,{useMipmap:!!b.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new r.T(a,this.glyphAtlasImage,y.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new r.T(a,this.lineAtlas.image,y.R8),this.lineAtlas.uploaded=!0)}prepare(a,h,y){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture,y),!h||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const b=h.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(h)),(this._lastUpdatedBrightness||b||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&b&&Math.abs(this._lastUpdatedBrightness-b)<.001||(this.updateBuckets(h,this._lastUpdatedBrightness!==b),this._lastUpdatedBrightness=b))}evaluateQueryRenderedFeaturePadding(){let a=0;for(const h in this.buckets){const y=this.buckets[h];y.evaluateQueryRenderedFeaturePadding&&(a=Math.max(a,y.evaluateQueryRenderedFeaturePadding()))}return a}queryRenderedFeatures(a,h,y,b,T,E){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const P=this.evaluateQueryRenderedFeaturePadding(),M=function(L,O){const H=r.bp([],[.5*L.width,.5*-L.height,1]);return r.bq(H,H,[1,-1,0]),r.aB(H,H,L.calculateProjMatrix(O.toUnwrapped())),Float32Array.from(H)}(T,this.tileID);return this.latestFeatureIndex.query(a,{tilespaceGeometry:h,pixelPosMatrix:M,transform:b,availableImages:y,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:P})}querySourceFeatures(a,h){const y=this.latestFeatureIndex;if(!y||!y.rawTileData)return;const b=y.loadVTLayers(),T=h?h.sourceLayer:"",E=b._geojsonTileLayer||b[T];if(!E)return;const P=r.b5(h&&h.filter),{z:M,x:L,y:O}=this.tileID.canonical,H={z:M,x:L,y:O};for(let F=0;F<E.length;F++){const Z=E.feature(F);if(P.needGeometry){const se=r.b6(Z,!0);if(!P.filter(new r.ac(this.tileID.overscaledZ,{worldview:this.worldview}),se,this.tileID.canonical))continue}else if(!P.filter(new r.ac(this.tileID.overscaledZ,{worldview:this.worldview}),Z))continue;const Y=y.getId(Z,T),J=new r.b7(Z,M,L,O,Y);J.tile=H,a.push(J)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(a){const h=this.expirationTime;if(a.cacheControl){const y=r.b8(a.cacheControl);y["max-age"]&&(this.expirationTime=Date.now()+1e3*y["max-age"])}else a.expires&&(this.expirationTime=new Date(a.expires).getTime());if(this.expirationTime){const y=Date.now();let b=!1;if(this.expirationTime>y)b=!1;else if(h)if(this.expirationTime<h)b=!0;else{const T=this.expirationTime-h;T?this.expirationTime=y+Math.max(T,3e4):b=!0}else b=!0;b?(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(a){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&a&&this.updateBuckets(a)}hasAppearances(a){for(const h in this.buckets)if(a.style.hasLayer(h)&&this.buckets[h].layers.some(y=>y.appearances&&y.appearances.length>0))return!0;return!1}updateBuckets(a,h){if(!this.latestFeatureIndex||!a.style)return;const y=this.latestFeatureIndex.loadVTLayers(),b=a.style.listImages(),T=a.style.getBrightness();for(const E in this.buckets){if(!a.style.hasLayer(E))continue;const P=this.buckets[E],M=P.layers[0],L=M.sourceLayer||"_geojsonTileLayer",O=y[L],H=a.style.getLayerSourceCache(M);let F={};H&&(F=H._state.getState(L,void 0));const Z=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},Y=Object.keys(F).length>0&&!h;if(P.hasAppearances=P.layers.some(se=>se.appearances&&se.appearances.length>0),(Y&&P.stateDependentLayers.length!==0||h)&&P.update(F,O,b,Z,Y?P.stateDependentLayers:P.layers,h,T),Y&&P.stateDependentLayers.length!==0||h||P.hasAppearances){const se={zoom:a.transform.zoom,pitch:a.transform.pitch,brightness:a.style.getBrightness()||0,worldview:a.worldview};P.updateAppearances(this.tileID.canonical,F,b,se)}(P instanceof r.b9||P instanceof r.ba)&&a._terrain&&a._terrain.enabled&&H&&P.uploadPending()&&a._terrain._clearRenderCacheForTile(H.id,this.tileID);const J=a&&a.style&&a.style.getOwnLayer(E);J&&(this.queryPadding=Math.max(this.queryPadding,J.queryRadius(P)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<r.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(a){this.symbolFadeHoldUntil=r.o.now()+a}setTexture(a,h){const y=h.context,b=y.gl;this.texture=this.texture||h.getTileTexture(a.width),this.texture&&this.texture instanceof r.T?this.texture.update(a):(this.texture=new r.T(y,a,b.RGBA8,{useMipmap:!0}),this.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE))}setDependencies(a,h){const y={};for(const b of h)y[b]=!0;this.dependencies[a]=y}hasDependency(a,h){for(const y of a){const b=this.dependencies[y];if(b){for(const T of h)if(b[T])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(a,h){if(!h||h.name==="mercator"||this._tileDebugBuffer)return;const y=r.bb(gv,this.tileID.canonical,this.tileTransform)[0],b=new r.bc,T=new r.bd;for(let E=0;E<y.length;E++){const{x:P,y:M}=y[E];b.emplaceBack(P,M),T.emplaceBack(E)}T.emplaceBack(0),this._tileDebugIndexBuffer=a.createIndexBuffer(T),this._tileDebugBuffer=a.createVertexBuffer(b,r.be.members),this._tileDebugSegments=r.bf.simpleSegment(0,0,b.length,T.length)}_makeTileBoundsBuffers(a,h){if(this._tileBoundsBuffer||!h||h.name==="mercator")return;const y=r.bb(gv,this.tileID.canonical,this.tileTransform)[0];let b,T;if(this.isRaster){const E=function(P,M){const L=r.aY(P,M),O=Math.pow(2,P.z);for(let se=0;se<qc;se++)for(let ne=0;ne<qc;ne++){const ae=r.aZ((P.x+(ne+mv(ne))/Xa)/O),fe=r.a_((P.y+(se+mv(se))/Xa)/O),ue=M.project(ae,fe),Ce=se*qc+ne;Ml[2*Ce+0]=Math.round((ue.x*L.scale-L.x)*r.al),Ml[2*Ce+1]=Math.round((ue.y*L.scale-L.y)*r.al)}Hu.fill(0),ep.fill(0);for(let se=2045;se>=0;se--){const ne=4*se,ae=Pa[ne+0],fe=Pa[ne+1],ue=Pa[ne+2],Ce=Pa[ne+3],me=ae+ue>>1,Ie=fe+Ce>>1,Se=me+Ie-fe,ve=Ie+ae-me,ke=fe*qc+ae,Ke=Ce*qc+ue,$e=Ie*qc+me,ct=Math.hypot((Ml[2*ke+0]+Ml[2*Ke+0])/2-Ml[2*$e+0],(Ml[2*ke+1]+Ml[2*Ke+1])/2-Ml[2*$e+1])>=16;Hu[$e]=Hu[$e]||(ct?1:0),se<1022&&(Hu[$e]=Hu[$e]||Hu[(fe+ve>>1)*qc+(ae+Se>>1)]||Hu[(Ce+ve>>1)*qc+(ue+Se>>1)])}const H=new r.a$,F=new r.b0;let Z=0;function Y(se,ne){const ae=ne*qc+se;return ep[ae]===0&&(H.emplaceBack(Ml[2*ae+0],Ml[2*ae+1],se*r.al/Xa,ne*r.al/Xa),ep[ae]=++Z),ep[ae]-1}function J(se,ne,ae,fe,ue,Ce){const me=se+ae>>1,Ie=ne+fe>>1;if(Math.abs(se-ue)+Math.abs(ne-Ce)>1&&Hu[Ie*qc+me])J(ue,Ce,se,ne,me,Ie),J(ae,fe,ue,Ce,me,Ie);else{const Se=Y(se,ne),ve=Y(ae,fe),ke=Y(ue,Ce);F.emplaceBack(Se,ve,ke)}}return J(0,0,Xa,Xa,Xa,0),J(Xa,Xa,0,0,0,Xa),{vertices:H,indices:F}}(this.tileID.canonical,h);b=E.vertices,T=E.indices}else{b=new r.a$,T=new r.b0;for(const{x:P,y:M}of y)b.emplaceBack(P,M,0,0);const E=r.bg(b.int16.subarray(0,4*b.length),void 0,4);for(let P=0;P<E.length;P+=3)T.emplaceBack(E[P],E[P+1],E[P+2])}this._tileBoundsBuffer=a.createVertexBuffer(b,r.bh.members),this._tileBoundsIndexBuffer=a.createIndexBuffer(T),this._tileBoundsSegments=r.bf.simpleSegment(0,0,b.length,T.length)}_makeGlobeTileDebugBuffers(a,h){const y=h.projection;if(!y||y.name!=="globe"||h.freezeTileCoverage)return;const b=this.tileID.canonical,T=r.bi(b,h),E=r.bj(T),P=r.aj(h.zoom);let M;P>0&&(M=r.bk(new Float64Array(16),h.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(a,b,h,E,M,P),this._makeGlobeTileDebugTextBuffer(a,b,h,E,M,P)}_globePoint(a,h,y,b,T,E,P){let M=r.bl(a,h,y);if(E){const L=1<<y.z,O=r.aF(b.center.lng),H=r.aJ(b.center.lat),F=(y.x+.5)/L-O;let Z=0;F>.5?Z=-1:F<-.5&&(Z=1);let Y=(a/r.al+y.x)/L+Z,J=(h/r.al+y.y)/L;Y=(Y-O)*b._pixelsPerMercatorPixel+O,J=(J-H)*b._pixelsPerMercatorPixel+H;const se=[Y*b.worldSize,J*b.worldSize,0];r.af(se,se,E),M=r.bm(M,se,P)}return r.af(M,M,T)}_makeGlobeTileDebugBorderBuffer(a,h,y,b,T,E){const P=new r.bc,M=new r.bd,L=new r.bn,O=(F,Z,Y,J,se)=>{const ne=(Y-F)/(se-1),ae=(J-Z)/(se-1),fe=P.length;for(let ue=0;ue<se;ue++){const Ce=F+ue*ne,me=Z+ue*ae;P.emplaceBack(Ce,me);const Ie=this._globePoint(Ce,me,h,y,b,T,E);L.emplaceBack(Ie[0],Ie[1],Ie[2]),M.emplaceBack(fe+ue)}},H=r.al;O(0,0,H,0,16),O(H,0,H,H,16),O(H,H,0,H,16),O(0,H,0,0,16),this._tileDebugIndexBuffer=a.createIndexBuffer(M),this._tileDebugBuffer=a.createVertexBuffer(P,r.be.members),this._globeTileDebugBorderBuffer=a.createVertexBuffer(L,r.bo.members),this._tileDebugSegments=r.bf.simpleSegment(0,0,P.length,M.length)}_makeGlobeTileDebugTextBuffer(a,h,y,b,T,E){const P=r.al/4,M=new r.bc,L=new r.b0,O=new r.bn,H=25;L.reserve(32),M.reserve(H),O.reserve(H);const F=(Z,Y)=>H*Z+Y;for(let Z=0;Z<H;Z++){const Y=Z*P;for(let J=0;J<H;J++){const se=J*P;M.emplaceBack(se,Y);const ne=this._globePoint(se,Y,h,y,b,T,E);O.emplaceBack(ne[0],ne[1],ne[2])}}for(let Z=0;Z<4;Z++)for(let Y=0;Y<4;Y++){const J=F(Z,Y),se=F(Z,Y+1),ne=F(Z+1,Y),ae=F(Z+1,Y+1);L.emplaceBack(J,se,ne),L.emplaceBack(ne,se,ae)}this._tileDebugTextIndexBuffer=a.createIndexBuffer(L),this._tileDebugTextBuffer=a.createVertexBuffer(M,r.be.members),this._globeTileDebugTextBuffer=a.createVertexBuffer(O,r.bo.members),this._tileDebugTextSegments=r.bf.simpleSegment(0,0,H,32)}destroy(a=!1){for(const h in this.buckets)this.buckets[h].destroy();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),!a&&this.texture&&this.texture instanceof r.T&&(this.texture.destroy(),delete this.texture),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"}}r.br.setPbf(r.bs);class Zd extends fu{constructor(a,h,y,b,T){super(a,h,y,b,T),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
822getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(a){return this._mrt&&this._mrt.getLayer(a)}setTexturePerLayer(a,h,y){const b=y.context,T=b.gl;let E=this.texturePerLayer.get(a)||y.getTileTexture(h.width);E&&E instanceof r.T?E.update(h,{premultiply:!1}):E=new r.T(b,h,T.RGBA8,{premultiply:!1}),this.texturePerLayer.has(a)||this.texturePerLayer.set(a,E)}flushQueues(a){const h=this._workQueuePerLayer.get(a)||[],y=this._fetchQueuePerLayer.get(a)||[];for(;h.length;)h.pop()();for(;y.length;)y.pop()()}flushAllQueues(){for(const a of this._workQueuePerLayer.keys()){const h=this._workQueuePerLayer.get(a)||[];for(;h.length;)h.pop()()}for(const a of this._fetchQueuePerLayer.keys()){const h=this._fetchQueuePerLayer.get(a)||[];for(;h.length;)h.pop()()}}fetchHeader(a=16384,h){const y=this._mrt=new r.br(30),b=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(a-1)}});return this.entireBuffer=null,this.request=r.bt(b,(T,E,P)=>{if(T)h(T);else try{const M=y.getHeaderLength(E);if(M>a)return void(this.request=this.fetchHeader(M,h));y.parseHeader(E),this._isHeaderLoaded=!0;let L=0;for(const O of Object.values(y.layers))L=Math.max(L,O.dataIndex[O.dataIndex.length-1].lastByte);E.byteLength>=L&&(this.entireBuffer=E),h(null,this.entireBuffer||E,P)}catch(M){h(M)}}),this.request}fetchBandForRender(a,h,y,b){this.fetchBand(a,h,y,T=>{if(T)return void b(T);this.updateTextureDescriptor(a,h,y);const E=this.textureDescriptorPerLayer.get(h);b(null,E?E.img:null)})}fetchBand(a,h,y,b,T=!0){const E=this._mrt;if(!this._isHeaderLoaded||!E)return void b(new Error("Tile header is not ready"));const P=this.actor;if(!P)return void b(new Error("Can't fetch tile band without an actor"));let M;const L=r.B(String(y),r.B(this.tileID.key,a));let O=this._taskQueue.get(L);O?O.add(b):(O=new Set,O.add(b),this._taskQueue.set(L,O));const H=(J,se)=>
vendor: 25,113 bytes, line 822
822{M.complete(J,se),J?b(J):(O.values().forEach(ne=>ne(null,se)),this._taskQueue.delete(L))},F=(J,se)=>{if(J)return b(J);const ne=P.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:se,task:M},H,void 0,!0);if(h!==null){const ae=this._workQueuePerLayer.get(h)||[];ae.push(()=>{ne&&ne.cancel(),M.cancel()}),this._workQueuePerLayer.has(h)||this._workQueuePerLayer.set(h,ae)}};let Z;try{Z=E.getLayer(a)}catch(J){if(this.state==="reloading")return;throw J}if(!Z)return void b(new Error(`Unknown sourceLayer "${a}"`));if(Z.hasDataForBand(y))return O.values().forEach(J=>J(null,null)),void this._taskQueue.delete(L);const Y=Z.getDataRange([y]);if(M=E.createDecodingTask(Y),!M||M.tasks.length)if(h!==null&&this.flushQueues(h),this.entireBuffer)F(null,this.entireBuffer.slice(Y.firstByte,Y.lastByte+1));else{const J=Object.assign({},this.requestParams,{headers:{Range:`bytes=${Y.firstByte}-${Y.lastByte}`}}),se=r.bt(J,F);if(h!==null){const ne=this._fetchQueuePerLayer.get(h)||[];ne.push(()=>{se.cancel(),M.cancel()}),this._fetchQueuePerLayer.has(h)||this._fetchQueuePerLayer.set(h,ne)}}}updateNeeded(a,h){return(!this.textureDescriptorPerLayer.get(a)||this.textureDescriptorPerLayer.get(a).band!==h||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(a,h,y){if(!this._mrt)return;const b=this._mrt.getLayer(a);if(!b||!b.hasBand(y)||!b.hasDataForBand(y))return;const{bytes:T,tileSize:E,buffer:P,offset:M,scale:L}=b.getBandView(y),O=E+2*P,H=new r.q({width:O,height:O},T),F=this.texturePerLayer.get(h);F&&F instanceof r.T&&F.update(H,{premultiply:!1}),this.textureDescriptorPerLayer.set(h,{layer:a,band:y,img:H,buffer:P,offset:M,tileSize:E,format:b.pixelFormat,mix:[L,256*L,65536*L,16777216*L]})}destroy(a=!1){if(super.destroy(a),delete this._mrt,!a)for(const h of this.texturePerLayer.values())h&&h instanceof r.T&&h.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 u1{constructor(a,h){this.max=a,this.onRemove=h,this.reset()}reset(){for(const a in this.data)for(const h of this.data[a])h.timeout&&clearTimeout(h.timeout),this.onRemove(h.value);return this.data={},this.order=[],this}add(a,h,y){const b=a.wrapped().key;this.data[b]===void 0&&(this.data[b]=[]);const T={value:h,timeout:void 0};if(y!==void 0&&(T.timeout=setTimeout(()=>{this.remove(a,T)},y)),this.data[b].push(T),this.order.push(b),this.order.length>this.max){const E=this._getAndRemoveByKey(this.order[0]);E&&this.onRemove(E)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const h=this.data[a].shift();return h.timeout&&clearTimeout(h.timeout),this.data[a].length===0&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),h.value}getByKey(a){const h=this.data[a];return h?h[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(a,h){if(!this.has(a))return this;const y=a.wrapped().key,b=h===void 0?0:this.data[y].indexOf(h),T=this.data[y][b];return this.data[y].splice(b,1),T.timeout&&clearTimeout(T.timeout),this.data[y].length===0&&delete this.data[y],this.onRemove(T.value),this.order.splice(this.order.indexOf(y),1),this}setMaxSize(a){for(this.max=a;this.order.length>this.max;){const h=this._getAndRemoveByKey(this.order[0]);h&&this.onRemove(h)}return this}filter(a){const h=[];for(const y in this.data)for(const b of this.data[y])a(b.value)||h.push(b);for(const y of h)this.remove(y.value.tileID,y)}}class FE{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,h,y){const b=String(h);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][b]=this.stateChanges[a][b]||{},Object.assign(this.stateChanges[a][b],y),this.deletedStates[a]===null){this.deletedStates[a]={};for(const T in this.state[a])T!==b&&(this.deletedStates[a][T]=null)}else if(this.deletedStates[a]&&this.deletedStates[a][b]===null){this.deletedStates[a][b]={};for(const T in this.state[a][b])y[T]||(this.deletedStates[a][b][T]=null)}else for(const T in y)this.deletedStates[a]&&this.deletedStates[a][b]&&this.deletedStates[a][b][T]===null&&delete this.deletedStates[a][b][T]}removeFeatureState(a,h,y){if(this.deletedStates[a]===null)return;const b=String(h);if(this.deletedStates[a]=this.deletedStates[a]||{},y&&h!==void 0)this.deletedStates[a][b]!==null&&(this.deletedStates[a][b]=this.deletedStates[a][b]||{},this.deletedStates[a][b][y]=null);else if(h!==void 0)if(this.stateChanges[a]&&this.stateChanges[a][b])for(y in this.deletedStates[a][b]={},this.stateChanges[a][b])this.deletedStates[a][b][y]=null;else this.deletedStates[a][b]=null;else this.deletedStates[a]=null}getState(a,h){const y=this.state[a]||{},b=this.stateChanges[a]||{},T=this.deletedStates[a];if(T===null)return{};if(h!==void 0){const P=String(h),M=Object.assign({},y[P],b[P]);if(T){const L=T[h];if(L===null)return{};for(const O in L)delete M[O]}return M}const E=Object.assign({},y,b);if(T)for(const P in T)delete E[P];return E}initializeTileState(a,h){a.refreshFeatureState(h)}coalesceChanges(a,h){const y={};for(const b in this.stateChanges){this.state[b]=this.state[b]||{};const T={};for(const E in this.stateChanges[b])this.state[b][E]||(this.state[b][E]={}),Object.assign(this.state[b][E],this.stateChanges[b][E]),T[E]=this.state[b][E];y[b]=T}for(const b in this.deletedStates){this.state[b]=this.state[b]||{};const T={};if(this.deletedStates[b]===null)for(const E in this.state[b])T[E]={},this.state[b][E]={};else for(const E in this.deletedStates[b]){if(this.deletedStates[b][E]===null)this.state[b][E]={};else if(this.state[b][E])for(const P of Object.keys(this.deletedStates[b][E]))delete this.state[b][E][P];T[E]=this.state[b][E]}y[b]=y[b]||{},Object.assign(y[b],T)}if(this.stateChanges={},this.deletedStates={},Object.keys(y).length!==0)for(const b in a)a[b].refreshFeatureState(h)}}class gc extends r.E{constructor(a,h,y){super(),this.id=a,this._onlySymbols=y,h.on("data",b=>{b.dataType==="source"&&b.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&b.dataType==="source"&&b.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),h.on("error",()=>{this._sourceErrored=!0}),this._source=h,this._tiles={},this._cache=new u1(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=h.minTileCacheSize,this._maxTileCacheSize=h.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new FE,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(a){this.map=a,this._minTileCacheSize=this._minTileCacheSize===void 0&&a?a._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&a?a._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const a in this._tiles)if(!this._tiles[a].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(a,h){return a.isSymbolTile=this._onlySymbols,a.isExtraShadowCaster=this._shadowCasterTiles[a.tileID.key],this._source.loadTile(a,h)}_unloadTile(a){if(this._source.unloadTile)return this._source.unloadTile(a)}_abortTile(a){if(this._source.abortTile)return this._source.abortTile(a)}serialize(){return this._source.serialize()}prepare(a){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const h in this._tiles){const y=this._tiles[h];y.upload(a,this.map?this.map.painter:void 0),y.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(a=>a.tileID).sort(d1).map(a=>a.key)}getRenderableIds(a,h){const y=[];for(const b in this._tiles)this._isIdRenderable(+b,a,h)&&y.push(this._tiles[b]);return a?y.sort((b,T)=>{const E=b.tileID,P=T.tileID,M=new r.P(E.canonical.x,E.canonical.y)._rotate(this.transform.angle),L=new r.P(P.canonical.x,P.canonical.y)._rotate(this.transform.angle);return E.overscaledZ-P.overscaledZ||L.y-M.y||L.x-M.x}).map(b=>b.tileID.key):y.map(b=>b.tileID).sort(d1).map(b=>b.key)}hasRenderableParent(a){const h=this.findLoadedParent(a,0);return!!h&&this._isIdRenderable(h.tileID.key)}_isIdRenderable(a,h,y){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(h||!this._tiles[a].holdingForFade())&&(y||!this._shadowCasterTiles[a])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const a in this._tiles)this._tiles[a].state!=="errored"&&this._reloadTile(+a,"reloading")}}_reloadTile(a,h){const y=this._tiles[a];y&&(y.state!=="loading"&&(y.state=h),this._loadTile(y,this._tileLoaded.bind(this,y,a,h)))}_tileLoaded(a,h,y,b,T){if(b){if(a.state="errored",b.status!==404)this._source.fire(new r.y(b,{tile:a}));else{if(this._source.fire(new r.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:a})),!(a.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const P=this.map.painter.terrain;this.update(this.transform,P.getScaledDemTileSize(),!0),P.resetTileLookupCache(this.id)}else this.update(this.transform)}return}a.timeAdded=r.o.now(),y==="expired"&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(h,a),this._source.type==="raster-dem"&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null);let E=new Map;T&&T.responseHeaders&&(E=T.responseHeaders),this._source.fire(new r.z("data",{dataType:"source",tile:a,coord:a.tileID,sourceCacheId:this.id,responseHeaders:E}))}_backfillDEM(a){const h=this.getRenderableIds();for(let b=0;b<h.length;b++){const T=h[b];if(a.neighboringTiles&&a.neighboringTiles[T]){const E=this.getTileByID(T);y(a,E),y(E,a)}}function y(b,T){if(!b.dem||b.dem.borderReady)return;b.needsHillshadePrepare=!0,b.needsDEMTextureUpload=!0;let E=T.tileID.canonical.x-b.tileID.canonical.x;const P=T.tileID.canonical.y-b.tileID.canonical.y,M=Math.pow(2,b.tileID.canonical.z),L=T.tileID.key;E===0&&P===0||Math.abs(P)>1||(Math.abs(E)>1&&(Math.abs(E+M)===1?E+=M:Math.abs(E-M)===1&&(E-=M)),T.dem&&b.dem&&(b.dem.backfillBorder(T.dem,E,P),b.neighboringTiles&&b.neighboringTiles[L]&&(b.neighboringTiles[L].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(a,h,y,b){for(const T in this._tiles){let E=this._tiles[T];if(b[T]||!E.hasData()||E.tileID.overscaledZ<=h||E.tileID.overscaledZ>y)continue;let P=E.tileID;for(;E&&E.tileID.overscaledZ>h+1;){const L=E.tileID.scaledTo(E.tileID.overscaledZ-1);E=this._tiles[L.key],E&&E.hasData()&&(P=L)}let M=P;for(;M.overscaledZ>h;)if(M=M.scaledTo(M.overscaledZ-1),a[M.key]){b[P.key]=P;break}}}findLoadedParent(a,h){if(a.key in this._loadedParentTiles){const y=this._loadedParentTiles[a.key];return y&&y.tileID.overscaledZ>=h?y:null}for(let y=a.overscaledZ-1;y>=h;y--){const b=a.scaledTo(y),T=this._getLoadedTile(b);if(T)return T}}_getLoadedTile(a){const h=this._tiles[a.key];return h&&h.hasData()?h:this._cache.getByKey(this._source.reparseOverscaled?a.wrapped().key:a.canonical.key)}updateCacheSize(a,h){h=h||this._source.tileSize;const y=Math.ceil(a.width/h)+1,b=Math.ceil(a.height/h)+1,T=Math.floor(y*b*5),E=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,T):T,P=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,E):E;this._cache.setMaxSize(P)}handleWrapJump(a){const h=Math.round((a-(this._prevLng===void 0?a:this._prevLng))/360);if(this._prevLng=a,h){const y={};for(const b in this._tiles){const T=this._tiles[b];T.tileID=T.tileID.unwrapTo(T.tileID.wrap+h),y[T.tileID.key]=T}this._tiles=y;for(const b in this._timers)clearTimeout(this._timers[b]),delete this._timers[b];for(const b in this._tiles)this._setTileReloadTimer(+b,this._tiles[b])}}update(a,h,y,b,T){if(this.transform=a,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!y)return;this.updateCacheSize(a,h),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const E=this._source.type==="batched-model";let P,M=this._source.maxzoom;const L=this.map&&this.map.painter?this.map.painter._terrain:null;if(L&&L.sourceCache===this&&L.attenuationRange()){const F=L.attenuationRange()[0],Z=Math.floor(F)-Math.log2(L.getDemUpscale());M>Z&&(M=Z)}if(this.used||this.usedForTerrain){if(this._source.tileID)P=a.getVisibleUnwrappedCoordinates(this._source.tileID).map(F=>new r.aP(F.canonical.z,F.wrap,F.canonical.z,F.canonical.x,F.canonical.y));else if(this.tileCoverLift!==0){const F=a.clone();F.tileCoverLift=this.tileCoverLift,P=F.coveringTiles({tileSize:h||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:M,roundZoom:this._source.roundZoom&&!y,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:E}),this._source.minzoom<=1&&a.projection.name==="globe"&&(P.push(new r.aP(1,0,1,0,0)),P.push(new r.aP(1,0,1,1,0)),P.push(new r.aP(1,0,1,0,1)),P.push(new r.aP(1,0,1,1,1)))}else if(P=a.coveringTiles({tileSize:h||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:M,roundZoom:this._source.roundZoom&&!y,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:E}),this._source.hasTile){const F=this._source.hasTile.bind(this._source);P=P.filter(Z=>F(Z))}}else P=[];if(P.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!tp(this._source.type)){const F=a.coveringZoomLevel({tileSize:h||this._source.tileSize,roundZoom:this._source.roundZoom&&!y}),Z=Math.min(F,this._source.maxzoom);if(E){const Y=a.extendTileCover(P,Z);for(const J of Y)P.push(J)}else if(T){const Y=a.extendTileCoverToNearPlane(P,this.transform.getFrustum(Z),Z);for(const J of Y)P.push(J)}else if(this.castsShadows&&b){const Y=a.extendTileCover(P,Z,b);for(const J of Y)this._shadowCasterTiles[J.key]=!0,P.push(J)}}const O=this._updateRetainedTiles(P);if(tp(this._source.type)&&P.length!==0){const F={},Z={},Y=Object.keys(O);for(const se of Y){const ne=O[se],ae=this._tiles[se];if(!ae||ae.fadeEndTime&&ae.fadeEndTime<=r.o.now())continue;const fe=this.findLoadedParent(ne,Math.max(ne.overscaledZ-gc.maxOverzooming,this._source.minzoom));fe&&(this._addTile(fe.tileID),F[fe.tileID.key]=fe.tileID),Z[se]=ne}const J=P[P.length-1].overscaledZ;for(const se in this._tiles){const ne=this._tiles[se];if(O[se]||!ne.hasData())continue;let ae=ne.tileID;for(;ae.overscaledZ>J;){ae=ae.scaledTo(ae.overscaledZ-1);const fe=this._tiles[ae.key];if(fe&&fe.hasData()&&Z[ae.key]){O[se]=ne.tileID;break}}}for(const se in F)O[se]||(this._coveredTiles[se]=!0,O[se]=F[se])}for(const F in O)this._tiles[F].clearFadeHold();const H=r.bu(this._tiles,O);for(const F of H){const Z=this._tiles[F];Z.hasSymbolBuckets&&!Z.holdingForFade()?Z.setHoldDuration(this.map._fadeDuration):Z.hasSymbolBuckets&&!Z.symbolFadeFinished()||this._removeTile(+F)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(+a)}_updateRetainedTiles(a){const h={};if(a.length===0)return h;const y={},b=a.reduce((L,O)=>Math.min(L,O.overscaledZ),1/0),T=a[0].overscaledZ,E=Math.max(T-gc.maxOverzooming,this._source.minzoom),P=Math.max(T+gc.maxUnderzooming,this._source.minzoom),M={};for(const L of a){const O=this._addTile(L);h[L.key]=L,O.hasData()||b<this._source.maxzoom&&(M[L.key]=L)}this._retainLoadedChildren(M,b,P,h);for(const L of a){let O=this._tiles[L.key];if(O.hasData())continue;if(L.canonical.z>=this._source.maxzoom){const F=L.children(this._source.maxzoom)[0],Z=this.getTile(F);if(Z&&Z.hasData()){h[F.key]=F;continue}}else{const F=L.children(this._source.maxzoom);if(h[F[0].key]&&h[F[1].key]&&h[F[2].key]&&h[F[3].key])continue}let H=O.wasRequested();for(let F=L.overscaledZ-1;F>=E;--F){const Z=L.scaledTo(F);if(y[Z.key]||(y[Z.key]=!0,O=this.getTile(Z),!O&&H&&(O=this._addTile(Z)),O&&(h[Z.key]=Z,H=O.wasRequested(),O.hasData())))break}}return h}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const a in this._tiles){const h=[];let y,b=this._tiles[a].tileID;for(;b.overscaledZ>0;){if(b.key in this._loadedParentTiles){y=this._loadedParentTiles[b.key];break}h.push(b.key);const T=b.scaledTo(b.overscaledZ-1);if(y=this._getLoadedTile(T),y)break;b=T}for(const T of h)this._loadedParentTiles[T]=y}}_addTile(a){let h=this._tiles[a.key];if(h)return h.isExtraShadowCaster!==!0||this._shadowCasterTiles[a.key]||this._reloadTile(a.key,"reloading"),h;h=this._cache.getAndRemove(a),h&&(this._setTileReloadTimer(a.key,h),h.tileID=a,this._state.initializeTileState(h,this.map?this.map.painter:null),this._cacheTimers[a.key]&&(clearTimeout(this._cacheTimers[a.key]),delete this._cacheTimers[a.key],this._setTileReloadTimer(a.key,h)));const y=!!h;if(!y){const b=this.map?this.map.painter:null,T=this._source.tileSize*a.overscaleFactor();h=this._source.type==="raster-array"?new Zd(a,T,this.transform.tileZoom,b,this._isRaster):new fu(a,T,this.transform.tileZoom,b,this._isRaster,this._source.worldview),this._loadTile(h,this._tileLoaded.bind(this,h,a.key,h.state))}return h.uses++,this._tiles[a.key]=h,y||this._source.fire(new r.z("dataloading",{tile:h,coord:h.tileID,dataType:"source"})),h}_setTileReloadTimer(a,h){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const y=h.getExpiryTimeout();y&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},y))}_removeTile(a){const h=this._tiles[a];h&&(h.uses--,delete this._tiles[a],this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]),h.uses>0||(h.hasData()&&h.state!=="reloading"||h.state==="empty"?this._cache.add(h.tileID,h,h.getExpiryTimeout()):(h.aborted=!0,this._abortTile(h),this._unloadTile(h))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const a in this._tiles)this._removeTile(+a);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(a,h,y){const b=[],T=this.transform;if(!T)return b;const E=T.projection.name==="globe",P=r.aF(T.center.lng);for(const M in this._tiles){const L=this._tiles[M];if(y&&L.clearQueryDebugViz(),L.holdingForFade())continue;let O;if(E){const H=L.tileID.canonical;if(H.z===0){const F=[Math.abs(r.aA(P,...ip(H,-1))-P),Math.abs(r.aA(P,...ip(H,1))-P)];O=[0,2*F.indexOf(Math.min(...F))-1]}else{const F=[Math.abs(r.aA(P,...ip(H,-1))-P),Math.abs(r.aA(P,...ip(H,0))-P),Math.abs(r.aA(P,...ip(H,1))-P)];O=[F.indexOf(Math.min(...F))-1]}}else O=[0];for(const H of O){const F=a.containsTile(L,T,h,H);F&&b.push(F)}}return b}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(a){return this._getRenderableCoordinates(a)}_getRenderableCoordinates(a,h){const y=this.getRenderableIds(a,h).map(T=>this._tiles[T].tileID),b=this.transform.projection.name==="globe";for(const T of y)T.projMatrix=this.transform.calculateProjMatrix(T.toUnwrapped()),T.expandedProjMatrix=b?this.transform.calculateProjMatrix(T.toUnwrapped(),!1,!0):T.projMatrix;return y}sortCoordinatesByDistance(a){const h=a.slice(),y=this.transform._camera.position,b=this.transform._camera.forward(),T={};for(const E of h){const P=1/(1<<E.canonical.z);T[E.key]=((E.canonical.x+.5)*P+E.wrap-y[0])*b[0]+((E.canonical.y+.5)*P-y[1])*b[1]-y[2]*b[2]}return h.sort((E,P)=>T[E.key]-T[P.key]),h}hasTransition(){if(this._source.hasTransition())return!0;if(tp(this._source.type))for(const a in this._tiles){const h=this._tiles[a];if(h.fadeEndTime!==void 0&&h.fadeEndTime>=r.o.now())return!0}return!1}setFeatureState(a,h,y){this._state.updateState(a=a||"_geojsonTileLayer",h,y)}removeFeatureState(a,h,y){this._state.removeFeatureState(a=a||"_geojsonTileLayer",h,y)}getFeatureState(a,h){return this._state.getState(a=a||"_geojsonTileLayer",h)}setDependencies(a,h,y){const b=this._tiles[a];b&&b.setDependencies(h,y)}reloadTilesForDependencies(a,h){for(const y in this._tiles)this._tiles[y].hasDependency(a,h)&&this._reloadTile(+y,"reloading");this._cache.filter(y=>!y.hasDependency(a,h))}_preloadTiles(a,h){if(!this._sourceLoaded){const M=()=>{this._sourceLoaded&&(this._source.off("data",M),this._preloadTiles(a,h))};return void this._source.on("data",M)}const y=new Map,b=Array.isArray(a)?a:[a],T=this.map.painter.terrain,E=this.usedForTerrain&&T?T.getScaledDemTileSize():this._source.tileSize;for(const M of b){const L=M.coveringTiles({tileSize:E,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const O of L)y.set(O.key,O);this.usedForTerrain&&M.updateElevation(!1)}const P=Array.from(y.values());r.bv(P,(M,L)=>{const O=new fu(M,this._source.tileSize*M.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(O,H=>{this._source.type==="raster-dem"&&O.dem&&this._backfillDEM(O),L(H,O)})},h)}}function d1(g,a){const h=Math.abs(2*g.wrap)-+(g.wrap<0),y=Math.abs(2*a.wrap)-+(a.wrap<0);return g.overscaledZ-a.overscaledZ||y-h||a.canonical.y-g.canonical.y||a.canonical.x-g.canonical.x}function tp(g){return g==="raster"||g==="image"||g==="video"||g==="custom"}function ip(g,a){const h=1<<g.z;return[g.x/h+a,(g.x+1)/h+a]}gc.maxOverzooming=10,gc.maxUnderzooming=3;class h1{constructor(a){this.style=a,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const a=!1,h=!1;for(const y in this.style._mergedLayers){const b=this.style._mergedLayers[y];if(b.type==="fill-extrusion"||b.type==="building")this.layers.push({layer:b,visible:a,visibilityChanged:h});else if(b.type==="model"){const T=this.style.getLayerSource(b);T&&T.type==="batched-model"&&this.layers.push({layer:b,visible:a,visibilityChanged:h})}}}onNewFrame(a){this.layersGotHidden=!1;for(const h of this.layers){const y=h.layer;let b=!1;y.type==="fill-extrusion"?b=!y.isHidden(a)&&y.paint.get("fill-extrusion-opacity")>0:y.type==="building"?b=!y.isHidden(a)&&y.paint.get("building-opacity")>0:y.type==="model"&&(b=!y.isHidden(a)&&y.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!b&&h.visible,h.visible=b}}updateZOffset(a,h){this.currentBuildingBuckets=[];for(const b of this.layers){const T=b.layer,E=this.style.getLayerSourceCache(T);let P=1;T.type==="fill-extrusion"?P=b.visible?T.paint.get("fill-extrusion-vertical-scale"):0:T.type==="building"&&(P=b.visible?T.paint.get("building-vertical-scale"):0);let M=E?E.getTile(h):null;if(!M&&E)for(const L in E._tiles){const O=E._tiles[L];if(h.canonical.isChildOf(O.tileID.canonical)){M=O;break}}this.currentBuildingBuckets.push({bucket:M?M.getBucket(T):null,tileID:M?M.tileID:h,verticalScale:P})}a.hasAnyZOffset=!1;let y=!1;for(let b=0;b<a.symbolInstances.length;b++){const T=a.symbolInstances.get(b),E=T.zOffset,P=this._getHeightAtTileOffset(h,T.tileAnchorX,T.tileAnchorY);T.zOffset=P!==Number.NEGATIVE_INFINITY?P:E,y||E===T.zOffset||(y=!0),a.hasAnyZOffset||T.zOffset===0||(a.hasAnyZOffset=!0)}y&&(a.zOffsetBuffersNeedUpload=!0,a.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(a,h,y,b){let T=h,E=y;if(a.canonical.z!==b.canonical.z){const P=b.canonical,M=1/(1<<a.canonical.z-P.z);T=(h+a.canonical.x*r.al)*M-P.x*r.al|0,E=(y+a.canonical.y*r.al)*M-P.y*r.al|0}return{tileX:T,tileY:E}}_getHeightAtTileOffset(a,h,y){let b,T;for(let E=0;E<this.layers.length;++E){const P=this.layers[E].layer;if(P.type!=="fill-extrusion"&&P.type!=="building")continue;const{bucket:M,tileID:L,verticalScale:O}=this.currentBuildingBuckets[E];if(!M)continue;const{tileX:H,tileY:F}=this._mapCoordToOverlappingTile(a,h,y,L),Z=M.getHeightAtTileCoord(H,F);Z&&Z.height!==void 0&&(Z.hidden?b=Z.height:T=Math.max(Z.height*O,T||0))}if(T!==void 0)return T;for(let E=0;E<this.layers.length;++E){const P=this.layers[E];if(P.layer.type!=="model"||!P.visible)continue;const{bucket:M,tileID:L}=this.currentBuildingBuckets[E];if(!M)continue;const{tileX:O,tileY:H}=this._mapCoordToOverlappingTile(a,h,y,L),F=M.getHeightAtTileCoord(O,H);if(F&&!F.hidden)return F.height===void 0&&b!==void 0?Math.min(F.maxHeight,b)*F.verticalScale:F.height?F.height*F.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Wg(g,a){const h={};for(const y in g)y!=="ref"&&(h[y]=g[y]);
vendor: 4,183 bytes, line 822
822return r.bw.forEach(y=>{y in a&&(h[y]=a[y])}),h}function yf(g){g=g.slice();const a=Object.create(null);for(let h=0;h<g.length;h++)a[g[h].id]=g[h];for(let h=0;h<g.length;h++)"ref"in g[h]&&(g[h]=Wg(g[h],a[g[h].ref]));return g}const ir={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 p1(g,a,h){h.push({command:ir.addSource,args:[g,a[g]]})}function Kg(g,a,h){a.push({command:ir.removeSource,args:[g]}),h[g]=!0}function Zg(g,a,h,y){Kg(g,h,y),p1(g,a,h)}function f1(g,a,h){let y;for(y in g[h])if(g[h].hasOwnProperty(y)&&y!=="data"&&!r.bx(g[h][y],a[h][y]))return!1;for(y in a[h])if(a[h].hasOwnProperty(y)&&y!=="data"&&!r.bx(g[h][y],a[h][y]))return!1;return!0}function Xg(g,a,h,y,b,T){let E;for(E in a=a||{},g=g||{})g.hasOwnProperty(E)&&(r.bx(g[E],a[E])||h.push({command:T,args:[y,E,a[E],b]}));for(E in a)a.hasOwnProperty(E)&&!g.hasOwnProperty(E)&&(r.bx(g[E],a[E])||h.push({command:T,args:[y,E,a[E],b]}))}function Yg(g){return g.id}function Qg(g,a){return g[a.id]=a,g}function np(g,a,h){const y=a.createTileMatrix(g,g.worldSize,h.toUnwrapped());return r.aB(new Float32Array(16),g.projMatrix,y)}function BE(g,a,h){if(a.projection.name===h.projection.name)return g.projMatrix;const y=h.clone();return y.setProjection(a.projection),np(y,a.getProjection(),g)}function yv(g,a,h){return a.name===h.projection.name?g.projMatrix:np(h,a,g)}class GM{constructor(a,h){this.reset(a,h)}reset(a,h){this.points=a||[],this._distances=[0];for(let y=1;y<this.points.length;y++)this._distances[y]=this._distances[y-1]+this.points[y].dist(this.points[y-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(h||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(a){if(this.points.length===1)return this.points[0];a=r.aA(a,0,1);let h=1,y=this._distances[h];const b=a*this.paddedLength+this.padding;for(;y<b&&h<this._distances.length;)y=this._distances[++h];const T=h-1,E=this._distances[T],P=y-E,M=P>0?(b-E)/P:0;return this.points[T].mult(1-M).add(this.points[h].mult(M))}}class Jg{constructor(a,h,y){const b=this.boxCells=[],T=this.circleCells=[];this.xCellCount=Math.ceil(a/y),this.yCellCount=Math.ceil(h/y);for(let E=0;E<this.xCellCount*this.yCellCount;E++)b.push([]),T.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=a,this.height=h,this.xScale=this.xCellCount/a,this.yScale=this.yCellCount/h,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(a,h,y,b,T){this._forEachCell(h,y,b,T,this._insertBoxCell,this.boxUid++),this.boxKeys.push(a),this.bboxes.push(h),this.bboxes.push(y),this.bboxes.push(b),this.bboxes.push(T)}insertCircle(a,h,y,b){this._forEachCell(h-b,y-b,h+b,y+b,this._insertCircleCell,this.circleUid++),this.circleKeys.push(a),this.circles.push(h),this.circles.push(y),this.circles.push(b)}_insertBoxCell(a,h,y,b,T,E){this.boxCells[T].push(E)}_insertCircleCell(a,h,y,b,T,E){this.circleCells[T].push(E)}_query(a,h,y,b,T,E){if(y<0||a>this.width||b<0||h>this.height)return!T&&[];const P=[];if(a<=0&&h<=0&&this.width<=y&&this.height<=b){if(T)return!0;for(let M=0;M<this.boxKeys.length;M++)P.push({key:this.boxKeys[M],x1:this.bboxes[4*M],y1:this.bboxes[4*M+1],x2:this.bboxes[4*M+2],y2:this.bboxes[4*M+3]});for(let M=0;M<this.circleKeys.length;M++){const L=this.circles[3*M],O=this.circles[3*M+1],H=this.circles[3*M+2];P.push({key:this.circleKeys[M],x1:L-H,y1:O-H,x2:L+H,y2:O+H})}return E?P.filter(E):P}
822return this._forEachCell(a,h,y,b,this._queryCell,P,{hitTest:T,seenUids:{box:{},circle:{}}},E),T?P.length>0:P}_queryCircle(a,h,y,b,T){const E=a-y,P=a+y,M=h-y,L=h+y;if(P<0||E>this.width||L<0||M>this.height)return!b&&[];const O=[];return this._forEachCell(E,M,P,L,this._queryCellCircle,O,{hitTest:b,circle:{x:a,y:h,radius:y},seenUids:{box:{},circle:{}}},T),b?O.length>0:O}query(a,h,y,b,T){return this._query(a,h,y,b,!1,T)}hitTest(a,h,y,b,T){return this._query(a,h,y,b,!0,T)}hitTestCircle(a,h,y,b){return this._queryCircle(a,h,y,!0,b)}_queryCell(a,h,y,b,T,E,P,M){const L=P.seenUids,O=this.boxCells[T];if(O!==null){const F=this.bboxes;for(const Z of O)if(!L.box[Z]){L.box[Z]=!0;const Y=4*Z;if(a<=F[Y+2]&&h<=F[Y+3]&&y>=F[Y+0]&&b>=F[Y+1]&&(!M||M(this.boxKeys[Z]))){if(P.hitTest)return E.push(!0),!0;E.push({key:this.boxKeys[Z],x1:F[Y],y1:F[Y+1],x2:F[Y+2],y2:F[Y+3]})}}}const H=this.circleCells[T];if(H!==null){const F=this.circles;for(const Z of H)if(!L.circle[Z]){L.circle[Z]=!0;const Y=3*Z;if(this._circleAndRectCollide(F[Y],F[Y+1],F[Y+2],a,h,y,b)&&(!M||M(this.circleKeys[Z]))){if(P.hitTest)return E.push(!0),!0;{const J=F[Y],se=F[Y+1],ne=F[Y+2];E.push({key:this.circleKeys[Z],x1:J-ne,y1:se-ne,x2:J+ne,y2:se+ne})}}}}}_queryCellCircle(a,h,y,b,T,E,P,M){const L=P.circle,O=P.seenUids,H=this.boxCells[T];if(H!==null){const Z=this.bboxes;for(const Y of H)if(!O.box[Y]){O.box[Y]=!0;const J=4*Y;if(this._circleAndRectCollide(L.x,L.y,L.radius,Z[J+0],Z[J+1],Z[J+2],Z[J+3])&&(!M||M(this.boxKeys[Y])))return E.push(!0),!0}}const F=this.circleCells[T];if(F!==null){const Z=this.circles;for(const Y of F)if(!O.circle[Y]){O.circle[Y]=!0;const J=3*Y;if(this._circlesCollide(Z[J],Z[J+1],Z[J+2],L.x,L.y,L.radius)&&(!M||M(this.circleKeys[Y])))return E.push(!0),!0}}}_forEachCell(a,h,y,b,T,E,P,M){const L=this._convertToXCellCoord(a),O=this._convertToYCellCoord(h),H=this._convertToXCellCoord(y),F=this._convertToYCellCoord(b);for(let Z=L;Z<=H;Z++)for(let Y=O;Y<=F;Y++)if(T.call(this,a,h,y,b,this.xCellCount*Y+Z,E,P,M))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,h,y,b,T,E){const P=b-a,M=T-h,L=y+E;return L*L>P*P+M*M}_circleAndRectCollide(a,h,y,b,T,E,P){const M=(E-b)/2,L=Math.abs(a-(b+M));if(L>M+y)return!1;const O=(P-T)/2,H=Math.abs(h-(T+O));if(H>O+y)return!1;if(L<=M||H<=O)return!0;const F=L-M,Z=H-O;return F*F+Z*Z<=y*y}}const Dl={unknown:0,flipRequired:1,flipNotRequired:2},ey=Math.tan(85*Math.PI/180);function _f(g,a,h,y,b,T,E){const P=r.bB();if(h)if(T.name==="globe"){const M=r.bC(b,a);r.aB(P,P,M)}else{const M=r.bD([],E);P[0]=M[0],P[1]=M[1],P[4]=M[2],P[5]=M[3],y||r.bA(P,P,b.angle)}else r.aB(P,b.labelPlaneMatrix,g);return P}function ty(g,a,h,y,b,T,E){const P=_f(g,a,h,y,b,T,E);return T.name==="globe"&&h||(P[2]=P[6]=P[10]=P[14]=0),P}function Gu(g,a,h,y,b,T,E){if(h){if(T.name==="globe"){const P=_f(g,a,h,y,b,T,E);return r.bk(P,P),r.aB(P,g,P),P}{const P=r.by(g),M=r.bz([]);return M[0]=E[0],M[1]=E[1],M[4]=E[2],M[5]=E[3],r.aB(P,P,M),y||r.bA(P,P,-b.angle),P}}return b.glCoordMatrix}function no(g,a,h,y){const b=[g,a,h,1];h?r.aC(b,b,y):yc(b,b,y);const T=b[3];return b[0]/=T,b[1]/=T,b[2]/=T,b}function m1(g,a){return Math.min(.5+g/a*.5,1.5)}function g1(g,a){const h=g[0]/g[3],y=g[1]/g[3];return h>=-a[0]&&h<=a[0]&&y>=-a[1]&&y<=a[1]}function y1(g,a,h,y,b,T,E,P,M,L,O=1){const H=h.transform,F=y?g.textSizeData:g.iconSizeData,Z=r.bJ(F,h.transform.zoom,O),Y=H.projection.name==="globe",J=[256/h.width*2+1,256/h.height*2+1],se=y?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;se.clear();let ne=null;Y&&(ne=y?g.text.globeExtVertexArray:g.icon.globeExtVertexArray);const ae=g.lineVertexArray,fe=y?g.text.placedSymbolArray:g.icon.placedSymbolArray,ue=h.transform.width/h.transform.height;let Ce,me=!1;for(let Ie=0;Ie<fe.length;Ie++){const Se=fe.get(Ie),{numGlyphs:ve,writingMode:ke}=Se;if(ke!==r.bK.vertical||me||Ce===r.bK.horizontal||(me=!0),Ce=ke,(Se.hidden||ke===r.bK.vertical)&&!me){Wu(ve,se);continue}me=!1;const Ke=new r.P(Se.tileAnchorX,Se.tileAnchorY),$e=g.elevationType==="road",ct=!!H.elevation||$e;let{x:it,y:gt,z:jt}=H.projection.projectTilePoint(Ke.x,Ke.y,L.canonical),et=null;if(ct){const ii=$e?g.getElevationFeatureForText(Ie):null;et={getElevation:M,elevation:H.elevation,elevationFeature:ii};const[ji,Sn,zn]=M(Ke,H.elevation,ii);it+=ji,gt+=Sn,jt+=zn}const Oe=[it,gt,jt,1];if(r.aC(Oe,Oe,a),!g1(Oe,J)){Wu(ve,se);continue}const yt=Oe[3],nt=m1(h.transform.getCameraToCenterDistance(H.projection),yt),wt=r.bL(F,Z,Se),Bt=E?wt/nt:wt*nt,oi=no(it,gt,jt,b);if(oi[3]<=0){Wu(ve,se);continue}let Mt={};const Lt=r.an(g.layers[0].layout.get("text-max-angle")),li=Math.cos(Lt),ti=E?null:et,Yt=UE(Se,Bt,!1,P,a,b,T,g.glyphOffsetArray,ae,se,ne,oi,Ke,Mt,ue,ti,H.projection,L,E,li);me=Yt.useVertical,ti&&Yt.needsFlipping&&(Mt={}),(Yt.notEnoughRoom||me||Yt.needsFlipping&&UE(Se,Bt,!0,P,a,b,T,g.glyphOffsetArray,ae,se,ne,oi,Ke,Mt,ue,ti,H.projection,L,E,li).notEnoughRoom)&&Wu(ve,se)}y?(g.text.dynamicLayoutVertexBuffer.updateData(se),ne&&g.text.globeExtVertexBuffer&&g.text.globeExtVertexBuffer.updateData(ne)):(g.icon.dynamicLayoutVertexBuffer.updateData(se),ne&&g.icon.globeExtVertexBuffer&&g.icon.globeExtVertexBuffer.updateData(ne))}function lr(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se){const{lineStartIndex:ne,glyphStartIndex:ae,segment:fe}=P,ue=ae+P.numGlyphs,Ce=ne+P.lineLength,me=a.getoffsetX(ae),Ie=a.getoffsetX(ue-1),Se=iy(g*me,h,y,b,T,E,fe,ne,Ce,M,L,O,H,F,!0,Z,Y,J,se);
vendor: 37,222 bytes, line 822
822if(!Se)return null;const ve=iy(g*Ie,h,y,b,T,E,fe,ne,Ce,M,L,O,H,F,!0,Z,Y,J,se);return ve?{first:Se,last:ve}:null}function _1(g,a,h,y){return g===r.bK.horizontal&&Math.abs(y)>Math.abs(h)?{useVertical:!0}:g===r.bK.vertical?y>0?{needsFlipping:!0}:null:a!==Dl.unknown&&function(b,T){return b===0||Math.abs(T/b)>ey}(h,y)?a===Dl.flipRequired?{needsFlipping:!0}:null:h<0?{needsFlipping:!0}:null}function UE(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae,fe){const ue=a/24,Ce=g.lineOffsetX*ue,me=g.lineOffsetY*ue,{lineStartIndex:Ie,glyphStartIndex:Se,numGlyphs:ve,segment:ke,writingMode:Ke,flipState:$e}=g,ct=Ie+g.lineLength,it=gt=>{if(O){const[yt,nt,wt]=gt.up,Bt=L.length;r.bM(O,Bt+0,yt,nt,wt),r.bM(O,Bt+1,yt,nt,wt),r.bM(O,Bt+2,yt,nt,wt),r.bM(O,Bt+3,yt,nt,wt)}const[jt,et,Oe]=gt.point;r.bN(L,jt,et,Oe,gt.angle)};if(ve>1){const gt=lr(ue,P,Ce,me,h,H,F,g,M,T,Z,J,!1,se,ne,ae,fe);if(!gt)return{notEnoughRoom:!0};if(y&&!h){let[jt,et,Oe]=gt.first.point,[yt,nt,wt]=gt.last.point;[jt,et]=no(jt,et,Oe,E),[yt,nt]=no(yt,nt,wt,E);const Bt=_1(Ke,$e,(yt-jt)*Y,nt-et);if(g.flipState=Bt&&Bt.needsFlipping?Dl.flipRequired:Dl.flipNotRequired,Bt)return Bt}it(gt.first);for(let jt=Se+1;jt<Se+ve-1;jt++){const et=iy(ue*P.getoffsetX(jt),Ce,me,h,H,F,ke,Ie,ct,M,T,Z,J,!1,!1,se,ne,ae,fe);if(!et)return L.length-=4*(jt-Se),{notEnoughRoom:!0};it(et)}it(gt.last)}else{if(y&&!h){const jt=no(F.x,F.y,0,b),et=Ie+ke+1,Oe=new r.P(M.getx(et),M.gety(et)),yt=no(Oe.x,Oe.y,0,b),nt=yt[3]>0?yt:Vi(F,Oe,jt,1,b,void 0,se,ne.canonical),wt=_1(Ke,$e,(nt[0]-jt[0])*Y,nt[1]-jt[1]);if(g.flipState=wt&&wt.needsFlipping?Dl.flipRequired:Dl.flipNotRequired,wt)return wt}const gt=iy(ue*P.getoffsetX(Se),Ce,me,h,H,F,ke,Ie,ct,M,T,Z,J,!1,!1,se,ne,ae,fe);if(!gt)return{notEnoughRoom:!0};it(gt)}return{}}function VE(g,a,h,y,b){const{x:T,y:E,z:P}=y.projectTilePoint(g.x,g.y,a);if(!b)return no(T,E,P,h);const[M,L,O]=b.getElevation(g,b.elevation,b.elevationFeature);return no(T+M,E+L,P+O,h)}function Vi(g,a,h,y,b,T,E,P){const M=VE(g.sub(a)._unit()._add(g),P,b,E,T);return r.av(M,h,M),r.aw(M,M),r.bG(M,h,M,y)}function iy(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae){const fe=y?g-a:g+a;let ue=fe>0?1:-1,Ce=0;y&&(ue*=-1,Ce=Math.PI),ue<0&&(Ce+=Math.PI);let me=P+E+(ue>0?0:1)|0,Ie=b,Se=b,ve=0,ke=0;const Ke=Math.abs(fe),$e=[],ct=[];let it=T,gt=it,jt=r.bE([]);const et=()=>Vi(gt,it,Se,Ke-ve+1,O,F,J,se.canonical);for(;ve+ke<=Ke;){if(me+=ue,me<P||me>=M)return null;if(Se=Ie,gt=it,$e.push(Se),Z&&ct.push(gt),it=new r.P(L.getx(me),L.gety(me)),Ie=H[me],!Ie){const ti=VE(it,se.canonical,O,J,F);Ie=ti[3]>0?H[me]=ti:et()}ve+=ke;const Lt=r.av([],Ie,Se),li=r.bF(Se,Ie);if(h&&li>0&&ke>0&&r.bI(jt,Lt)/(ke*li)<ae)return null;ke=li,jt=Lt}Y&&F&&(H[me]&&(Ie=et(),ke=r.bF(Se,Ie),jt=r.av([],Ie,Se)),H[me]=Ie);const Oe=(Ke-ve)/ke,yt=it.sub(gt)._mult(Oe)._add(gt),nt=r.bG([],Se,jt,Oe);let wt=[0,0,1],Bt=jt[0],oi=jt[1];if(ne&&(wt=J.upVector(se.canonical,yt.x,yt.y),wt[0]!==0||wt[1]!==0||wt[2]!==1)){const Lt=[wt[2],0,-wt[0]],li=r.bH([],wt,Lt);r.aw(Lt,Lt),r.aw(li,li),Bt=r.bI(jt,Lt),oi=r.bI(jt,li)}if(h){const Lt=r.bH([],wt,jt);r.aw(Lt,Lt),r.bG(nt,nt,Lt,h*ue)}const Mt=Ce+Math.atan2(oi,Bt);return $e.push(nt),Z&&ct.push(yt),{point:nt,angle:Mt,path:$e,tilePath:ct,up:wt}}function Wu(g,a){const h=a.length,y=h+4*g;a.resize(y),a.float32.fill(-1/0,4*h,4*y)}function yc(g,a,h){const y=a[0],b=a[1];return g[0]=h[0]*y+h[4]*b+h[12],g[1]=h[1]*y+h[5]*b+h[13],g[3]=h[3]*y+h[7]*b+h[15],g}const _c=100;class vf{constructor(a,h,y=new Jg(a.width+200,a.height+200,25),b=new Jg(a.width+200,a.height+200,25)){this.transform=a,this.grid=y,this.ignoredGrid=b,this.pitchfactor=Math.cos(a._pitch)*a.cameraToCenterDistance,this.screenRightBoundary=a.width+_c,this.screenBottomBoundary=a.height+_c,this.gridRightBoundary=a.width+200,this.gridBottomBoundary=a.height+200,this.fogState=h}placeCollisionBox(a,h,y,b,T,E,P,M,L,O,H){let F=y.projectedAnchorX,Z=y.projectedAnchorY,Y=y.projectedAnchorZ;const J=y.tileAnchorX,se=y.tileAnchorY,ne=y.elevation,ae=y.tileID,fe=a.getProjection();if(ne&&ae){const[ct,it,gt]=fe.upVector(ae.canonical,y.tileAnchorX,y.tileAnchorY),jt=fe.upVectorScale(ae.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;F+=ct*ne*jt,Z+=it*ne*jt,Y+=gt*ne*jt}const ue=a.projection.name==="globe",Ce=a.projection.name==="globe"?r.aj(this.transform.zoom):0;if(ae&&ue&&Ce<1&&!E){const ct=1<<ae.canonical.z,it=r.bO(J,se);r.bP(it,it,1/r.al),r.bQ(it,it,r.bO(ae.canonical.x,ae.canonical.y)),r.bP(it,it,1/ct),r.bR(it,it,r.bO(b[0],b[1])),it[0]=r.bS(it[0],-.5,.5),r.bP(it,it,r.al);const gt=r.bT(it[0],it[1],r.al/(2*Math.PI),1);r.aC(gt,gt,T),F=r.ak(F,gt[0],Ce),Z=r.ak(Z,gt[1],Ce),Y=r.ak(Y,gt[2],Ce)}const me=this.projectAndGetPerspectiveRatio(O,F,Z,Y,y.tileID,fe.name==="globe"||!!ne||this.transform.pitch>0,fe),Ie=L*me.perspectiveRatio,Se=(y.x1*h+P.x-y.padding)*Ie+me.point.x,ve=(y.y1*h+P.y-y.padding)*Ie+me.point.y,ke=(y.x2*h+P.x+y.padding)*Ie+me.point.x,Ke=(y.y2*h+P.y+y.padding)*Ie+me.point.y,$e=me.perspectiveRatio<=.55||me.occluded;return!this.isInsideGrid(Se,ve,ke,Ke)||!M&&this.grid.hitTest(Se,ve,ke,Ke,H)||$e?{box:[],offscreen:!1,occluded:me.occluded}:{box:[Se,ve,ke,Ke],offscreen:this.isOffscreen(Se,ve,ke,Ke),occluded:!1}}placeCollisionCircles(a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se){const ne=[],ae=this.transform.elevation,fe=a.getProjection(),ue=a.elevationType==="road",Ce=!!ae||ue,me=r.bU.getAtTileOffsetFunc(se,this.transform.center.lat,this.transform.worldSize,fe),Ie=new r.P(y.tileAnchorX,y.tileAnchorY),Se=new r.P(y.tileAnchorX,y.tileAnchorY);let{x:ve,y:ke,z:Ke}=fe.projectTilePoint(Se.x,Se.y,se.canonical),$e=null;if(Ce){const li=ue?a.getElevationFeatureForText(b):null;$e={getElevation:me,elevation:ae,elevationFeature:li};const[ti,Yt,ii]=me(Ie,ae,li);ve+=ti,ke+=Yt,Ke+=ii}const ct=fe.name==="globe",it=this.projectAndGetPerspectiveRatio(M,ve,ke,Ke,se,ct||!!ae||this.transform.pitch>0,fe),{perspectiveRatio:gt}=it,jt=(F?P/gt:P*gt)/r.bX,et=no(ve,ke,Ke,L),Oe=y.lineOffsetX*jt,yt=y.lineOffsetY*jt,nt=r.an(a.layers[0].layout.get("text-max-angle")),wt=Math.cos(nt),Bt=it.signedDistanceFromCamera>0?lr(jt,E,Oe,yt,ue&&y.flipState===1,et,Se,y,T,L,{},Ce&&!F?$e:null,F&&Ce,fe,se,F,wt):null;let oi=!1,Mt=!1,Lt=!0;if(Bt&&!it.occluded){const li=.5*Y*gt+J,ti=new r.P(-100,-100),Yt=new r.P(this.screenRightBoundary,this.screenBottomBoundary),ii=new GM,{first:ji,last:Sn}=Bt,zn=ji.path.length;let vr=[];for(let dn=zn-1;dn>=1;dn--)vr.push(ji.path[dn]);for(let dn=1;dn<Sn.path.length;dn++)vr.push(Sn.path[dn]);const qi=2.5*li;O&&(vr=vr.map(([dn,hr,Ln],Ir)=>(Ce&&!ct&&(Ln=me(Ir<zn-1?ji.tilePath[zn-1-Ir]:Sn.tilePath[Ir-zn+2],ae,$e.elevationFeature)[2]),no(dn,hr,Ln,O))),vr.some(dn=>dn[3]<=0)&&(vr=[]));let Dn=[];if(vr.length>0){let dn=1/0,hr=-1/0,Ln=1/0,Ir=-1/0;for(const Wn of vr)dn=Math.min(dn,Wn[0]),Ln=Math.min(Ln,Wn[1]),hr=Math.max(hr,Wn[0]),Ir=Math.max(Ir,Wn[1]);hr>=ti.x&&dn<=Yt.x&&Ir>=ti.y&&Ln<=Yt.y&&(Dn=[vr.map(Wn=>new r.P(Wn[0],Wn[1]))],(dn<ti.x||hr>Yt.x||Ln<ti.y||Ir>Yt.y)&&(Dn=r.bV(Dn,ti.x,ti.y,Yt.x,Yt.y)))}for(const dn of Dn){ii.reset(dn,.25*li);let hr=0;hr=ii.length<=.5*li?1:Math.ceil(ii.paddedLength/qi)+1;for(let Ln=0;Ln<hr;Ln++){const Ir=Ln/Math.max(hr-1,1),Wn=ii.lerp(Ir),hn=Wn.x+_c,nr=Wn.y+_c;ne.push(hn,nr,li,0);const gn=hn-li,Or=nr-li,or=hn+li,Ki=nr+li;if(Lt=Lt&&this.isOffscreen(gn,Or,or,Ki),Mt=Mt||this.isInsideGrid(gn,Or,or,Ki),!h&&this.grid.hitTestCircle(hn,nr,li,Z)&&(oi=!0,!H))return{circles:[],offscreen:!1,collisionDetected:oi,occluded:!1}}}}return{circles:!H&&oi||!Mt?[]:ne,offscreen:Lt,collisionDetected:oi,occluded:it.occluded}}queryRenderedSymbols(a){if(a.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const h=[];let y=1/0,b=1/0,T=-1/0,E=-1/0;for(const O of a){const H=new r.P(O.x+_c,O.y+_c);y=Math.min(y,H.x),b=Math.min(b,H.y),T=Math.max(T,H.x),E=Math.max(E,H.y),h.push(H)}const P=this.grid.query(y,b,T,E).concat(this.ignoredGrid.query(y,b,T,E)),M={},L={};for(const O of P){const H=O.key;if(M[H.bucketInstanceId]===void 0&&(M[H.bucketInstanceId]={}),M[H.bucketInstanceId][H.featureIndex])continue;const F=[new r.P(O.x1,O.y1),new r.P(O.x2,O.y1),new r.P(O.x2,O.y2),new r.P(O.x1,O.y2)];r.bW(h,F)&&(M[H.bucketInstanceId][H.featureIndex]=!0,L[H.bucketInstanceId]===void 0&&(L[H.bucketInstanceId]=[]),L[H.bucketInstanceId].push(H.featureIndex))}return L}insertCollisionBox(a,h,y,b,T){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:b,collisionGroupID:T},a[0],a[1],a[2],a[3])}insertCollisionCircles(a,h,y,b,T){const E=h?this.ignoredGrid:this.grid,P={bucketInstanceId:y,featureIndex:b,collisionGroupID:T};for(let M=0;M<a.length;M+=4)E.insertCircle(P,a[M],a[M+1],a[M+2])}projectAndGetPerspectiveRatio(a,h,y,b,T,E,P){const M=[h,y,b,1];let L=!1;b||this.transform.pitch>0?(r.aC(M,M,a),this.fogState&&T&&P.name!=="globe"&&(L=function(F,Z,Y,J,se,ne){const ae=ne.calculateFogTileMatrix(se),fe=[Z,Y,J];return r.af(fe,fe,ae),Ee(F,r.ag(fe),ne.pitch,ne._fov)}(this.fogState,h,y,b,T.toUnwrapped(),this.transform)>.9)):yc(M,M,a);const O=M[3];return{point:new r.P((M[0]/O+1)/2*this.transform.width+_c,(-M[1]/O+1)/2*this.transform.height+_c),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(P)/O*.5,1.5),signedDistanceFromCamera:O,occluded:E&&M[2]>O||L}}isOffscreen(a,h,y,b){return y<_c||a>=this.screenRightBoundary||b<_c||h>this.screenBottomBoundary}isInsideGrid(a,h,y,b){return y>=0&&a<this.gridRightBoundary&&b>=0&&h<this.gridBottomBoundary}getViewportMatrix(){const a=r.bz([]);return r.bq(a,a,[-100,-100,0]),a}}class xi{constructor(a,h,y,b){this.opacity=a?Math.max(0,Math.min(1,a.opacity+(a.placed?h:-h))):b&&y?1:0,this.placed=y}isHidden(){return this.opacity===0&&!this.placed}}class Gn{constructor(a,h,y,b,T,E=!1){this.text=new xi(a?a.text:null,h,y,T),this.icon=new xi(a?a.icon:null,h,b,T),this.clipped=E}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class sr{constructor(a,h,y,b=!1){this.text=a,this.icon=h,this.skipFade=y,this.clipped=b}}class fl{constructor(){this.invProjMatrix=r.bB(),this.viewportMatrix=r.bB(),this.circles=[]}}class xf{constructor(a,h,y,b,T){this.bucketInstanceId=a,this.featureIndex=h,this.sourceLayerIndex=y,this.bucketIndex=b,this.tileID=T}}class dr{constructor(a){this.crossSourceCollisions=a,this.maxGroupID=0,this.collisionGroups={}}get(a){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[a]){const h=++this.maxGroupID;this.collisionGroups[a]={ID:h,predicate:y=>y.collisionGroupID===h}}return this.collisionGroups[a]}}function ny(g,a,h,y,b){const{horizontalAlign:T,verticalAlign:E}=r.c0(g),P=-(T-.5)*a,M=-(E-.5)*h,L=r.c1(g,y);return new r.P(P+L[0]*b,M+L[1]*b)}function rp(g,a,h,y,b){const T=new r.P(g,a);return h&&T._rotate(y?b:-b),T}class ry{constructor(a,h,y,b,T,E){this.transform=a.clone(),this.projection=a.projection.name,this.collisionIndex=new vf(this.transform,T),this.buildingIndex=E,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new dr(y),this.collisionCircleArrays={},this.prevPlacement=b,b&&(b.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(a,h,y,b,T=1){const E=y.getBucket(h),P=y.latestFeatureIndex;if(!E||!P||h.fqid!==E.layerIds[0])return;const M=E.layers[0].layout,L=E.layers[0].paint,O=y.collisionBoxArray,H=Math.pow(2,this.transform.zoom-y.tileID.overscaledZ),F=y.tileSize/r.al,Z=y.tileID.toUnwrapped();this.transform.setProjection(E.projection);const Y=(J=y.tileID,se=E.getProjection(),ne=this.transform,se.name===this.projection?ne.calculateProjMatrix(J.toUnwrapped()):np(ne,se,J));var J,se,ne;const ae=M.get("text-pitch-alignment")==="map",fe=M.get("text-rotation-alignment")==="map";h.compileFilter(h.options);const ue=h.dynamicFilter(),Ce=h.dynamicFilterNeedsFeature(),me=this.transform.calculatePixelsToTileUnitsMatrix(y),Ie=ty(Y,y.tileID.canonical,ae,fe,this.transform,E.getProjection(),me);let Se=null;const ve=E.getProjection().createInversionMatrix(this.transform,y.tileID.canonical);if(ae){const Oe=Gu(Y,y.tileID.canonical,ae,fe,this.transform,E.getProjection(),me);Se=r.aB([],this.transform.labelPlaneMatrix,Oe)}let ke=null;ue&&y.latestFeatureIndex&&(ke={unwrappedTileID:Z,dynamicFilter:ue,dynamicFilterNeedsFeature:Ce}),this.retainedQueryData[E.bucketInstanceId]=new xf(E.bucketInstanceId,P,E.sourceLayerIndex,E.index,y.tileID);const[Ke,$e]=E.layers[0].layout.get("text-size-scale-range"),ct=r.aA(T,Ke,$e),[it,gt]=M.get("icon-size-scale-range"),jt=r.aA(T,it,gt),et={bucket:E,layout:M,paint:L,posMatrix:Y,invMatrix:ve,mercatorCenter:[r.aF(this.transform.center.lng),r.aJ(this.transform.center.lat)],textLabelPlaneMatrix:Ie,labelToScreenMatrix:Se,clippingData:ke,scale:H,textPixelRatio:F,holdingForFade:y.holdingForFade(),collisionBoxArray:O,partiallyEvaluatedTextSize:r.bJ(E.textSizeData,this.transform.zoom,ct),partiallyEvaluatedIconSize:r.bJ(E.iconSizeData,this.transform.zoom,jt),collisionGroup:this.collisionGroups.get(E.sourceID),latestFeatureIndex:y.latestFeatureIndex};if(b)for(const Oe of E.sortKeyRanges){const{sortKey:yt,symbolInstanceStart:nt,symbolInstanceEnd:wt}=Oe;a.push({sortKey:yt,symbolInstanceStart:nt,symbolInstanceEnd:wt,parameters:et})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:E.symbolInstances.length,parameters:et})}attemptAnchorPlacement(a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae,fe,ue,Ce){const{textOffset0:me,textOffset1:Ie,crossTileID:Se}=J,ve=[me,Ie],ke=ny(a,E,P,ve,M),Ke=this.collisionIndex.placeCollisionBox(ne,M,h,y,b,T,rp(ke.x,ke.y,L,O,this.transform.angle),Y,H,F,Z.predicate);if(fe){const $e=ne.getSymbolInstanceIconSize(Ce,this.transform.zoom,J.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(ne,$e,fe,y,b,T,rp(ke.x,ke.y,L,O,this.transform.angle),Y,H,F,Z.predicate).box.length===0)return}if(Ke.box.length>0){let $e;return this.prevPlacement&&this.prevPlacement.variableOffsets[Se]&&this.prevPlacement.placements[Se]&&this.prevPlacement.placements[Se].text&&($e=this.prevPlacement.variableOffsets[Se].anchor),this.variableOffsets[Se]={textOffset:ve,width:E,height:P,anchor:a,textScale:M,prevAnchor:$e},this.markUsedJustification(ne,a,J,ae),ne.allowVerticalPlacement&&(this.markUsedOrientation(ne,ae,J),this.placedOrientations[Se]=ae),{shift:ke,placedGlyphBoxes:Ke}}}placeLayerBucketPart(a,h,y,b,T=1){const{bucket:E,layout:P,paint:M,posMatrix:L,textLabelPlaneMatrix:O,labelToScreenMatrix:H,clippingData:F,textPixelRatio:Z,mercatorCenter:Y,invMatrix:J,holdingForFade:se,collisionBoxArray:ne,partiallyEvaluatedTextSize:ae,partiallyEvaluatedIconSize:fe,collisionGroup:ue,latestFeatureIndex:Ce}=a.parameters,me=P.get("text-optional"),Ie=P.get("icon-optional"),Se=P.get("text-allow-overlap"),ve=P.get("icon-allow-overlap"),ke=P.get("text-rotation-alignment")==="map",Ke=P.get("icon-rotation-alignment")==="map",$e=P.get("text-pitch-alignment")==="map",ct=M.get("symbol-z-offset"),it=P.get("symbol-elevation-reference")==="sea",gt=P.get("symbol-placement"),[jt,et]=P.get("text-size-scale-range"),[Oe,yt]=P.get("icon-size-scale-range"),nt=r.aA(T,jt,et),wt=r.aA(T,Oe,yt),Bt=P.get("text-variable-anchor"),oi=ke&>!=="point",Mt=Ke&>!=="point",Lt=Bt&&E.hasTextData(),li=E.hasIconTextFit()&&Lt&&E.hasIconData();this.transform.setProjection(E.projection);const ti=Lt||oi,Yt=Mt||li;let ii=Se&&(ve||!E.hasIconData()||Ie),ji=ve&&(Se||!E.hasTextData()||me);const Sn=!ct.isConstant();!E.collisionArrays&&ne&&E.deserializeCollisionBoxes(ne),y&&b&&E.updateCollisionDebugBuffers(this.transform.zoom,ne,nt,wt);const zn=(qi,Dn,dn)=>{const{crossTileID:hr,numVerticalGlyphVertices:Ln}=qi;let Ir=null;if(F&&F.dynamicFilterNeedsFeature||Sn){const ms=this.retainedQueryData[E.bucketInstanceId];Ir=Ce.loadFeature({featureIndex:qi.featureIndex,bucketIndex:ms.bucketIndex,sourceLayerIndex:ms.sourceLayerIndex,layoutVertexArrayOffset:0})}if(F&&!(0,F.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:E.worldview},Ir,this.retainedQueryData[E.bucketInstanceId].tileID.canonical,new r.P(qi.tileAnchorX,qi.tileAnchorY),this.transform.calculateDistanceTileData(F.unwrappedTileID)))return this.placements[hr]=new sr(!1,!1,!1,!0),void h.add(hr);const Wn=ct.evaluate(Ir,{});if(h.has(hr))return;if(se)return void(this.placements[hr]=new sr(!1,!1,!1));let hn=!1,nr=!1,gn=!0,Or=!1,or=!1,Ki=null,Bn={box:null,offscreen:null,occluded:null},ts={box:null},Ps=null,cs=null,ws=null,el=0,Ma=0,Ho=0;dn.textFeatureIndex?el=dn.textFeatureIndex:qi.useRuntimeCollisionCircles&&(el=qi.featureIndex),dn.verticalTextFeatureIndex&&(Ma=dn.verticalTextFeatureIndex);const sa=E.elevationFeatures?E.elevationFeatures[qi.elevationFeatureIndex]:void 0,Ol=ms=>{ms.tileID=this.retainedQueryData[E.bucketInstanceId].tileID;const Ns=this.transform.elevation;ms.elevation=it?Wn:Wn+r.bU.getAtTileOffset(ms.tileID,new r.P(ms.tileAnchorX,ms.tileAnchorY),Ns,sa),ms.elevation+=qi.zOffset},Go=dn.textBox;if(Go){Ol(Go);const ms=Ar=>{let Rs=r.bK.horizontal;if(E.allowVerticalPlacement&&!Ar&&this.prevPlacement){const xo=this.prevPlacement.placedOrientations[hr];xo&&(this.placedOrientations[hr]=xo,Rs=xo,this.markUsedOrientation(E,Rs,qi))}return Rs},Ns=(Ar,Rs)=>{if(E.allowVerticalPlacement&&Ln>0&&dn.verticalTextBox){for(const xo of E.writingModes)if(xo===r.bK.vertical?(Bn=Rs(),ts=Bn):Bn=Ar(),Bn&&Bn.box&&Bn.box.length)break}else Bn=Ar()};if(Bt){let Ar=Bt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[hr]){const gs=this.prevPlacement.variableOffsets[hr];Ar.indexOf(gs.anchor)>0&&(Ar=Ar.filter(Bl=>Bl!==gs.anchor),Ar.unshift(gs.anchor))}const Rs=(gs,Bl,Yf)=>{const nd=E.getSymbolInstanceTextSize(ae,qi,this.transform.zoom,Dn),Qf=(gs.x2-gs.x1)*nd+2*gs.padding,Jf=(gs.y2-gs.y1)*nd+2*gs.padding,Ul=qi.hasIconTextFit&&!ve?Bl:null;Ul&&Ol(Ul);let xu={box:[],offscreen:!1,occluded:!1};const po=Se?2*Ar.length:Ar.length;for(let Vl=0;Vl<po;++Vl){const _p=this.attemptAnchorPlacement(Ar[Vl%Ar.length],gs,Y,J,ti,Qf,Jf,nd,ke,$e,Z,L,ue,Vl>=Ar.length,qi,Dn,E,Yf,Ul,ae,fe);if(_p&&(xu=_p.placedGlyphBoxes,xu&&xu.box&&xu.box.length)){hn=!0,Ki=_p.shift;break}}return xu};Ns(()=>Rs(Go,dn.iconBox,r.bK.horizontal),()=>{const gs=dn.verticalTextBox;return gs&&Ol(gs),E.allowVerticalPlacement&&!(Bn&&Bn.box&&Bn.box.length)&&Ln>0&&gs?Rs(gs,dn.verticalIconBox,r.bK.vertical):{box:null,offscreen:null,occluded:null}}),Bn&&(hn=Bn.box,gn=Bn.offscreen,Or=Bn.occluded);const xo=ms(!(!Bn||!Bn.box));if(!hn&&this.prevPlacement){const gs=this.prevPlacement.variableOffsets[hr];gs&&(this.variableOffsets[hr]=gs,this.markUsedJustification(E,gs.anchor,qi,xo))}}else{const Ar=(Rs,xo)=>{const gs=E.getSymbolInstanceTextSize(ae,qi,this.transform.zoom,Dn),Bl=this.collisionIndex.placeCollisionBox(E,gs,Rs,Y,J,ti,new r.P(0,0),Se,Z,L,ue.predicate);return Bl&&Bl.box&&Bl.box.length&&(this.markUsedOrientation(E,xo,qi),this.placedOrientations[hr]=xo),Bl};Ns(()=>Ar(Go,r.bK.horizontal),()=>{const Rs=dn.verticalTextBox;return E.allowVerticalPlacement&&Ln>0&&Rs?(Ol(Rs),Ar(Rs,r.bK.vertical)):{box:null,offscreen:null,occluded:null}}),ms(!!(Bn&&Bn.box&&Bn.box.length))}}if(Ps=Bn,hn=Ps&&Ps.box&&Ps.box.length>0,gn=Ps&&Ps.offscreen,Or=Ps&&Ps.occluded,qi.useRuntimeCollisionCircles){const ms=qi.centerJustifiedTextSymbolIndex>=0?qi.centerJustifiedTextSymbolIndex:qi.verticalPlacedTextSymbolIndex,Ns=E.text.placedSymbolArray.get(ms),Ar=r.bL(E.textSizeData,ae,Ns),Rs=P.get("text-padding");cs=this.collisionIndex.placeCollisionCircles(E,Se,Ns,ms,E.lineVertexArray,E.glyphOffsetArray,Ar,L,O,H,y,$e,ue.predicate,qi.collisionCircleDiameter*Ar/r.bX,Rs,this.retainedQueryData[E.bucketInstanceId].tileID),hn=Se||cs.circles.length>0&&!cs.collisionDetected,gn=gn&&cs.offscreen,Or=cs.occluded}if(dn.iconFeatureIndex&&(Ho=dn.iconFeatureIndex),dn.iconBox){const ms=Ns=>{Ol(Ns);const Ar=qi.hasIconTextFit&&Ki?rp(Ki.x,Ki.y,ke,$e,this.transform.angle):new r.P(0,0),Rs=E.getSymbolInstanceIconSize(fe,this.transform.zoom,qi.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(E,Rs,Ns,Y,J,Yt,Ar,ve,Z,L,ue.predicate)};ts&&ts.box&&ts.box.length&&dn.verticalIconBox?(ws=ms(dn.verticalIconBox),nr=ws.box.length>0):(ws=ms(dn.iconBox),nr=ws.box.length>0),gn=gn&&ws.offscreen,or=ws.occluded}const Fl=me||qi.numHorizontalGlyphVertices===0&&Ln===0,Cc=Ie||qi.numIconVertices===0;if(Fl||Cc?Cc?Fl||(nr=nr&&hn):hn=nr&&hn:nr=hn=nr&&hn,hn&&Ps&&Ps.box&&this.collisionIndex.insertCollisionBox(Ps.box,P.get("text-ignore-placement"),E.bucketInstanceId,ts&&ts.box&&Ma?Ma:el,ue.ID),nr&&ws&&this.collisionIndex.insertCollisionBox(ws.box,P.get("icon-ignore-placement"),E.bucketInstanceId,Ho,ue.ID),cs&&(hn&&this.collisionIndex.insertCollisionCircles(cs.circles,P.get("text-ignore-placement"),E.bucketInstanceId,el,ue.ID),y)){const ms=E.bucketInstanceId;let Ns=this.collisionCircleArrays[ms];Ns===void 0&&(Ns=this.collisionCircleArrays[ms]=new fl);for(let Ar=0;Ar<cs.circles.length;Ar+=4)Ns.circles.push(cs.circles[Ar+0]),Ns.circles.push(cs.circles[Ar+1]),Ns.circles.push(cs.circles[Ar+2]),Ns.circles.push(cs.collisionDetected?1:0)}const vo=E.projection.name!=="globe";ii=ii&&(vo||!Or),ji=ji&&(vo||!or),this.placements[hr]=new sr(hn||ii,nr||ji,gn||E.justReloaded),h.add(hr)},vr=this.retainedQueryData[E.bucketInstanceId].tileID;if(E.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(E,vr),E.elevationType==="road"&&E.updateRoadElevation(vr.canonical),E.updateZOffset(),E.sortFeaturesByY){const qi=E.getSortedSymbolIndexes(this.transform.angle);for(let Dn=qi.length-1;Dn>=0;--Dn){const dn=qi[Dn];zn(E.symbolInstances.get(dn),dn,E.collisionArrays[dn])}E.hasAnyZOffset&&r.w(`${E.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(E.hasAnyZOffset){const qi=E.getSortedIndexesByZOffset();for(let Dn=0;Dn<qi.length;++Dn){const dn=qi[Dn];zn(E.symbolInstances.get(dn),dn,E.collisionArrays[dn])}}else for(let qi=a.symbolInstanceStart;qi<a.symbolInstanceEnd;qi++)zn(E.symbolInstances.get(qi),qi,E.collisionArrays[qi]);if(y&&E.bucketInstanceId in this.collisionCircleArrays){const qi=this.collisionCircleArrays[E.bucketInstanceId];r.bk(qi.invProjMatrix,L),qi.viewportMatrix=this.collisionIndex.getViewportMatrix()}E.justReloaded=!1}markUsedJustification(a,h,y,b){const{leftJustifiedTextSymbolIndex:T,centerJustifiedTextSymbolIndex:E,rightJustifiedTextSymbolIndex:P,verticalPlacedTextSymbolIndex:M,crossTileID:L}=y,O=r.c2(h),H=b===r.bK.vertical?M:O==="left"?T:O==="center"?E:O==="right"?P:-1;T>=0&&(a.text.placedSymbolArray.get(T).crossTileID=H>=0&&T!==H?0:L),E>=0&&(a.text.placedSymbolArray.get(E).crossTileID=H>=0&&E!==H?0:L),P>=0&&(a.text.placedSymbolArray.get(P).crossTileID=H>=0&&P!==H?0:L),M>=0&&(a.text.placedSymbolArray.get(M).crossTileID=H>=0&&M!==H?0:L)}markUsedOrientation(a,h,y){const b=h===r.bK.horizontal||h===r.bK.horizontalOnly?h:0,T=h===r.bK.vertical?h:0,{leftJustifiedTextSymbolIndex:E,centerJustifiedTextSymbolIndex:P,rightJustifiedTextSymbolIndex:M,verticalPlacedTextSymbolIndex:L}=y,O=a.text.placedSymbolArray;E>=0&&(O.get(E).placedOrientation=b),P>=0&&(O.get(P).placedOrientation=b),M>=0&&(O.get(M).placedOrientation=b),L>=0&&(O.get(L).placedOrientation=T)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let y=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const b=h?h.symbolFadeChange(a):1,T=h?h.opacities:{},E=h?h.variableOffsets:{},P=h?h.placedOrientations:{};for(const M in this.placements){const L=this.placements[M],O=T[M];O?(this.opacities[M]=new Gn(O,b,L.text,L.icon,null,L.clipped),y=y||L.text!==O.text.placed||L.icon!==O.icon.placed):(this.opacities[M]=new Gn(null,b,L.text,L.icon,L.skipFade,L.clipped),y=y||L.text||L.icon)}for(const M in T){const L=T[M];if(!this.opacities[M]){const O=new Gn(L,b,!1,!1);O.isHidden()||(this.opacities[M]=O,y=y||L.text.placed||L.icon.placed)}}for(const M in E)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=E[M]);for(const M in P)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=P[M]);y?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:a)}updateLayerOpacities(a,h,y,b){const T=new Set;for(const E of h){const P=E.getBucket(a);P&&E.latestFeatureIndex&&a.fqid===P.layerIds[0]&&(this.updateBucketOpacities(P,T,E,E.collisionBoxArray,y,b,E.tileID,a.scope),P.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(P,E.tileID),P.elevationType==="road"&&P.updateRoadElevation(E.tileID.canonical),P.updateZOffset())}}updateBucketOpacities(a,h,y,b,T,E,P,M){a.hasTextData()&&a.text.opacityVertexArray.clear(),a.hasIconData()&&a.icon.opacityVertexArray.clear(),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();const L=a.layers[0].layout,O=a.layers[0].paint,H=!!a.layers[0].dynamicFilter(),F=new Gn(null,0,!1,!1,!0),Z=L.get("text-allow-overlap"),Y=L.get("icon-allow-overlap"),J=L.get("text-variable-anchor"),se=L.get("text-rotation-alignment")==="map",ne=L.get("text-pitch-alignment")==="map",ae=O.get("symbol-z-offset"),fe=L.get("symbol-elevation-reference")==="sea",ue=!ae.isConstant(),Ce=new Gn(null,0,Z&&(Y||!a.hasIconData()||L.get("icon-optional")),Y&&(Z||!a.hasTextData()||L.get("text-optional")),!0);!a.collisionArrays&&b&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(b);const me=(Se,ve,ke)=>{for(let Ke=0;Ke<ve/4;Ke++)Se.opacityVertexArray.emplaceBack(ke)};let Ie=0;E&&a.updateReplacement(P,E);for(let Se=0;Se<a.symbolInstances.length;Se++){const ve=a.symbolInstances.get(Se),{numHorizontalGlyphVertices:ke,numVerticalGlyphVertices:Ke,crossTileID:$e,numIconVertices:ct,tileAnchorX:it,tileAnchorY:gt}=ve;let jt=null;const et=this.retainedQueryData[a.bucketInstanceId];ue&&ve&&et&&(jt=y.latestFeatureIndex.loadFeature({featureIndex:ve.featureIndex,bucketIndex:et.bucketIndex,sourceLayerIndex:et.sourceLayerIndex,layoutVertexArrayOffset:0}));const Oe=ae.evaluate(jt,{}),yt=h.has($e);let nt=this.opacities[$e];yt?nt=F:nt||(nt=Ce,this.opacities[$e]=nt),h.add($e);const wt=ke>0||Ke>0,Bt=ct>0,oi=this.placedOrientations[$e],Mt=oi===r.bK.vertical,Lt=oi===r.bK.horizontal||oi===r.bK.horizontalOnly;!wt&&!Bt||nt.isHidden()||Ie++;let li=!1;if((wt||Bt)&&E)for(const ti of a.activeReplacements){if(r.bY(ti,T,r.bZ.Symbol,M)||ti.min.x>it||it>ti.max.x||ti.min.y>gt||gt>ti.max.y)continue;const Yt=r.b_(it,gt,P.canonical,ti.footprintTileId.canonical);if(li=r.b$(Yt,ti.footprint),li)break}if(wt){const ti=li?_o:ay(nt.text);me(a.text,ke,Mt?_o:ti),me(a.text,Ke,Lt?_o:ti);const Yt=nt.text.isHidden(),{leftJustifiedTextSymbolIndex:ii,centerJustifiedTextSymbolIndex:ji,rightJustifiedTextSymbolIndex:Sn,verticalPlacedTextSymbolIndex:zn}=ve,vr=a.text.placedSymbolArray,qi=Yt||Mt?1:0;ii>=0&&(vr.get(ii).hidden=qi),ji>=0&&(vr.get(ji).hidden=qi),Sn>=0&&(vr.get(Sn).hidden=qi),zn>=0&&(vr.get(zn).hidden=Yt||Lt?1:0);const Dn=this.variableOffsets[$e];Dn&&this.markUsedJustification(a,Dn.anchor,ve,oi);const dn=this.placedOrientations[$e];dn&&(this.markUsedJustification(a,"left",ve,dn),this.markUsedOrientation(a,dn,ve))}if(Bt){const ti=li?_o:ay(nt.icon),{placedIconSymbolIndex:Yt,verticalPlacedIconSymbolIndex:ii}=ve,ji=a.icon.placedSymbolArray,Sn=nt.icon.isHidden()?1:0;Yt>=0&&(me(a.icon,ct,Mt?_o:ti),ji.get(Yt).hidden=Sn),ii>=0&&(me(a.icon,ve.numVerticalIconVertices,Lt?_o:ti),ji.get(ii).hidden=Sn)}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){const ti=a.collisionArrays[Se];if(ti){let Yt=new r.P(0,0),ii=!0;if(ti.textBox||ti.verticalTextBox){if(J){const Sn=this.variableOffsets[$e];Sn?(Yt=ny(Sn.anchor,Sn.width,Sn.height,Sn.textOffset,Sn.textScale),se&&Yt._rotate(ne?this.transform.angle:-this.transform.angle)):ii=!1}H&&(ii=!nt.clipped),ti.textBox&&Do(a.textCollisionBox.collisionVertexArray,nt.text.placed,!ii||Mt,Oe,fe,Yt.x,Yt.y),ti.verticalTextBox&&Do(a.textCollisionBox.collisionVertexArray,nt.text.placed,!ii||Lt,Oe,fe,Yt.x,Yt.y)}const ji=ii&&!!(!Lt&&ti.verticalIconBox);ti.iconBox&&Do(a.iconCollisionBox.collisionVertexArray,nt.icon.placed,ji,Oe,fe,ve.hasIconTextFit?Yt.x:0,ve.hasIconTextFit?Yt.y:0),ti.verticalIconBox&&Do(a.iconCollisionBox.collisionVertexArray,nt.icon.placed,!ji,Oe,fe,ve.hasIconTextFit?Yt.x:0,ve.hasIconTextFit?Yt.y:0)}}}if(a.fullyClipped=Ie===0,a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.bucketInstanceId in this.collisionCircleArrays){const Se=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=Se.invProjMatrix,a.placementViewportMatrix=Se.viewportMatrix,a.collisionCircleArray=Se.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}}symbolFadeChange(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(a,h){const y=this.zoomAtLastRecencyCheck===h?1-this.zoomAdjustment(h):1;return this.zoomAtLastRecencyCheck=h,this.commitTime+this.fadeDuration*y>a}setStale(){this.stale=!0}}function Do(g,a,h,y,b,T,E){g.emplaceBack(a?1:0,h?1:0,T||0,E||0,y,b?1:0),g.emplaceBack(a?1:0,h?1:0,T||0,E||0,y,b?1:0),g.emplaceBack(a?1:0,h?1:0,T||0,E||0,y,b?1:0),g.emplaceBack(a?1:0,h?1:0,T||0,E||0,y,b?1:0)}const Js=Math.pow(2,25),WM=Math.pow(2,24),sy=Math.pow(2,17),v1=Math.pow(2,16),oy=Math.pow(2,9),_v=Math.pow(2,8),x1=Math.pow(2,1);function ay(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;const a=g.placed?1:0,h=Math.floor(127*g.opacity);return h*Js+a*WM+h*sy+a*v1+h*oy+a*_v+h*x1+a}const _o=0;class Ku{constructor(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&a.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(a,h,y,b,T,E){const P=this._bucketParts;for(;this._currentTileIndex<a.length;)if(h.getBucketParts(P,b,a[this._currentTileIndex],this._sortAcrossTiles,E),this._currentTileIndex++,T())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,P.sort((M,L)=>M.sortKey-L.sortKey));this._currentPartIndex<P.length;){const M=P[this._currentPartIndex];if(h.placeLayerBucketPart(M,this._seenCrossTileIDs,y,M.symbolInstanceStart===0,E),this._currentPartIndex++,T())return!0}return!1}}class Ya{constructor(a,h,y,b,T,E,P,M,L){this.placement=new ry(a,T,E,P,M,L),this._currentPlacementIndex=h.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=b,this._done=!1}isDone(){return this._done}continuePlacement(a,h,y,b,T){const E=r.o.now(),P=()=>{const M=r.o.now()-E;return!this._forceFullPlacement&&M>2};for(;this._currentPlacementIndex>=0;){const M=h[a[this._currentPlacementIndex]],L=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=L)&&(!M.maxzoom||M.maxzoom>L)){const O=M,H=O.layout.get("symbol-z-elevate"),F=O.layout.get("symbol-sort-key").constantOr(1)!==void 0,Z=O.layout.get("symbol-z-order"),Y=Z==="viewport-y"||Z==="auto"&&!(Z!=="viewport-y"&&F),J=O.layout.get("text-allow-overlap")||O.layout.get("icon-allow-overlap")||O.layout.get("text-ignore-placement")||O.layout.get("icon-ignore-placement"),se=Y&&J,ne=this._inProgressLayer=this._inProgressLayer||new Ku(O),ae=r.B(M.source,M.scope);if(ne.continuePlacement(H||se?b[ae]:y[ae],this.placement,this._showCollisionBoxes,M,P,T))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const vv=512/r.al/2;class bf{constructor(a,h,y){this.tileID=a,this.bucketInstanceId=y,this.index=new r.c3(h.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const b=a.canonical.x*r.al,T=a.canonical.y*r.al;for(let E=0;E<h.length;E++){const{key:P,crossTileID:M,tileAnchorX:L,tileAnchorY:O}=h.get(E),H=Math.floor((b+L)*vv),F=Math.floor((T+O)*vv);this.index.add(H,F),this.keys.push(P),this.crossTileIDs.push(M)}this.index.finish()}findMatches(a,h,y){const b=this.tileID.canonical.z<h.canonical.z?1:Math.pow(2,this.tileID.canonical.z-h.canonical.z),T=vv/Math.pow(2,h.canonical.z-this.tileID.canonical.z),E=h.canonical.x*r.al,P=h.canonical.y*r.al;for(let M=0;M<a.length;M++){const L=a.get(M);if(L.crossTileID)continue;const{key:O,tileAnchorX:H,tileAnchorY:F}=L,Z=Math.floor((E+H)*T),Y=Math.floor((P+F)*T),J=this.index.range(Z-b,Y-b,Z+b,Y+b).sort((se,ne)=>se-ne);for(const se of J){const ne=this.crossTileIDs[se];if(this.keys[se]===O&&!y.has(ne)){y.add(ne),L.crossTileID=ne;break}}}}}class ho{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class mu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(a){const h=Math.round((a-this.lng)/360);if(h!==0)for(const y in this.indexes){const b=this.indexes[y],T={};for(const E in b){const P=b[E];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+h),T[P.tileID.key]=P}this.indexes[y]=T}this.lng=a}addBucket(a,h,y){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===h.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(let T=0;T<h.symbolInstances.length;T++)h.symbolInstances.get(T).crossTileID=0;this.usedCrossTileIDs[a.overscaledZ]||(this.usedCrossTileIDs[a.overscaledZ]=new Set);const b=this.usedCrossTileIDs[a.overscaledZ];for(const T in this.indexes){const E=this.indexes[T];if(Number(T)>a.overscaledZ)for(const P in E){const M=E[P];M.tileID.isChildOf(a)&&M.findMatches(h.symbolInstances,a,b)}else{const P=E[a.scaledTo(Number(T)).key];P&&P.findMatches(h.symbolInstances,a,b)}}for(let T=0;T<h.symbolInstances.length;T++){const E=h.symbolInstances.get(T);E.crossTileID||(E.crossTileID=y.generate(),b.add(E.crossTileID))}return this.indexes[a.overscaledZ]===void 0&&(this.indexes[a.overscaledZ]={}),this.indexes[a.overscaledZ][a.key]=new bf(a,h.symbolInstances,h.bucketInstanceId),!0}removeBucketCrossTileIDs(a,h){for(const y of h.crossTileIDs)this.usedCrossTileIDs[a].delete(y)}removeStaleBuckets(a){let h=!1;for(const y in this.indexes){const b=this.indexes[y];for(const T in b)a[b[T].bucketInstanceId]||(this.removeBucketCrossTileIDs(y,b[T]),delete b[T],h=!0)}return h}}class Zu{constructor(){this.layerIndexes={},this.crossTileIDs=new ho,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(a,h,y,b){let T=this.layerIndexes[a.fqid];T===void 0&&(T=this.layerIndexes[a.fqid]=new mu);let E=!1;const P={};b.name!=="globe"&&T.handleWrapJump(y);for(const M of h){const L=M.getBucket(a);L&&a.fqid===L.layerIds[0]&&(L.bucketInstanceId||(L.bucketInstanceId=++this.maxBucketInstanceId),T.addBucket(M.tileID,L,this.crossTileIDs)&&(E=!0),P[L.bucketInstanceId]=!0)}return T.removeStaleBuckets(P)&&(E=!0),E}pruneUnusedLayers(a){const h={};a.forEach(y=>{h[y]=!0});for(const y in this.layerIndexes)h[y]||delete this.layerIndexes[y]}}const Ds=771;class mn{constructor(a,h,y,b){this.blendFunction=a,this.blendColor=h.toNonPremultipliedRenderColor(null),this.mask=y,this.blendEquation=b}}mn.Replace=[1,0,1,0],mn.disabled=new mn(mn.Replace,r.ao.transparent,[!1,!1,!1,!1]),mn.unblended=new mn(mn.Replace,r.ao.transparent,[!0,!0,!0,!0]),mn.alphaBlended=new mn([1,Ds,1,Ds],r.ao.transparent,[!0,!0,!0,!0]),mn.alphaBlendedNonPremultiplied=new mn([770,Ds,770,Ds],r.ao.transparent,[!0,!0,!0,!0]),mn.multiply=new mn([774,0,774,0],r.ao.transparent,[!0,!0,!0,!0]),mn.additive=new mn([1,1,1,1],r.ao.transparent,[!0,!0,!0,!0]);class hi{constructor(a,h,y){this.func=a,this.mask=h,this.range=y}}hi.ReadOnly=!1,hi.ReadWrite=!0,hi.disabled=new hi(519,hi.ReadOnly,[0,1]);const sp=7680;class Yi{constructor(a,h,y,b,T,E){this.test=a,this.ref=h,this.mask=y,this.fail=b,this.depthFail=T,this.pass=E}}Yi.disabled=new Yi({func:519,mask:0},0,0,sp,sp,sp);const wf=1029,xv=2305;class $i{constructor(a,h,y){this.enable=a,this.mode=h,this.frontFace=y}}function ly(g,a){const h=r.c9(g,3);r.cb(g,a),r.cf(g,3,h)}function bv(g,a){const h=r.c6([]);return r.c7(h,h,-a),r.c8(h,h,-g),h}function $E(g,a){const h=[g[0],g[1],0],y=[a[0],a[1],0];if(r.ag(h)>=1e-15){const E=r.aw([],h);r.c4(y,E,r.bI(y,E)),a[0]=y[0],a[1]=y[1]}const b=r.bH([],a,g);if(r.c5(b)<1e-15)return null;const T=Math.atan2(-b[1],b[0]);return bv(Math.atan2(Math.sqrt(g[0]*g[0]+g[1]*g[1]),-g[2]),T)}$i.disabled=new $i(!1,wf,xv),$i.backCCW=new $i(!0,wf,xv),$i.backCW=new $i(!0,wf,2304),$i.frontCW=new $i(!0,1028,2304),$i.frontCCW=new $i(!0,1028,xv);class gu{constructor(a,h){this.position=a,this.orientation=h}get position(){return this._position}set position(a){if(a){const h=a instanceof r.ae?a:new r.ae(a[0],a[1],a[2]);
vendor: 4,352 bytes, line 822
822this._renderWorldCopies&&(h.x=r.bS(h.x,0,1)),this._position=h}else this._position=null}lookAtPoint(a,h,y){if(this.orientation=null,!this.position)return;const b=this.position,T=y||(this._elevation?this._elevation.getAtPointOrZero(r.ae.fromLngLat(a)):0),E=r.ae.fromLngLat(a,T),P=[E.x-b.x,E.y-b.y,E.z-b.z];h||(h=[0,0,1]),h[2]=Math.abs(h[2]),this.orientation=$E(P,h)}setPitchBearing(a,h){this.orientation=bv(r.an(a),r.an(-h))}}class wv{constructor(a,h){this._transform=r.bz([]),this.orientation=h,this.position=a}get mercatorPosition(){const a=this.position;return new r.ae(a[0],a[1],a[2])}get position(){const a=r.c9(this._transform,3);return[a[0],a[1],a[2]]}set position(a){var h;a&&r.cf(this._transform,3,[(h=a)[0],h[1],h[2],1])}get orientation(){return this._orientation}set orientation(a){this._orientation=a||r.c6([]),a&&ly(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),h=this.right();return{bearing:Math.atan2(-h[1],h[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,h){this._orientation=bv(a,h),ly(this._transform,this._orientation)}forward(){const a=r.c9(this._transform,2);return[-a[0],-a[1],-a[2]]}up(){const a=r.c9(this._transform,1);return[-a[0],-a[1],-a[2]]}right(){const a=r.c9(this._transform,0);return[a[0],a[1],a[2]]}getCameraToWorld(a,h){const y=new Float64Array(16);return r.bk(y,this.getWorldToCamera(a,h)),y}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(a,h,y){const b=this.position;r.c4(b,b,-a);const T=new Float64Array(16);return r.bp(T,[y,y,y]),r.bq(T,T,b),T[10]*=h,T}getWorldToCamera(a,h){const y=new Float64Array(16),b=new Float64Array(4),T=this.position;return r.ca(b,this._orientation),r.c4(T,T,-a),r.cb(y,b),r.bq(y,y,T),y[1]*=-1,y[5]*=-1,y[9]*=-1,y[13]*=-1,y[8]*=h,y[9]*=h,y[10]*=h,y[11]*=h,y}getCameraToClipPerspective(a,h,y,b){const T=new Float64Array(16);return r.cc(T,a,h,y,b),T}getCameraToClipOrthographic(a,h,y,b,T,E){const P=new Float64Array(16);return r.cd(P,a,h,y,b,T,E),P}getDistanceToElevation(a,h=!1){const y=a===0?0:r.ce(a,h?r.a_(this.position[1]):this.position[1]),b=this.forward();return(y-this.position[2])/b[2]}clone(){return new wv([...this.position],[...this.orientation])}}const Ro={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class ya{constructor(a=0,h=0,y=0,b=0){if(isNaN(a)||a<0||isNaN(h)||h<0||isNaN(y)||y<0||isNaN(b)||b<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=h,this.left=y,this.right=b}interpolate(a,h,y){return h.top!=null&&a.top!=null&&(this.top=r.ak(a.top,h.top,y)),h.bottom!=null&&a.bottom!=null&&(this.bottom=r.ak(a.bottom,h.bottom,y)),h.left!=null&&a.left!=null&&(this.left=r.ak(a.left,h.left,y)),h.right!=null&&a.right!=null&&(this.right=r.ak(a.right,h.right,y)),this}getCenter(a,h){const y=r.aA((this.left+a-this.right)/2,0,a),b=r.aA((this.top+h-this.bottom)/2,0,h);return new r.P(y,b)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new ya(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const op=15;class Sf{constructor(a,h,y,b,T,E,P){this.tileSize=512,this._renderWorldCopies=T===void 0||T,this._minZoom=a||0,this._maxZoom=h||22,this._minPitch=y??0,this._maxPitch=b??60,this.setProjection(E),this.setMaxBounds(P),this.width=0,this.height=0,this._center=new r.aS(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 ya,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new wv,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 a=new Sf(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a._centerAltitudeValidForE
vendor: 27,721 bytes, line 822
822xaggeration=this._centerAltitudeValidForExaggeration,a.tileSize=this.tileSize,a.mercatorFromTransition=this.mercatorFromTransition,a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._seaLevelZoom=this._seaLevelZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a.frustumCorners=this.frustumCorners,a._allowWorldUnderZoom=this._allowWorldUnderZoom,a}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<op}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(a,h=!1){const y=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||y)&&this._updateCameraOnTerrain(),(a||y)&&this._constrainCamera(h),this._calcMatrices()}getProjection(){return r.aH(this.projection,["name","center","parallels"])}setProjection(a){this.projectionOptions=a||{name:"mercator"};const h=this.projection?this.getProjection():void 0;this.projection=r.cl(this.projectionOptions);const y=this.getProjection(),b=!r.bx(h,y);return b&&this._calcMatrices(),this.mercatorFromTransition=!1,b}setOrthographicProjectionAtLowPitch(a){return this._orthographicProjectionAtLowPitch!==a&&(this._orthographicProjectionAtLowPitch=a,this._calcMatrices(),!0)}setMercatorFromTransition(){const a=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=r.cl({name:"mercator"});const h=a!==this.projection.name;return h&&this._calcMatrices(),h}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return r.ce(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new r.P(this.width,this.height)}get bearing(){return r.bS(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(a){const h=-a*Math.PI/180;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=r.cm(),r.cn(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(a){const h=r.aA(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=r.an(a),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const a=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/a)}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(a){const h=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._setZoom(h),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(a){this._tileCoverLift!==a&&(this._tileCoverLift=a)}_updateCameraOnTerrain(){const a=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,h=this.elevation&&a===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||a===Number.NEGATIVE_INFINITY&&(!h||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const y=this._elevation;h||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&y.exaggeration()&&this._centerAltitudeValidForExaggeration!==y.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*y.exaggeration(),this._centerAltitudeValidForExaggeration=y.exaggeration()):(this._centerAltitude=a||0,this._centerAltitudeValidForExaggeration=y.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const a=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(a)}sampleAverageElevation(){if(!this._elevation)return 0;const a=this._elevation,h=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],y=this.horizonLineFromTop();let b=0,T=0;for(let E=0;E<h.length;E++){const P=new r.P(h[E][0]*this.width,y+h[E][1]*(this.height-y)),M=a.pointCoordinate(P);if(!M)continue;const L=1/Math.hypot(M[0]-this._camera.position[0],M[1]-this._camera.position[1]);b+=M[3]*L,T+=L}return T===0?NaN:b/T}get center(){return this._center}set center(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const a=this._seaLevelZoom,h=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),y=this.pixelsPerMeter/this.worldSize*h,b=this._mercatorZfromZoom(a),T=this._mercatorZfromZoom(this._maxZoom),E=Math.max(b-y,T);this._setZoom(this._zoomFromMercatorZ(E))}get padding(){return this._edgeInsets.toJSON()}set padding(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())}computeZoomRelativeTo(a){const h=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,a.toAltitude()));let y;y=a.z<this._camera.position[2]?[h.x,h.y,h.z]:[a.x,a.y,a.z];const b=r.ag(r.av([],this._camera.position,y));return r.aA(this._zoomFromMercatorZ(b),this._minZoom,this._maxZoom)}setFreeCameraOptions(a){if(!this.height||!a.position&&!a.orientation)return;this._updateCameraState();let h=!1;if(a.orientation&&!r.co(a.orientation,this._camera.orientation)&&(h=this._setCameraOrientation(a.orientation)),a.position){const y=[a.position.x,a.position.y,a.position.z];r.cp(y,this._camera.position)||(this._setCameraPosition(y),h=!0)}h&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const a=this._camera.position,h=new gu;return h.position=new r.ae(a[0],a[1],a[2]),h.orientation=this._camera.orientation,h._elevation=this.elevation,h._renderWorldCopies=this.renderWorldCopies,h}_setCameraOrientation(a){if(!r.cq(a))return!1;r.cr(a,a);const h=r.cs([],[0,0,-1],a),y=r.cs([],[0,-1,0],a);if(y[2]<0)return!1;const b=$E(h,y);return!!b&&(this._camera.orientation=b,!0)}_setCameraPosition(a){const h=this.zoomScale(this.minZoom)*this.tileSize,y=this.zoomScale(this.maxZoom)*this.tileSize,b=this.cameraToCenterDistance;a[2]=r.aA(a[2],b/y,b/h),this._camera.position=a}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(a){return this._edgeInsets.equals(a)}interpolatePadding(a,h,y){this._unmodified=!1,this._edgeInsets.interpolate(a,h,y),this._constrain(),this._calcMatrices()}coveringZoomLevel(a){const h=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,h)}getVisibleUnwrappedCoordinates(a){const h=[new r.ct(0,a)];if(this.renderWorldCopies){const y=this.pointCoordinate(new r.P(0,0)),b=this.pointCoordinate(new r.P(this.width,0)),T=this.pointCoordinate(new r.P(this.width,this.height)),E=this.pointCoordinate(new r.P(0,this.height)),P=Math.floor(Math.min(y.x,b.x,T.x,E.x)),M=Math.floor(Math.max(y.x,b.x,T.x,E.x)),L=1;for(let O=P-L;O<=M+L;O++)O!==0&&h.push(new r.ct(O,a))}return h}isLODDisabled(a){return(!a||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(a,h,y){let b=[];const T=y!=null,E=!T;if(E&&this.zoom<h||T&&y[0]===0&&y[1]===0)return b;const P=new Set,M=(O,H,F,Z,Y)=>{const J=r.cX(H,O,F,Z,Y);P.has(J)||(b.push(new r.aP(O,H,F,Z,Y)),P.add(J))};for(let O=0;O<a.length;O++){const H=a[O];if(E&&H.canonical.z!==h)continue;const F=H.canonical,Z=H.overscaledZ,Y=H.wrap,J=1<<F.z,se=F.x+1<J,ne=F.x>0,ae=F.y+1<J,fe=F.y>0,ue=H.wrap-(ne?0:1),Ce=H.wrap+(se?0:1),me=ne?F.x-1:J-1,Ie=se?F.x+1:0;if(T)y[0]<0?(M(Z,Ce,F.z,Ie,F.y),y[1]<0&&ae&&(M(Z,Y,F.z,F.x,F.y+1),M(Z,Ce,F.z,Ie,F.y+1)),y[1]>0&&fe&&(M(Z,Y,F.z,F.x,F.y-1),M(Z,Ce,F.z,Ie,F.y-1))):y[0]>0?(M(Z,ue,F.z,me,F.y),y[1]<0&&ae&&(M(Z,Y,F.z,F.x,F.y+1),M(Z,ue,F.z,me,F.y+1)),y[1]>0&&fe&&(M(Z,Y,F.z,F.x,F.y-1),M(Z,ue,F.z,me,F.y-1))):y[1]<0&&ae?M(Z,Y,F.z,F.x,F.y+1):fe&&M(Z,Y,F.z,F.x,F.y-1);else{const Se=H.visibleQuadrants;1&Se&&(M(Z,ue,F.z,me,F.y),fe&&(M(Z,Y,F.z,F.x,F.y-1),M(Z,ue,F.z,me,F.y-1))),2&Se&&(M(Z,Ce,F.z,Ie,F.y),fe&&(M(Z,Y,F.z,F.x,F.y-1),M(Z,Ce,F.z,Ie,F.y-1))),4&Se&&(M(Z,ue,F.z,me,F.y),ae&&(M(Z,Y,F.z,F.x,F.y+1),M(Z,ue,F.z,me,F.y+1))),8&Se&&(M(Z,Ce,F.z,Ie,F.y),ae&&(M(Z,Y,F.z,F.x,F.y+1),M(Z,Ce,F.z,Ie,F.y+1)))}}const L=[];for(const O of b)b.some(H=>O.isChildOf(H))||L.push(O);if(b=L.filter(O=>!a.some(H=>!!(O.overscaledZ<h&&H.isChildOf(O))||O.equals(H)||O.isChildOf(H))),E){const O=1<<h,H=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),F=[O*H.x,O*H.y],Z=4,Y=Z*Z;b=b.filter(J=>{const se=J.canonical.x+.5-F[0],ne=J.canonical.y+.5-F[1];return se*se+ne*ne<Y})}return b}extendTileCoverToNearPlane(a,h,y){const b=[],T=new Set;for(const ae of a)T.add(ae.key);const E=(ae,fe,ue,Ce,me)=>{const Ie=r.cX(fe,ae,ue,Ce,me);T.has(Ie)||(b.push(new r.aP(ae,fe,ue,Ce,me)),T.add(Ie))},P=a.reduce((ae,fe)=>Math.max(ae,fe.overscaledZ),y),M=1<<y,L=[new r.P(0,0),new r.P(r.al,0),new r.P(r.al,r.al),new r.P(0,r.al)],O=new r.P(0,0),H=new r.P(0,0),F=(ae,fe)=>{const ue=Math.floor(ae[0]),Ce=Math.floor(ae[1]),me=(ae[0]-ue)*r.al,Ie=(ae[1]-Ce)*r.al,Se=Math.floor(fe[0]),ve=Math.floor(fe[1]),ke=(fe[0]-Se)*r.al,Ke=(fe[1]-ve)*r.al;for(let $e=-1;$e<=1;$e++){const ct=ue+$e;if(!(ct<0||ct>=M)){O.x=me-$e*r.al,H.x=ke-(ct-Se)*r.al;for(let it=-1;it<=1;it++){const gt=Ce+it;O.y=Ie-it*r.al,H.y=Ke-(gt-ve)*r.al,r.cY(O,H,L)&&E(P,0,y,ct,gt)}}}},Z=h.points,Y=Z[r.cu],J=Z[r.cv],se=this._projectToGround(Y,Z[r.cw]),ne=this._projectToGround(J,Z[r.cx]);return F(Y,se),F(J,ne),b}_projectToGround(a,h){return r.cy(r.cz(),a,h,a[2]/(a[2]-h[2]))}coveringTiles(a){let h=this.coveringZoomLevel(a);const y=h,b=this.elevation&&this.elevation.exaggeration(),T=b&&!a.isTerrainDEM,E=this.projection.name==="mercator";if(a.minzoom!==void 0&&h<a.minzoom)return[];a.maxzoom!==void 0&&h>a.maxzoom&&(h=a.maxzoom);const P=this.locationCoordinate(this.center),M=this.center.lat,L=1<<h,O=[L*P.x,L*P.y,0],H=this.projection.name==="globe",F=!H,Z=r.cA.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,h,F),Y=H?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),J=L*r.ce(1,this.center.lat),se=this._camera.position[2]/r.ce(1,this.center.lat),ne=[L*Y.x,L*Y.y,se*(F?1:J)],ae=H||b,fe=this.cameraToCenterDistance/a.tileSize*(a.roundZoom?1:.502),ue=this.isLODDisabled(!0)?h:0;let Ce;if(this._elevation&&a.isTerrainDEM)Ce=1e4*this._elevation.exaggeration();else if(this._elevation){const Oe=this._elevation.getMinMaxForVisibleTiles();Ce=Oe?Oe.max:this._centerAltitude}else Ce=this._centerAltitude;const me=a.isTerrainDEM?-Ce:this._elevation?this._elevation.getMinElevationBelowMSL():0,Ie=this.projection.isReprojectedInTileSpace?r.cB(this):1,Se=Oe=>{const nt=new r.ae(Oe.x+25e-6,Oe.y,Oe.z),wt=new r.ae(Oe.x,Oe.y+25e-6,Oe.z),Bt=Oe.toLngLat(),oi=nt.toLngLat(),Mt=wt.toLngLat(),Lt=this.locationCoordinate(Bt),li=this.locationCoordinate(oi),ti=this.locationCoordinate(Mt),Yt=Math.hypot(li.x-Lt.x,li.y-Lt.y),ii=Math.hypot(ti.x-Lt.x,ti.y-Lt.y);return Math.sqrt(Yt*ii)*Ie/25e-6},ve=Oe=>{const yt=Ce,nt=me;return{aabb:r.cE(this,L,0,0,0,Oe,nt,yt,this.projection),zoom:0,x:0,y:0,minZ:nt,maxZ:yt,wrap:Oe,fullyVisible:!1}},ke=[];let Ke=[];const $e=h,ct=a.reparseOverscaled?y:h,it=(se-this._centerAltitude)*J,gt=Oe=>{if(!this._elevation||!Oe.tileID||!E)return;const yt=this._elevation.getMinMaxForTile(Oe.tileID),nt=Oe.aabb;yt?(nt.min[2]=yt.min,nt.max[2]=yt.max,nt.center[2]=(nt.min[2]+nt.max[2])/2):(Oe.shouldSplit=et(Oe),Oe.shouldSplit||(nt.min[2]=nt.max[2]=nt.center[2]=this._centerAltitude))},jt=(Oe,yt)=>{if(.707*yt<Oe)return 1;const nt=yt/Oe;return nt/(1.4144271570014144+(Math.pow(1.1,nt-1.4144271570014144+1)-1)/(1.1-1)-1)},et=Oe=>{if(Oe.zoom<ue)return!0;if(Oe.zoom===$e)return!1;if(Oe.shouldSplit!=null)return Oe.shouldSplit;const yt=Oe.aabb.distanceX(ne),nt=Oe.aabb.distanceY(ne);let wt=it,Bt=1;if(H){wt=Oe.aabb.distanceZ(ne);const ii=Math.pow(2,Oe.zoom),ji=r.a_((Oe.y+1)/ii),Sn=r.a_(Oe.y/ii),zn=Math.min(Math.max(M,ji),Sn),vr=r.d0(zn)/r.d0(M);if(Bt=zn===M?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,vr/this._mercatorScaleRatio),this.zoom<=r.cZ&&Oe.zoom===$e-1&&vr>=.9)return!0}else if(T&&(wt=Oe.aabb.distanceZ(ne)*J),this.projection.isReprojectedInTileSpace&&y<=5){const ii=Math.pow(2,Oe.zoom),ji=Se(new r.ae((Oe.x+.5)/ii,(Oe.y+.5)/ii));Bt=ji>.85?1:ji}if(!E&&!H){const ii=Math.sqrt(yt*yt+nt*nt+wt*wt);let ji=(1<<$e-Oe.zoom)*fe*Bt;return ji*=jt(Math.max(wt,it),ii),ii<ji}let oi=Number.MAX_VALUE,Mt=0;const Lt=Oe.aabb.getCorners(),li=[];for(const ii of Lt){r.av(li,ii,ne),H||(T?li[2]*=J:li[2]=it);const ji=r.bI(li,this._camera.forward());ji<oi&&(oi=ji,Mt=Math.abs(li[2]))}let ti=(1<<$e-Oe.zoom)*fe*Bt;if(ti*=jt(Math.max(Mt,it),oi),oi<ti)return!0;const Yt=Oe.aabb.closestPoint(O);return Yt[0]===O[0]&&Yt[1]===O[1]};if(this.renderWorldCopies)for(let Oe=1;Oe<=3;Oe++)ke.push(ve(-Oe)),ke.push(ve(Oe));for(ke.push(ve(0));ke.length>0;){const Oe=ke.pop(),yt=Oe.x,nt=Oe.y;let wt=Oe.fullyVisible;const Bt=()=>this.projection.name==="globe"&&(Oe.y===0||Oe.y===(1<<Oe.zoom)-1);if(!wt){let oi=ae?Oe.aabb.intersects(Z):Oe.aabb.intersectsFlat(Z);if(oi===0&&Bt()){const Mt=new r.cC(Oe.zoom,yt,nt);oi=r.cD(this,L,Mt,!0).intersects(Z)}if(oi===0)continue;wt=oi===2}if(Oe.zoom!==$e&&et(Oe))for(let oi=0;oi<4;oi++){const Mt=(yt<<1)+oi%2,Lt=(nt<<1)+(oi>>1),li={aabb:E?Oe.aabb.quadrant(oi):r.cE(this,L,Oe.zoom+1,Mt,Lt,Oe.wrap,Oe.minZ,Oe.maxZ,this.projection),zoom:Oe.zoom+1,x:Mt,y:Lt,wrap:Oe.wrap,fullyVisible:wt,tileID:void 0,shouldSplit:void 0,minZ:Oe.minZ,maxZ:Oe.maxZ};T&&!H&&(li.tileID=new r.aP(Oe.zoom+1===$e?ct:Oe.zoom+1,Oe.wrap,Oe.zoom+1,Mt,Lt),gt(li)),ke.push(li)}else{const oi=Oe.zoom===$e?ct:Oe.zoom;if(a.minzoom&&a.minzoom>oi)continue;let Mt=0;if(!wt){let Yt=ae?Oe.aabb.intersectsPrecise(Z):Oe.aabb.intersectsPreciseFlat(Z);if(Yt===0&&Bt()){const ii=new r.cC(Oe.zoom,yt,nt);Yt=r.cD(this,L,ii,!0).intersectsPrecise(Z)}if(Yt===0)continue;if(a.calculateQuadrantVisibility)if(Z.containsPoint(Oe.aabb.center))Mt=15;else for(let ii=0;ii<4;ii++)Oe.aabb.quadrant(ii).intersects(Z)!==0&&(Mt|=1<<ii)}const Lt=O[0]-(.5+yt+(Oe.wrap<<Oe.zoom))*(1<<h-Oe.zoom),li=O[1]-.5-nt,ti=Oe.tileID?Oe.tileID:new r.aP(oi,Oe.wrap,Oe.zoom,yt,nt);a.calculateQuadrantVisibility&&(ti.visibleQuadrants=Mt),Ke.push({tileID:ti,distanceSq:Lt*Lt+li*li})}}if(this.fogCullDistSq){const Oe=this.fogCullDistSq,yt=this.horizonLineFromTop();Ke=Ke.filter(nt=>{const wt=[0,0,0,1],Bt=[r.al,r.al,0,1],oi=this.calculateFogTileMatrix(nt.tileID.toUnwrapped());r.aC(wt,wt,oi),r.aC(Bt,Bt,oi);const Mt=r.cF([],wt,Bt),Lt=r.cG([],wt,Bt),li=r.c_(Mt,Lt);if(li===0)return!0;let ti=!1;const Yt=this._elevation;if(Yt&&li>Oe&&yt!==0){const ii=this.calculateProjMatrix(nt.tileID.toUnwrapped());let ji;a.isTerrainDEM||(ji=Yt.getMinMaxForTile(nt.tileID)),ji||(ji={min:me,max:Ce});const Sn=r.cH(this.rotation),zn=[Sn[0]*r.al,Sn[1]*r.al,ji.max];r.af(zn,zn,ii),ti=(1-zn[1])*this.height*.5<yt}return li<Oe||ti})}return Ke.sort((Oe,yt)=>Oe.distanceSq-yt.distanceSq).map(Oe=>Oe.tileID)}resize(a,h){this.width=a,this.height=h,this.pixelsToGLUnits=[2/a,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log2(a)}project(a){const h=r.aA(a.lat,-r.cI,r.cI),y=this.projection.project(a.lng,h);return new r.P(y.x*this.worldSize,y.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/r.ce(1,this.center.lat)/this.worldSize}setLocationAtPoint(a,h){let y,b;const T=this.centerPoint;if(this.projection.name==="globe"){const P=this.worldSize;y=(h.x-T.x)/P,b=(h.y-T.y)/P}else{const P=this.pointCoordinate(h),M=this.pointCoordinate(T);y=P.x-M.x,b=P.y-M.y}const E=this.locationCoordinate(a);this.setLocation(new r.ae(E.x-y,E.y-b))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a,h){return this.projection.locationPoint(this,a,h)}locationPoint3D(a,h){return this.projection.locationPoint(this,a,h,!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a,h){return this.coordinateLocation(this.pointCoordinate3D(a,h))}locationCoordinate(a,h){const y=h?r.ce(h,a.lat):void 0,b=this.projection.project(a.lng,a.lat);return new r.ae(b.x,b.y,y)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(a,h){const y=h??this._centerAltitude,b=[a.x,a.y,0,1],T=[a.x,a.y,1,1];r.aC(b,b,this.pixelMatrixInverse),r.aC(T,T,this.pixelMatrixInverse);const E=T[3];r.cJ(b,b,1/b[3]),r.cJ(T,T,1/E);const P=b[2],M=T[2];return{p0:b,p1:T,t:P===M?0:(y-P)/(M-P)}}screenPointToMercatorRay(a){const h=[a.x,a.y,0,1],y=[a.x,a.y,1,1];return r.aC(h,h,this.pixelMatrixInverse),r.aC(y,y,this.pixelMatrixInverse),r.cJ(h,h,1/h[3]),r.cJ(y,y,1/y[3]),h[2]=r.ce(h[2],this._center.lat)*this.worldSize,y[2]=r.ce(y[2],this._center.lat)*this.worldSize,r.cJ(h,h,1/this.worldSize),r.cJ(y,y,1/this.worldSize),new r.ax([h[0],h[1],h[2]],r.aw([],r.av([],y,h)))}rayIntersectionCoordinate(a){const{p0:h,p1:y,t:b}=a,T=r.ce(h[2],this._center.lat),E=r.ce(y[2],this._center.lat);return new r.ae(r.ak(h[0],y[0],b)/this.worldSize,r.ak(h[1],y[1],b)/this.worldSize,r.ak(T,E,b))}pointCoordinate(a,h=this._centerAltitude){return this.projection.pointCoordinate(this,a.x,a.y,h)}pointCoordinate3D(a,h){if(!this.elevation)return this.pointCoordinate(a,h);let y=this.projection.pointCoordinate3D(this,a.x,a.y);if(y)return new r.ae(y[0],y[1],y[2]);let b=0,T=this.horizonLineFromTop();if(a.y>T)return this.pointCoordinate(a,h);const E=.02*T,P=a.clone();for(let M=0;M<10&&T-b>E;M++){P.y=r.ak(b,T,.66);const L=this.projection.pointCoordinate3D(this,P.x,P.y);L?(T=P.y,y=L):b=P.y}return y?new r.ae(y[0],y[1],y[2]):this.pointCoordinate(a)}isPointAboveHorizon(a){return this.projection.isPointAboveHorizon(this,a)}isPointOnSurface(a){if(a.y<0||a.y>this.height||a.x<0||a.x>this.width)return!1;if(this.elevation||this.zoom>=r.cK)return!this.isPointAboveHorizon(a);const h=this.pointCoordinate(a);return h.y>=0&&h.y<=1}_coordinatePoint(a,h){const y=h&&this.elevation?this.elevation.getAtPointOrZero(a,this._centerAltitude):this._centerAltitude,b=[a.x*this.worldSize,a.y*this.worldSize,y+a.toAltitude(),1];return r.aC(b,b,this.pixelMatrix),b[3]>0?new r.P(b[0]/b[3],b[1]/b[3]):new r.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:a,left:h}=this._edgeInsets,y=this.height-this._edgeInsets.bottom,b=this.width-this._edgeInsets.right,T=this.pointLocation3D(new r.P(h,a)),E=this.pointLocation3D(new r.P(b,a)),P=this.pointLocation3D(new r.P(b,y)),M=this.pointLocation3D(new r.P(h,y));let L=Math.min(T.lng,E.lng,P.lng,M.lng),O=Math.max(T.lng,E.lng,P.lng,M.lng),H=Math.min(T.lat,E.lat,P.lat,M.lat),F=Math.max(T.lat,E.lat,P.lat,M.lat);const Z=Math.pow(2,-this.zoom)/16*270,Y=this.projection.name==="globe"?1:4,J=(se,ne,ae,fe,ue)=>{const Ce=(se+ae)/2,me=(ne+fe)/2,Ie=new r.P(Ce,me),{lng:Se,lat:ve}=this.pointLocation3D(Ie),ke=Math.max(0,L-Se,H-ve,Se-O,ve-F);L=Math.min(L,Se),O=Math.max(O,Se),H=Math.min(H,ve),F=Math.max(F,ve),(ue<Y||ke>Z)&&(J(se,ne,Ce,me,ue+1),J(Ce,me,ae,fe,ue+1))};if(J(h,a,b,a,1),J(b,a,b,y,1),J(b,y,h,y,1),J(h,y,h,a,1),this.projection.name==="globe"){const[se,ne]=r.cL(this);se?(F=90,O=180,L=-180):ne&&(H=-90,O=180,L=-180)}return new r.aI(new r.aS(L,H),new r.aS(O,F))}_getBoundsRectangular(a,h){const{top:y,left:b}=this._edgeInsets,T=this.height-this._edgeInsets.bottom,E=this.width-this._edgeInsets.right,P=new r.P(b,y),M=new r.P(E,y),L=new r.P(E,T),O=new r.P(b,T);let H=this.pointCoordinate(P,a),F=this.pointCoordinate(M,a);const Z=this.pointCoordinate(L,h),Y=this.pointCoordinate(O,h),J=(se,ne)=>(ne.y-se.y)/(ne.x-se.x);return H.y>1&&F.y>=0?H=new r.ae((1-Y.y)/J(Y,H)+Y.x,1):H.y<0&&F.y<=1&&(H=new r.ae(-Y.y/J(Y,H)+Y.x,0)),F.y>1&&H.y>=0?F=new r.ae((1-Z.y)/J(Z,F)+Z.x,1):F.y<0&&H.y<=1&&(F=new r.ae(-Z.y/J(Z,F)+Z.x,0)),new r.aI().extend(this.coordinateLocation(H)).extend(this.coordinateLocation(F)).extend(this.coordinateLocation(Y)).extend(this.coordinateLocation(Z))}_getBoundsRectangularTerrain(){const a=this.elevation;if(!a.visibleDemTiles.length||a.isUsingMockSource())return this._getBoundsRectangular(0,0);const h=a.visibleDemTiles.reduce((y,b)=>{if(b.dem){const T=b.dem.tree;y.min=Math.min(y.min,T.minimums[0]),y.max=Math.max(y.max,T.maximums[0])}return y},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(h.min*a.exaggeration(),h.max*a.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(a=!0){const h=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,y=this.height/2-h*(1-this._horizonShift);return a?Math.max(0,y):y}getMaxBounds(){return this.maxBounds}setMaxBounds(a){this.maxBounds=a,this.minLat=-r.cI,this.maxLat=r.cI,this.minLng=-180,this.maxLng=180,a&&(this.minLat=a.getSouth(),this.maxLat=a.getNorth(),this.minLng=a.getWest(),this.maxLng=a.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=r.aF(this.minLng)*this.tileSize,this.worldMaxX=r.aF(this.maxLng)*this.tileSize,this.worldMinY=r.aJ(this.maxLat)*this.tileSize,this.worldMaxY=r.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(a,h){return this.projection.createTileMatrix(this,h,a)}calculateDistanceTileData(a){const h=a.key,y=this._distanceTileDataCache;if(y[h])return y[h];const b=a.canonical,T=1/this.height,E=this.cameraWorldSize,P=E/this.zoomScale(b.z),M=(b.x+Math.pow(2,b.z)*a.wrap)*P,L=b.y*P,O=this.point;O.x*=E/this.worldSize,O.y*=E/this.worldSize;const H=this.angle,F=Math.sin(-H),Z=-Math.cos(-H);return y[h]={bearing:[F,Z],center:[(O.x-M)*T,(O.y-L)*T],scale:P/r.al*T},y[h]}calculateFogTileMatrix(a){const h=a.key,y=this._fogTileMatrixCache;if(y[h])return y[h];const b=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,a);return r.aB(b,this.worldToFogMatrix,b),y[h]=new Float32Array(b),y[h]}calculateProjMatrix(a,h=!1,y=!1){const b=a.key;let T;if(T=y?this._expandedProjMatrixCache:h?this._alignedProjMatrixCache:this._projMatrixCache,T[b])return T[b];const E=this.calculatePosMatrix(a,this.worldSize);let P;return P=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:y?this.expandedFarZProjMatrix:h?this.alignedProjMatrix:this.projMatrix,r.aB(E,P,E),T[b]=new Float32Array(E),T[b]}calculatePixelsToTileUnitsMatrix(a){const h=a.tileID.key,y=this._pixelsToTileUnitsCache;if(y[h])return y[h];const b=r.cM(a,this);return y[h]=b,y[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const a=1/this.worldSize,h=r.bp([],[a,a,a]);return r.aB(h,h,this.globeMatrix),h}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const a=this._elevation;this._updateCameraState();const h=r.ce(1,this._center.lat)*this.worldSize,y=this._computeCameraPosition(h),b=this._camera.forward(),T=r.ce(1,this._center.lat);y[2]/=T,b[2]/=T,r.aw(b,b);const E=a.raycast(y,b,a.exaggeration());if(E){const P=r.bG([],y,b,E),M=new r.ae(P[0],P[1],r.ce(P[2],r.a_(P[1]))),L=(M.z+r.ag([M.x-y[0],M.y-y[1],M.z-y[2]*T]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(L),this._centerAltitude=M.toAltitude(),this._center=this.coordinateLocation(M),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(a=!1){if(!this._elevation)return;const h=this._elevation,y=r.ce(1,this._center.lat)*this.worldSize,b=this._computeCameraPosition(y),T=h.getAtPointOrZero(new r.ae(...b)),E=this.pixelsPerMeter/this.worldSize*T,P=this._minimumHeightOverTerrain(),M=b[2]-E;if(M<=P)if(M<0||a){const L=this.locationCoordinate(this._center,this._centerAltitude),O=[b[0],b[1],L.z-b[2]],H=r.ag(O);O[2]-=(P-M)/this._pixelsPerMercatorPixel;const F=r.ag(O);if(F===0)return;r.c4(O,O,H/F*this._pixelsPerMercatorPixel),this._camera.position=[b[0],b[1],L.z*this._pixelsPerMercatorPixel-O[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const a=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||a){const F=this.center;return F.lat=r.aA(F.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!a)&&(F.lng=r.aA(F.lng,this.minLng,this.maxLng)),this.center=F,void(this._constraining=!1)}const h=this._unmodified,{x:y,y:b}=this.point;let T=0,E=y,P=b;const M=this.width/2,L=this.height/2,O=this.worldMinY*this.scale,H=this.worldMaxY*this.scale;if(b-L<O&&(P=O+L),b+L>H&&(P=H-L),H-O<this.height&&(T=Math.max(T,this.height/(H-O)),P=(H+O)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const F=this.worldMinX*this.scale,Z=this.worldMaxX*this.scale,Y=this.worldSize/2-(F+Z)/2;E=(y+Y+this.worldSize)%this.worldSize-Y,E-M<F&&(E=F+M),E+M>Z&&(E=Z-M),Z-F<this.width&&(T=Math.max(T,this.width/(Z-F)),E=(Z+F
822)/2)}E===y&&P===b||this._allowWorldUnderZoom||(this.center=this.unproject(new r.P(E,P))),T&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(T)),this._constrainCamera(),this._unmodified=h,this._constraining=!1}_minZoomForBounds(){let a=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(a=Math.max(a,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),a}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const a=this.centerOffset,h=this.projection.name==="globe",y=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=r.ce(1,this.center.lat)/r.ce(1,r.d1));const b=r.cN(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,b),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 T=this.projection.zAxisUnit==="meters"?y:1,E=this._camera.getWorldToCamera(this.worldSize,T);let P;const M=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(M[8]=2*-a.x/this.width,M[9]=2*a.y/this.height,this.isOrthographic){let ve=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ke=ve*this.aspect,Ke=-ke,$e=-ve;ke-=a.x,Ke-=a.x,ve+=a.y,$e+=a.y,P=this._camera.getCameraToClipOrthographic(Ke,ke,$e,ve,this._nearZ,this._farZ),((ct,it,gt,jt)=>{for(let et=0;et<16;et++)ct[et]=r.ak(it[et],gt[et],jt)})(P,P,M,r.c$(this.pitch>=op?1:this.pitch/op))}else P=M;const L=r.cO([],M,E);let O=r.cO([],P,E);if(this.projection.isReprojectedInTileSpace){const ve=this.locationCoordinate(this.center),ke=r.bz([]);r.bq(ke,ke,[ve.x*this.worldSize,ve.y*this.worldSize,0]),r.aB(ke,ke,r.cP(this)),r.bq(ke,ke,[-ve.x*this.worldSize,-ve.y*this.worldSize,0]),r.aB(O,O,ke),r.aB(L,L,ke),this.inverseAdjustmentMatrix=r.cQ(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=r.cR([],O,[this.worldSize,this.worldSize,this.worldSize/T,1]),this.projMatrix=O,this.invProjMatrix=r.bk(new Float64Array(16),this.projMatrix),h){const ve=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ve[8]=2*-a.x/this.width,ve[9]=2*a.y/this.height,this.expandedFarZProjMatrix=r.cO([],ve,E)}else this.expandedFarZProjMatrix=this.projMatrix;const H=r.bk([],P);this.frustumCorners=r.cS.fromInvProjectionMatrix(H,this.horizonLineFromTop(),this.height),this.cameraFrustum=r.cA.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!h);const F=new Float32Array(16);r.bz(F),r.cR(F,F,[1,-1,1]),r.cT(F,F,this._pitch),r.bA(F,F,this.angle);const Z=r.cc(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=r.by(Z);const Y=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;Z[8]=2*-a.x/this.width,Z[9]=2*(a.y+Y)/this.height,this.skyboxMatrix=r.aB(F,Z,F);const J=this.point,se=J.x,ne=J.y,ae=this.width%2/2,fe=this.height%2/2,ue=Math.cos(this.angle),Ce=Math.sin(this.angle),me=se-Math.round(se)+ue*ae+Ce*fe,Ie=ne-Math.round(ne)+ue*fe+Ce*ae,Se=new Float64Array(O);if(r.bq(Se,Se,[me>.5?me-1:me,Ie>.5?Ie-1:Ie,0]),this.alignedProjMatrix=Se,O=r.bB(),r.cR(O,O,[this.width/2,-this.height/2,1]),r.bq(O,O,[1,-1,0]),this.labelPlaneMatrix=O,O=r.bB(),r.cR(O,O,[1,-1,1]),r.bq(O,O,[-1,-1,0]),r.cR(O,O,[2/this.width,2/this.height,1]),this.glCoordMatrix=O,this.pixelMatrix=r.aB(new Float64Array(16),this.labelPlaneMatrix,L),this._calcFogMatrices(),this._distanceTileDataCache={},O=r.bk(new Float64Array(16),this.pixelMatrix),!O)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=O,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=r.cU(this);const ve=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=r.af(ve,ve,E),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=O;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const a=this.cameraWorldSizeForFog,h=this.cameraPixelsPerMeter,y=this._camera.position,b=1/this.height/this._pixelsPerMercatorPixel,T=[a,a,h];r.c4(T,T,b),r.c4(y,y,-1),r.cV(y,y,T);const E=r.bB();r.bq(E,E,y),r.cR(E,E,T),this.mercatorFogMatrix=E,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(a,h,b)}_computeCameraPosition(a){const h=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,y=this._camera.forward(),b=this.point,T=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*h-a/this.worldSize*this._centerAltitude;return[b.x/this.worldSize-y[0]*T,b.y/this.worldSize-y[1]*T,a/this.worldSize*this._centerAltitude-y[2]*T]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(a){const h=this._maxCameraBoundsDistance()*Math.cos(this._pitch),y=this._camera.position[2],b=a[2];let T=1;this.projection.wrap&&(this.center=this.center.wrap()),b>0&&(T=Math.min((h-y)/b,1)),this._camera.position=r.bG([],this._camera.position,a,T),this._updateStateFromCamera()}_updateStateFromCamera(){const a=this._camera.position,h=this._camera.forward(),{pitch:y,bearing:b}=this._camera.getPitchBearing(),T=r.ce(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,E=this._mercatorZfromZoom(this._maxZoom)*Math.cos(r.an(this._maxPitch)),P=Math.max((a[2]-T)/Math.cos(y),E),M=this._zoomFromMercatorZ(P);r.bG(a,a,h,P),this._pitch=r.aA(y,r.an(this.minPitch),r.an(this.maxPitch)),this.angle=r.bS(b,-Math.PI,Math.PI),this._setZoom(r.aA(M,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new r.ae(a[0],a[1],a[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,a)*this.tileSize))}zoomFromMercatorZAdjusted(a){let h=0,y=r.cK,b=0,T=1/0;for(;y-h>1e-6&&y>h;){const E=h+.5*(y-h),P=this.tileSize*Math.pow(2,E),M=this.getCameraToCenterDistance(this.projection,E,P),L=this.scaleZoom(M/(Math.max(0,a)*this.tileSize)),O=Math.abs(E-L);O<T&&(T=O,b=E),E<L?h=E:y=E}return b}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(r.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(a,h){const y=Math.min(a.x,h.x),b=Math.max(a.x,h.x),T=Math.min(a.y,h.y),E=Math.max(a.y,h.y);if(T<this.horizonLineFromTop(!1))return!0;
822if(this.projection.name!=="mercator")return!1;const P=[new r.P(y,T),new r.P(b,E),new r.P(y,E),new r.P(b,T)],M=this.renderWorldCopies?-3:0,L=this.renderWorldCopies?4:1;for(const O of P){const H=this.pointRayIntersection(O);if(H.t<0)return!0;const F=this.rayIntersectionCoordinate(H);if(F.x<M||F.y<0||F.x>L||F.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+r.cW(this.fovAboveCenter)>88||this.anyCornerOffEdge(new r.P(0,0),new r.P(this.width,this.height))}zoomDeltaToMovement(a,h){const y=r.ag(r.av([],this._camera.position,a)),b=this._zoomFromMercatorZ(y)+h;return y-this._mercatorZfromZoom(b)}getCameraPoint(){if(this.projection.name==="globe"){const a=function([h,y,b],T){const E=[h,y,b,1];r.aC(E,E,T);const P=E[3]=Math.max(E[3],1e-6);return E[0]/=P,E[1]/=P,E[2]/=P,E}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new r.P(a[0],a[1])}{const a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new r.P(0,a))}}getCameraToCenterDistance(a,h=this.zoom,y=this.worldSize){const b=r.cN(a,h,this.width,this.height,1024),T=a.pixelSpaceConversion(this.center.lat,y,b);let E=.5/Math.tan(.5*this._fov)*this.height*T;return this.isOrthographic&&(E=r.ak(1,E,r.c$(this.pitch>=op?1:this.pitch/op))),E}getWorldToCameraMatrix(){const a=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&r.aB(a,a,this.globeMatrix),a}getFrustum(a){return r.cA.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,this.projection.zAxisUnit==="meters")}}const Xu=(g,a)=>{if(a>0&&g.terrain&&r.w("Cutoff is currently disabled on terrain"),a<=0||g.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const h=g.transform,y=Math.max(Math.abs(h._zoom-(g.minCutoffZoom-1)),1),b=h.isLODDisabled(!1)?r.ah(60,45,h.pitch):r.ah(30,15,h.pitch),T=h._farZ-h._nearZ,E=a*h.height,P=((1-(M=b))*h.cameraToCenterDistance+M*(h._farZ+E))*y;var M;return{shouldRenderCutoff:b<1,uniformValues:{u_cutoff_params:[h._nearZ,h._farZ,(P-h._nearZ)/T,(P-E-h._nearZ)/T]}}},jo={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class KM{constructor(a,h){this.aabb=a,this.lastCascade=h}}class ZM{add(a,h){const y=this.receivers[a.key];y!==void 0?(y.aabb.min[0]=Math.min(y.aabb.min[0],h.min[0]),y.aabb.min[1]=Math.min(y.aabb.min[1],h.min[1]),y.aabb.min[2]=Math.min(y.aabb.min[2],h.min[2]),y.aabb.max[0]=Math.max(y.aabb.max[0],h.max[0]),y.aabb.max[1]=Math.max(y.aabb.max[1],h.max[1]),y.aabb.max[2]=Math.max(y.aabb.max[2],h.max[2])):this.receivers[a.key]=new KM(h,null)}clear(){this.receivers={}}get(a){return this.receivers[a.key]}computeRequiredCascades(a,h,y){const b=r.d8.fromPoints(a.points);let T=0;for(const E in this.receivers){const P=this.receivers[E];if(!P||!b.intersectsAabb(P.aabb))continue;P.aabb.min=b.closestPoint(P.aabb.min),P.aabb.max=b.closestPoint(P.aabb.max);const M=P.aabb.getCorners();for(let L=0;L<y.length;L++){let O=!0;for(const H of M){const F=[H[0]*h,H[1]*h,H[2]];if(r.af(F,F,y[L].matrix),F[0]<-1||F[0]>1||F[1]<-1||F[1]>1){O=!1;break}}if(P.lastCascade=L,T=Math.max(T,L),O)break}}return T+1}}class cy{constructor(a){this.painter=a,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ZM,this._depthMode=new hi(a.context.gl.LEQUAL,hi.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,a.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),a.tp.registerParameter(jo,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),a.tp.registerParameter(jo,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),a.tp.registerParameter(jo,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),a.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const a of this._cascades)a.texture.destroy(),a.framebuffer.destroy();this._cascades=[]}updateShadowParameters(a,h){const y=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!h||!h.properties)return;const b=h.properties.get("shadow-intensity");if(!h.shadowsEnabled()||b<=0||(this._shadowLayerCount=y.style.order.reduce((Y,J)=>{const se=y.style._mergedLayers[J];return Y+(se.hasShadowPass()&&!se.isHidden(a.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const T=y.context,E=jo.shadowMapResolution,P=jo.shadowMapResolution;if(this._cascades.length===0||jo.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let Y=0;Y<jo.cascadeCount;++Y){const J=y._shadowMapDebug,se=T.gl,ne=T.createFramebuffer(E,P,J,"texture"),ae=new r.T(T,{width:E,height:P,data:null},se.DEPTH_COMPONENT16);if(ne.depthAttachment.set(ae.texture),J){const fe=new r.T(T,{width:E,height:P,data:null},se.RGBA8);ne.colorAttachment.set(fe.texture)}this._cascades.push({framebuffer:ne,texture:ae,matrix:[],far:0,boundingSphereRadius:0,frustum:new r.cA,scale:0})}}this.shadowDirection=qE(h);let M=0;if(a.elevation){const Y=a.elevation,J=[1e4,-1e4];Y.visibleDemTiles.filter(se=>se.dem).forEach(se=>{const ne=se.dem.tree;J[0]=Math.min(J[0],ne.minimums[0]),J[1]=Math.max(J[1],ne.maximums[0])}),J[0]!==1e4&&(M=(J[1]-J[0])*Y.exaggeration())}const L=1.5*a.cameraToCenterDistance,O=3*L,H=new Float64Array(16);for(let Y=0;Y<this._cascades.length;++Y){const J=this._cascades[Y];let se=a.height/50,ne=1;
822jo.cascadeCount===1?ne=O:Y===0?ne=L:(se=L,ne=O);const[ae,fe]=HE(a,this.shadowDirection,se,ne,jo.shadowMapResolution,M);J.scale=a.scale,J.matrix=ae,J.boundingSphereRadius=fe,r.bk(H,J.matrix),J.frustum=r.cA.fromInvProjectionMatrix(H,1,0,!0),J.far=ne}const F=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[F].far,this._cascades[F].far],this._uniformValues.u_shadow_intensity=b,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/jo.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=jo.shadowMapResolution,this._uniformValues.u_shadowmap_0=Ro.ShadowMap0,this._uniformValues.u_shadowmap_1=Ro.ShadowMap0+1,this._groundShadowTiles=y.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const Z=y.transform.elevation;for(const Y of this._groundShadowTiles){let J={min:0,max:0};if(Z){const se=Z.getMinMaxForTile(Y);se&&(J=se)}this.addShadowReceiver(Y.toUnwrapped(),J.min,J.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(a){this._enabled=a}drawShadowPass(a,h){if(!this.enabled)return;const y=this.painter,b=y.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(y.transform.getFrustum(0),y.transform.worldSize,this._cascades),b.viewport.set([0,0,jo.shadowMapResolution,jo.shadowMapResolution]);for(let T=0;T<this._numCascadesToRender;++T){y.currentShadowCascade=T,b.bindFramebuffer.set(this._cascades[T].framebuffer.framebuffer),b.clear({color:r.ao.white,depth:1});for(const E of a.order){const P=a._mergedLayers[E];if(!P.hasShadowPass()||P.isHidden(y.transform.zoom))continue;const M=a.getLayerSourceCache(P),L=M?h[M.id]:void 0;(P.type==="model"||L&&L.length)&&y.renderLayer(y,M,P,L)}}y.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const a=this.painter,h=a.style,y=a.context,b=y.gl,T=h.directionalLight,E=h.ambientLight;if(!T||!E)return;const P=[],M=Xu(a,a.longestCutoffRange);M.shouldRenderCutoff&&P.push("RENDER_CUTOFF"),P.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&P.push("NORMAL_OFFSET");const L=vc(h,T,E),O=new hi(b.LEQUAL,hi.ReadOnly,a.depthRangeFor3D),H=new Yi({func:b.EQUAL,mask:255},0,255,b.KEEP,b.KEEP,b.KEEP);for(const F of this._groundShadowTiles){const Z=F.toUnwrapped(),Y=a.isTileAffectedByFog(F),J=a.getOrCreateProgram("groundShadow",{defines:P,overrideFog:Y});this.setupShadows(Z,J),a.uploadCommonUniforms(y,J,Z,null,M);const se={u_matrix:a.transform.calculateProjMatrix(Z),u_ground_shadow_factor:L};J.draw(a,b.TRIANGLES,O,H,mn.multiply,$i.disabled,se,"ground_shadow",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments,null,a.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?mn.unblended:mn.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(a){const h=this.painter.transform,y=h.calculatePosMatrix(a,h.worldSize);return r.aB(y,this._cascades[this.painter.currentShadowCascade].matrix,y),Float32Array.from(y)}calculateShadowPassMatrixFromMatrix(a){const h=r.by(a);return r.aB(h,this._cascades[this.painter.currentShadowCascade].matrix,a),h}setupShadows(a,h,y){if(!this.enabled)return;const b=this.painter.transform,T=this.painter.context,E=T.gl,P=this._uniformValues,M=new Float64Array(16),L=b.calculatePosMatrix(a,b.worldSize);for(let O=0;O<this._cascades.length;O++)r.aB(M,this._cascades[O].matrix,L),P[O===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(M),T.activeTexture.set(E.TEXTURE0+Ro.ShadowMap0+O),this._cascades[O].texture.bindExtraParam(E.LINEAR,E.LINEAR,E.CLAMP_TO_EDGE,E.CLAMP_TO_EDGE,E.GREATER);if(this.useNormalOffset=!!y,this.useNormalOffset){const O=r.d6(a.canonical),H=2/b.tileSize*r.al/jo.shadowMapResolution,F=H*this._cascades[0].boundingSphereRadius,Z=H*this._cascades[this._cascades.length-1].boundingSphereRadius,Y=(y==="vector-tile"?1:3)*function(J,se,ne,ae,fe){const ue=r.aA((J-22)/-22,0,1);return .125*(1-ue)+4*ue}(b.zoom);P.u_shadow_normal_offset=[O,F*Y,Z*Y],P.u_shadow_bias=[1e-4,.0012,.012]}else P.u_shadow_bias=[36e-5,.0012,.012];h.setShadowUniformValues(T,P)}
822setupShadowsFromMatrix(a,h,y=!1){if(!this.enabled)return;const b=this.painter.context,T=b.gl,E=this._uniformValues,P=new Float64Array(16);for(let M=0;M<jo.cascadeCount;M++)r.aB(P,this._cascades[M].matrix,a),E[M===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(P),b.activeTexture.set(T.TEXTURE0+Ro.ShadowMap0+M),this._cascades[M].texture.bindExtraParam(T.LINEAR,T.LINEAR,T.CLAMP_TO_EDGE,T.CLAMP_TO_EDGE,T.GREATER);if(this.useNormalOffset=y,y){const M=jo.normalOffset;E.u_shadow_normal_offset=[1,M,M],E.u_shadow_bias=[6e-5,.0012,.012]}else E.u_shadow_bias=[36e-5,.0012,.012];h.setShadowUniformValues(b,E)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(a,h,y,b){if(b[2]>=0)return{};const T=function(M,L,O){const H=O/(1<<M.canonical.z);return new r.d8([M.canonical.x*H+M.wrap*O,M.canonical.y*H+M.wrap*O,0],[(M.canonical.x+1)*H+M.wrap*O,(M.canonical.y+1)*H+M.wrap*O,L])}(a,h,y).getCorners(),E=h/-b[2];b[0]<0?(r.d7(T[0],T[0],[b[0]*E,0,0]),r.d7(T[3],T[3],[b[0]*E,0,0])):b[0]>0&&(r.d7(T[1],T[1],[b[0]*E,0,0]),r.d7(T[2],T[2],[b[0]*E,0,0])),b[1]<0?(r.d7(T[0],T[0],[0,b[1]*E,0]),r.d7(T[1],T[1],[0,b[1]*E,0])):b[1]>0&&(r.d7(T[2],T[2],[0,b[1]*E,0]),r.d7(T[3],T[3],[0,b[1]*E,0]));const P={};return P.vertices=T,P.planes=[Xd(T[1],T[0],T[4]),Xd(T[2],T[1],T[5]),Xd(T[3],T[2],T[6]),Xd(T[0],T[3],T[7])],P}addShadowReceiver(a,h,y){this._receivers.add(a,r.d8.fromTileIdAndHeight(a,h,y))}getMaxCascadeForTile(a){const h=this._receivers.get(a);return h&&h.lastCascade?h.lastCascade:0}}function Xd(g,a,h){const y=r.av([],h,a),b=r.av([],g,a),T=r.bH([],y,b),E=r.ag(T);return E===0?[0,0,1,0]:(r.c4(T,T,1/E),[T[0],T[1],T[2],-r.bI(T,a)])}function qE(g){const a=g.properties.get("direction"),h=r.d3(a.x,a.y,a.z);h[2]=r.aA(h[2],0,75);const y=r.d5([h[0],h[1],h[2]]);return r.d4(y.x,y.y,y.z)}function vc(g,a,h){const y=a.properties.get("color-use-theme")==="none",b=a.properties.get("color"),T=a.properties.get("intensity"),E=a.properties.get("direction"),P=[E.x,E.y,E.z],M=h.properties.get("color-use-theme")==="none",L=h.properties.get("color"),O=h.properties.get("intensity"),H=Math.max(r.bI([0,0,1],P),0),F=[0,0,0];r.c4(F,L.toPremultipliedRenderColor(M?null:g.getLut(a.scope)).toArray01Linear().slice(0,3),O);const Z=[0,0,0];return r.c4(Z,b.toPremultipliedRenderColor(y?null:g.getLut(h.scope)).toArray01Linear().slice(0,3),H*T),r.da([F[0]>0?F[0]/(F[0]+Z[0]):0,F[1]>0?F[1]/(F[1]+Z[1]):0,F[2]>0?F[2]/(F[2]+Z[2]):0])}function HE(g,a,h,y,b,T){const E=g.zoom,P=g.scale,M=g.worldSize,L=1/M,O=g.aspect,H=Math.sqrt(1+O*O)*Math.tan(.5*g.fovX),F=H*H,Z=y-h,Y=y+h;let J,se;F>Z/Y?(J=y,se=y*H):(J=.5*Y*(1+F),se=.5*Math.sqrt(Z*Z+2*(y*y+h*h)*F+Y*Y*F*F));const ne=g.projection.pixelsPerMeter(g.center.lat,M),ae=g._camera.getCameraToWorldMercator(),fe=[0,0,-J*L];r.af(fe,fe,ae);let ue=se*L;const Ce=g._edgeInsets;if(!(Ce.left===0&&Ce.top===0&&Ce.right===0&&Ce.bottom===0||Ce.left===Ce.right&&Ce.top===Ce.bottom)){const wt=g._camera.getWorldToCamera(g.worldSize,g.projection.zAxisUnit==="meters"?ne:1),Bt=g._camera.getCameraToClipPerspective(g._fov,g.width/g.height,h,y);Bt[8]=2*-g.centerOffset.x/g.width,Bt[9]=2*g.centerOffset.y/g.height;const oi=new Float64Array(16);r.cO(oi,Bt,wt);const Mt=new Float64Array(16);r.bk(Mt,oi);const Lt=r.cA.fromInvProjectionMatrix(Mt,M,E,!0);for(const li of Lt.points){const ti=((me=li)[0]/=P,me[1]/=P,me[2]=r.ce(me[2],g._center.lat),me);ue=Math.max(ue,r.c5(r.d9([],fe,ti)))}}var me;ue*=b/(b-1);const Ie=Math.acos(a[2]),Se=Math.atan2(-a[0],-a[1]),ve=new wv;ve.position=fe,ve.setPitchBearing(Ie,Se);const ke=ve.getWorldToCamera(M,ne),Ke=ue*M,$e=Math.min(g._mercatorZfromZoom(17)*M*-2,-2*Ke),ct=ve.getCameraToClipOrthographic(-Ke,Ke,-Ke,Ke,$e,(Ke+T*ne)/a[2]),it=new Float64Array(16);r.aB(it,ct,ke);const gt=r.d4(Math.floor(1e6*fe[0])/1e6*M,Math.floor(1e6*fe[1])/1e6*M,0),jt=.5*b,et=[0,0,0];r.af(et,gt,it),r.c4(et,et,jt);const Oe=[Math.floor(et[0]),Math.floor(et[1]),Math.floor(et[2])],yt=[0,0,0];r.av(yt,et,Oe),r.c4(yt,yt,-1/jt);const nt=new Float64Array(16);return r.bz(nt),r.bq(nt,nt,yt),r.aB(it,nt,it),[it,Ke]}
vendor: 5,475 bytes, line 822
822class Sv extends r.E{constructor(a){super(),this.requestManager=a,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(a,h){return r.db(this.requestManager.transformRequest(h,r.R.Model).url).then(y=>{if(!y)return;const b=r.dc(y),T=new r.dd(a,h,void 0,void 0,b);return T.computeBoundsAndApplyParent(),T}).catch(y=>{if(y&&y.status===404)return null;this.fire(new r.y(new Error(`Could not load model ${a} from ${h}: ${y.message}`)))})}load(a,h,y={forceReload:!1}){this.models[h]||(this.models[h]={});const b=Object.keys(a),T=[],E=[];for(const P of b){const M=a[P];this.hasURLBeenRequested(M)&&!y.forceReload||(this.modelByURL[M]={modelId:P,scope:h},T.push(this.loadModel(P,M)),E.push(P)),this.models[h][P]||(this.models[h][P]={model:null,numReferences:1})}this.numModelsLoading[h]=(this.numModelsLoading[h]||0)+E.length,Promise.allSettled(T).then(P=>{for(let M=0;M<P.length;M++){const{status:L}=P[M];if(L==="rejected")continue;const{value:O}=P[M];this.models[h][E[M]]||(this.models[h][E[M]]={model:null,numReferences:1}),this.models[h][E[M]].model=O}this.numModelsLoading[h]-=E.length,this.fire(new r.z("data",{dataType:"style"}))}).catch(P=>{this.fire(new r.y(new Error(`Could not load models: ${P.message}`)))})}isLoaded(){for(const a in this.numModelsLoading)if(this.numModelsLoading[a]>0)return!1;return!0}hasModel(a,h,y={exactIdMatch:!1}){return!!(y.exactIdMatch?this.getModel(a,h):this.getModelByURL(this.modelUris[h][a]))}getModel(a,h){return this.models[h]||(this.models[h]={}),this.models[h][a]?this.models[h][a].model:void 0}getModelByURL(a){if(!a)return null;const h=this.modelByURL[a];return h?this.models[h.scope][h.modelId].model:null}hasModelBeenAdded(a,h){return this.models[h]&&this.models[h][a]!==void 0}getModelURIs(a){return this.modelUris[a]||{}}addModel(a,h,y){this.models[y]||(this.models[y]={}),this.modelUris[y]||(this.modelUris[y]={});const b=this.requestManager.normalizeModelURL(h);if((this.hasModel(a,y,{exactIdMatch:!0})||this.hasModelBeenAdded(a,y))&&this.modelUris[y][a]===b)this.models[y][a].numReferences++;else if(this.hasURLBeenRequested(b)){const{scope:T,modelId:E}=this.modelByURL[b];this.models[T][E].numReferences++}else this.modelUris[y][a]=b,this.load({[a]:this.modelUris[y][a]},y)}addModelURLs(a,h){this.models[h]||(this.models[h]={}),this.modelUris[h]||(this.modelUris[h]={});const y=this.modelUris[h];for(const b in a)y[b]=this.requestManager.normalizeModelURL(a[b])}reloadModels(a){this.load(this.modelUris[a],a,{forceReload:!0})}addModelsFromBucket(a,h){this.models[h]||(this.models[h]={}),this.modelUris[h]||(this.modelUris[h]={});const y={};for(const b of a)this.hasModel(b,h,{exactIdMatch:!0})||this.hasURLBeenRequested(b)?this.models[h][b].numReferences++:this.modelUris[h][b]&&!this.hasURLBeenRequested(b)?y[b]=this.modelUris[h][b]:!this.hasURLBeenRequested(b)&&r.de(b,!1)&&(this.modelUris[h][b]=this.requestManager.normalizeModelURL(b),y[b]=this.modelUris[h][b]);this.load(y,h)}hasURLBeenRequested(a){return this.modelByURL[a]!==void 0}removeModel(a,h,y=!1,b=!1){if(this.models[h]&&this.models[h][a]&&(this.models[h][a].numReferences--,this.models[h][a].numReferences===0||b)){const T=this.modelUris[h][a];y||delete this.modelUris[h][a],delete this.modelByURL[T];const E=this.models[h][a].model;if(!E)return;delete this.models[h][a],E.destroy()}}destroy(){for(const a of Object.keys(this.models))for(const h of Object.keys(this.models[a])){const y=this.models[a][h].model;delete this.models[a][h],y&&y.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(a){return this.models[a]||(this.models[a]={}),Object.keys(this.models[a])}upload(a,h){this.models[h]||(this.models[h]={});for(const y in this.models[h])this.models[h][y].model&&this.models[h][y].model.upload(a.context)}}const uy=r.a6.colorTheme,Yd=new r.a9({data:new r.aa(uy.data)});function XM(g){if(!g.metadata||!g.metadata.content_area)return;const a=r.o.devicePixelRatio,{left:h,top:y,width:b,height:T}=g.metadata.content_area,E=h*a,P=y*a;return[E,P,E+b*a,P+T*a]}function GE(g){if(g)return g.map(([a,h])=>[a*r.o.devicePixelRatio,h*r.o.devicePixelRatio])}class YM{constructor(a,h,y){this.id=a,this.scope=h,this.sourceCache=y,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(a){this.missingRequests.has(a.name)||this.pendingRequests.has(a.name)||this.pendingRequests.add(a.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const a=new Map;if(!this.sourceCache.loaded())return a;const h=this.sourceCache.getVisibleCoordinates();if(h.length===0)return a;const y=this.sourceCache.getSource();if(!(y instanceof uo))return a;const b=h.map(E=>this.sourceCache.getTile(E)),T=y.getImages(b,Array.from(this.pendingRequests));for(const[E,P]of T)a.set(r.I.from({name:E,iconsetId:this.id}),P),this.pendingRequests.delete(E);for(const E of this.pendingRequests)this.missingRequests.add(E);return this.pendingRequests.clear(),a}}const Qd=(g,a)=>ie(g,a&&a.filter(h=>h.identifier!=="source.canvas")),QM=r.aH(ir,["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"]),b1=r.aH(ir,["setCenter","setZoom","setBearing","setP
822itch"]),Tv=new Set(["background","sky","slot","custom"]),w1={version:8,layers:[],sources:{}},S1={duration:300,delay:0};class xc extends r.E{constructor(a,h={}){super(),this.map=a,this.scope=h.scope||"",this.globalId=null,this.fragments=[],this.importDepth=h.importDepth||0,this.importsCache=h.importsCache||new Map,this.resolvedImports=h.resolvedImports||new Set,this.transition=Object.assign({},S1),this._buildingIndex=new h1(this),this.crossTileSymbolIndex=new Zu,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=h.styleChanges||new Sr,this.dispatcher=h.dispatcher?h.dispatcher:new r.D(r.dg(),this),h.imageManager?this.imageManager=h.imageManager:(this.imageManager=new rs(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=h.glyphManager?h.glyphManager:new r.dh(a._requestManager,h.localFontFamily?r.di.all:h.localIdeographFontFamily?r.di.ideographs:r.di.none,h.localFontFamily||h.localIdeographFontFamily),h.modelManager?this.modelManager=h.modelManager:(this.modelManager=new Sv(a._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=h.configOptions?h.configOptions:new Map,this._configDependentLayers=h.configDependentLayers?h.configDependentLayers:new Set,this._indoorDependentLayers=h.indoorDependentLayers?h.indoorDependentLayers:new Set,this._config=h.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:h.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=h.initialConfig,this.dispatcher.broadcast("setReferrer",r.dj());const y=this;this._rtlTextPluginCallback=xc.registerForPluginStateChange(b=>{y.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(T,E)=>{if(r.dk(T),E&&E.every(P=>P))for(const P in y._sourceCaches){const M=y._sourceCaches[P],L=M.getSource().type;L!=="vector"&&L!=="geojson"||M.reload()}})}),this.on("data",b=>{if(b.dataType!=="source"||b.sourceDataType!=="metadata")return;const T=this.getOwnSource(b.sourceId);if(T&&T.vectorLayerIds)for(const E in this._layers){const P=this._layers[E];P.source===T.id&&this._validateLayer(P)}})}load(a){return a?(typeof a=="string"?this.loadURL(a):this.loadJSON(a),this):this}_getGlobalId(a){if(!a)return null;if(typeof a=="string"){if(r.h(a))return a;const h=r.dl(a);if(!h.startsWith("http"))try{return new URL(h,location.href).toString()}catch{return h}return h}return`json://${r.dm(JSON.stringify(a))}`}_diffStyle(a,h,y){this.globalId=this._getGlobalId(a);const b=(T,E)=>{try{E(null,this.setState(T,y))}catch(P){E(P,!1)}};if(typeof a=="string"){const T=this.map._requestManager.normalizeStyleURL(a),E=this.map._requestManager.transformRequest(T,r.R.Style);r.m(E,(P,M)=>{P?this.fire(new r.y(P)):M&&b(M,h)})}else typeof a=="object"&&b(a,h)}loadURL(a,h={}){this.fire(new r.z("dataloading",{dataType:"style"}));const y=typeof h.validate=="boolean"?h.validate:!r.h(a);this.globalId=this._getGlobalId(a),a=this.map._requestManager.normalizeStyleURL(a,h.accessToken),this.resolvedImports.add(a);const b=this.importsCache.get(a);if(b)return this._load(b,y);const T=this.map._requestManager.transformRequest(a,r.R.Style);this._request=r.m(T,(E,P)=>{if(this._request=null,E)this.fire(new r.y(E));else if(P)return this.importsCache.set(a,P),this._load(P,y)})}loadJSON(a,h={}){this.fire(new r.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(a),this._request=r.o.frame(()=>{this._request=null,this._load(a,h.validate!==!1)})}loadEmpty(){this.fire(new r.z("dataloading",{dataType:"style"})),this._load(w1,!1)}_loadImports(a,h,y){if(this.importDepth>=4)return r.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const b=[];for(const T of a){const E=this._createFragmentStyle(T),P=new Promise(O=>{E.once("style.import.load",O),E.once("error",O)}).then(()=>this.mergeAll());if(b.push(P),this.resolvedImports.has(T.url)){E.loadEmpty();continue}const M=T.data||this.importsCache.get(T.url);M?(E.loadJSON(M,{validate:h}),this._isInternalStyle(M)&&(E.globalId=null)):T.url?E.loadURL(T.url,{validate:h}):E.loadEmpty();const L={style:E,id:T.id,config:T.config};if(y){const O=this.fragments.findIndex(({id:H})=>H===y);this.fragments=this.fragments.slice(0,O).concat(L).concat(this.fragments.slice(O))}else this.fragments.push(L)}return Promise.allSettled(b)}getImportGlobalIds(a=this,h=new Set){for(const y of a.fragments)y.style.globalId&&h.add(y.style.globalId),this.getImportGlobalIds(y.style,h);return[...h.values()]}_createFragmentStyle(a){const h=this.scope?r.B(a.id,this.scope):a.id;let y;const b=this._initialConfig&&this._initialConfig[h];(a.config||b)&&(y=Object.assign({},a.config,b));const T=new xc(this.map,{scope:h,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:y,configOptions:this.options,colorThemeOverride:a["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indo
vendor: 7,585 bytes, line 822
822orDependentLayers});return T.setEventedParent(this.map,{style:T}),T}_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(a){return this.isRootStyle()&&(a.fragment||!!a.schema&&a.fragment!==!1)}_load(a,h){if(this._isInternalStyle(a)){const T=Object.assign({},w1,{imports:[{id:"basemap",data:a,url:""}]},a.center?{center:a.center}:{},a.bearing?{bearing:a.bearing}:{},a.pitch?{pitch:a.pitch}:{},a.zoom?{zoom:a.zoom}:{},a.light?{light:a.light}:{});return this._importedAsBasemap=!0,void this._load(T,h)}if(this.updateConfig(this._config,a.schema),h&&Qd(this,Mo(a)))return;this._loaded=!0,this.stylesheet=r.dn(a);const y=()=>{for(const M in a.sources)this.addSource(M,a.sources[M],{validate:!1,isInitialLoad:!0});if(a.iconsets)for(const M in a.iconsets)this.addIconset(M,a.iconsets[M]);a.sprite?this._loadIconset(a.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&a.glyphs&&this.glyphManager.setURL(a.glyphs);const T=yf(this.stylesheet.layers);if(this._order=T.map(M=>M.id),this.stylesheet.light&&r.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 M=this.stylesheet.lights[0];this.light=new ze(M.properties,M.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ze(this.stylesheet.light)),this._layers={};for(const M of T){const L=r.dt(M,this.scope,this._styleColorTheme.lut,this.options);L.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(L.fqid),L.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(L.fqid),this._hasAppearances=this._hasAppearances||L.getAppearances().length!==0,L.setEventedParent(this,{layer:{id:L.id}}),this._layers[L.id]=L;const O=this.getOwnLayerSourceCache(L),H=!!this.directionalLight&&this.directionalLight.shadowsEnabled();O&&L.canCastShadows()&&H&&(O.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const E=this.stylesheet.terrain;E&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(E,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 r.z("data",{dataType:"style"}));const P=this.isRootStyle();a.imports?this._loadImports(a.imports,h).then(()=>{this._reloadImports(),this.fire(new r.z(P?"style.load":"style.import.load"))}).catch(M=>{this.fire(new r.y(new Error("Failed to load imports",M))),this.fire(new r.z(P?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new r.z(P?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const b=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(b){const T=this._evaluateColorThemeData(b);this._loadColorTheme(T).then(()=>{y()}).catch(E=>{r.w(`Couldn't load color theme from the stylesheet: ${E}`),y()})}else this._styleColorTheme.lut=null,y()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances}mergeAll(){let a,h,y,b,T,E,P,M,L,O;const H={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(F=>{if(F.stylesheet){if(F.light!=null&&(a=F.light),F.stylesheet.lights)for(const Z of F.stylesheet.lights)Z.type==="ambient"&&F.ambientLight!=null&&(h=F.ambientLight),Z.type==="directional"&&F.directionalLight!=null&&(y=F.directionalLight);b=this._prioritizeTerrain(b,F.terrain,F.stylesheet.terrain),F.stylesheet.fog&&F.fog!=null&&(T=F.fog),F.stylesheet.snow&&F.snow!=null&&(E=F.snow),F.stylesheet.rain&&F.rain!=null&&(P=F.rain),F.stylesheet.camera!=null&&(O=F.stylesheet.camera),F.stylesheet.projection!=null&&(M=F.stylesheet.projection),F.stylesheet.transition!=null&&(L=F.stylesheet.transition),H[F.scope]=F._styleColorTheme}}),this.light=a,this.ambientLight=h,this.directionalLight=y,this.fog=T,this.snow=E,this.rain=P,this._styleColorThemeForScope=H,b===null?delete this.terrain:this.terrain=b,this.camera=O||{"camera-projection":"perspective"},this.projection=M||{name:"mercator"},this.transition=Object.assign({},S1,L),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(a){const h=y=>{for(const b of y.fragments)h(b.style);a(y)};h(this)}_prioritizeTerrain(a,h,y){const b=a&&a.drapeRenderMode===0;return y===null?h&&h.drapeRenderMode===0?h:b?a:null:h!=null&&(!a||b||h&&h.drapeRenderMode===1)?h:a}mergeTerrain(){let a;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(h=>{a=this._prioritizeTerrain(a,h.terrain,h.stylesheet.terrain)}),a===null?delete this.terrain:this.terrain=a}mergeProjection(){let a;this.forEachFragmentStyle(h=>{h.stylesheet.projection!=null&&(a=h.stylesheet.projection)}),this.projection=a||{name:"mercator"}}mergeSources(){const a={},h={},y={};this.forEachFragmentStyle(b=>{for(const T in b._sourceCaches){const E=r.B(T,b.scope);a[E]=b._sourceCaches[T]}for(const T in b._otherSourceCaches){const E=r.B(T,b.scope);h[E]=b._otherSourceCaches[T]}for(const T in b._symbolSourceCaches){const E=r.B(T,b.scope);y[E]=b._symbolSourceCaches[T]}}),this._mergedSourceCaches=a,this._mergedOtherSourceCaches=h,this._mergedSymbolSourceCaches=y}mergeIndoor(){this.forEachFragmentStyle(a=>{if(a.stylesheet&&a.stylesheet.indoor)for(const h of Object.values(a.stylesheet.indoor)){const y=h,b=r.B(y.sourceId,a.scope);this._mergedIndoor[b]=new Set(y.sourceLayers||[])}})}mergeLayers(){const a={},h=[],y={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(E=>{for(const P of E._order){const M=E._layers[P];if(M.type==="slot"){const L=r.dp(P);if(a[L])continue;a[L]=[]}M.slot&&a[M.slot]?a[M.slot].push(M):h.push(M)}}),this._mergedOrder=[];let b=-1;const T=(E=[])=>{for(const P of E)if(P.type==="slot"){const M=r.dp(P.id);a[M]&&T(a[M]),this._mergedSlots.push(M)}else{const M=r.B(P.id,P.scope);this._mergedOrder.push(M),y[M]=P,P.is3D(!!this.terrain)&&(this._has3DLayers=!0,b=this._mergedOrder.length-1),P.type==="circle"&&(this._hasCircleLayers=!0),P.type==="symbol"&&(this._hasSymbolLayers=!0),P.type==="clip"&&(this._clipLayerPresent=!0)}};if(T(h),this._has3DLayers){const E={};for(let P=0;P<this._mergedOrder.length;++P){const M=this._mergedOrder[P];E[M]=P===b?1:P<b?y[M].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((P,M)=>E[P]-E[M])}this._mergedLayers=y,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(a){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,a),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(a){return a.data?function(h,y,b,T){const E=Object.assign({},y);
822for(const M of Object.keys(uy))E[M]===void 0&&(E[M]=uy[M].default);const P=new r.a8(Yd,h,new Map(b));return P.setTransitionOrValue(E,b),P.untransitioned().possiblyEvaluate(new r.ac(0,{worldview:void 0}))}(this.scope,a,this.options).get("data"):null}_loadColorTheme(a){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const h=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((y,b)=>{const T="data:image/png;base64,";if(!a||a.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void y();let E=a;E.startsWith(T)||(E=T+E);const P=r.I.from("mapbox-reserved-lut"),M=new Image;M.src=E,M.onerror=()=>{this._styleColorTheme.lutLoading=!1,b(new Error("Failed to load image data"))},M.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==h)return void y();this._styleColorTheme.lutLoading=!1;const{width:L,height:O,data:H}=r.o.getImageData(M);if(O>32)return void b(new Error("The height of the image must be less than or equal to 32 pixels."));if(L!==O*O)return void b(new Error("The width of the image must be equal to the height squared."));this.getImage(P)&&this.removeImage(P),this.addImage(P,{data:new r.q({width:L,height:O},H),pixelRatio:1,sdf:!1,usvg:!1,version:0});const F=this.imageManager.getImage(P,this.scope);F?(this._styleColorTheme.lut={image:F.data,data:a},y()):b(new Error("Missing LUT image."))}})}getLut(a){const h=this._styleColorThemeForScope[a];return h?h.lut:null}setProjection(a){a?this.stylesheet.projection=a: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(a){this._spriteRequest=function(h,y,b){let T,E,P;const M=r.o.devicePixelRatio>1?"@2x":"";let L=r.m(y.transformRequest(y.normalizeSpriteURL(h,M,".json"),r.R.SpriteJSON),(F,Z)=>{L=null,P||(P=F,T=Z,H())}),O=r.n(y.transformRequest(y.normalizeSpriteURL(h,M,".png"),r.R.SpriteImage),(F,Z)=>{O=null,P||(P=F,E=Z,H())});function H(){if(P)b(P);else if(T&&E){const F=r.o.getImageData(E),Z={};for(const Y in T){const{width:J,height:se,x:ne,y:ae,sdf:fe,pixelRatio:ue,stretchX:Ce,stretchY:me,content:Ie}=T[Y],Se=new r.q({width:J,height:se});r.q.copy(F,Se,{x:ne,y:ae},{x:0,y:0},{width:J,height:se},null),Z[Y]={data:Se,pixelRatio:ue!==void 0?ue:1,sdf:fe!==void 0&&fe,stretchX:Ce,stretchY:me,content:Ie,usvg:!1,version:0}}b(null,Z)}}return{cancel(){L&&(L.cancel(),L=null),O&&(O.cancel(),O=null)}}}(a,this.map._requestManager,(h,y)=>{if(this._spriteRequest=null,h)this.fire(new r.y(h));else if(y){const b=new Map;for(const T in y)b.set(r.I.from(T),y[T]);this.addImages(b)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new r.z("data",{dataType:"style"}))})}addIconset(a,h){if(h.type==="sprite")return void this._loadSprite(h.url);const y=this.getOwnSourceCache(h.source);if(!y)return void this.fire(new r.y(new Error(`Source "${h.source}" as specified by iconset "${a}" does not exist and cannot be used as an iconset source`)));const b=y.getSource();if(b.type!=="raster-array")return void this.fire(new r.y(new Error(`Source "${h.source}" as specified by iconset "${a}" is not a "raster-array" source and cannot be used as an iconset source`)));b.partial=!1;const T=new YM(a,this.scope,y);this.imageManager.addImageProvider(T,this.scope)}removeIconset(a){this.imageManager.removeImageProvider(a,this.scope)}_loadIconset(a){if(!r.h(a)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(a);const h=this.map._spriteFormat==="auto";var y,b;this._spriteRequest=(b=(T,E)=>{if(this._spriteRequest=null,T)h?this._loadSprite(a):this.fire(new r.y(T));else if(E){const P=new Map;for(const M in E)P.set(r.I.from(M),E[M]);this.addImages(P)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new r.z("data",{dataType:"style"}))},r.bt((y=this.map._requestManager).transformRequest(y.normalizeIconsetURL(a),r.R.Iconset),(T,E)=>{if(T)return void b(T);const P={},M=r.df(new r.bs(E));for(const L of M.icons){const O={version:1,pixelRatio:r.o.devicePixelRatio,content:XM(L),stretchX:L.metadata?GE(L.metadata.stretch_x_areas):void 0,stretchY:L.metadata?GE(L.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:L};P[L.name]=O}b(null,P)}))}_validateLayer(a){const h=this.getOwnSource(a.source);if(!h)return;const y=a.sourceLayer;y&&(h.type==="geojson"||h.vectorLayerIds&&h.vectorLayerIds.indexOf(y)===-1)&&this.fire(new r.y(new Error(`Source layer "${y}" does not exist on source "${h.id}" as specified by style layer "${a.id}"`)))}
822loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:a}of this.fragments)if(!a.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((a,h)=>{const y=this.fragments[h];return y&&y.style&&(a.data=y.style.serialize()),a})}_serializeSources(){const a={};for(const h in this._sourceCaches){const y=this._sourceCaches[h].getSource();a[y.id]||(a[y.id]=y.serialize())}return a}_serializeLayers(a){const h=[];for(const y of a){const b=this._layers[y];b&&b.type!=="custom"&&h.push(b.serialize())}return h}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 a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const a in this._layers)if(this._layers[a].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(a){return a?this.order:this._mergedOrder}isLayerDraped(a){return!!this.terrain&&a.isDraped(this.getLayerSourceCache(a))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(a){const h=this.getOwnLayer(a);if(h)return h;this.fire(new r.y(new Error(`The layer '${a}' does not exist in the map's style.`)))}_checkSource(a){const h=this.getOwnSource(a);if(h)return h;this.fire(new r.y(new Error(`The source '${a}' does not exist in the map's style.`)))}precompilePrograms(a,h){const y=this.map.painter;if(y)for(let b=a.minzoom||0;b<(a.maxzoom||25.5);b++){const T=a.getProgramIds();if(T)for(const E of T){const P=a.getDefaultProgramParams(E,h.zoom,this._styleColorTheme.lut);P&&(y.style=this,this.fog&&(y._fogVisible=!0,P.overrideFog=!0,y.getOrCreateProgram(E,P)),y._fogVisible=!1,P.overrideFog=!1,y.getOrCreateProgram(E,P),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(P.overrideRtt=!0,y.getOrCreateProgram(E,P)))}}}update(a){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(a),this.directionalLight&&this.directionalLight.recalculate(a);const h=this.calculateLightsBrightness();a.brightness=h||0,h!==this._brightness&&(this._brightness=h,this.dispatcher.broadcast("setBrightness",h)),a.worldview!==this._worldview&&(this._worldview=a.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const y=this._changes.isDirty();let b=!1;if(this._changes.isDirty()){const P=this._changes.getLayerUpdatesByScope();for(const M in P){const{updatedIds:L,removedIds:O}=P[M];(L||O)&&(this._updateWorkerLayers(M,L,O),b=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(a),this.light&&this.light.updateTransitions(a),this.ambientLight&&this.ambientLight.updateTransitions(a),this.directionalLight&&this.directionalLight.updateTransitions(a),this.fog&&this.fog.updateTransitions(a),this.snow&&this.snow.updateTransitions(a),this.rain&&this.rain.updateTransitions(a),this._changes.reset()}const T={};for(const P in this._mergedSourceCaches){const M=this._mergedSourceCaches[P];T[P]=M.used,M.used=!1,M.tileCoverLift=0}for(const P of this._mergedOrder){const M=this._mergedLayers[P];if(M.recalculate(a,this._availableImages),!M.isHidden(a.zoom)){const L=this.getLayerSourceCache(M);L&&(L.used=!0,L.tileCoverLift=Math.max(L.tileCoverLift,M.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
822{this.precompilePrograms(M,a)}):this.precompilePrograms(M,a))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&b&&this.mergeLayers();const E=this.imageManager.getPendingImageProviders();for(const P of E)P.sourceCache.used=!0;for(const P in T){const M=this._mergedSourceCaches[P];T[P]!==M.used&&M.getSource().fire(new r.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:M.getSource().id}))}this.light&&this.light.recalculate(a),this.terrain&&this.terrain.recalculate(a),this.fog&&this.fog.recalculate(a),this.snow&&this.snow.recalculate(a),this.rain&&this.rain.recalculate(a),this.z=a.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),y&&this.fire(new r.z("data",{dataType:"style"}))}updateImageProviders(){const a=this.imageManager.getPendingImageProviders();for(const h of a){const y=h.resolvePendingRequests(),b=this.getFragmentStyle(h.scope);b&&b.addImages(y)}}_updateTilesForChangedImages(){const a={};for(const h in this._mergedSourceCaches){const y=this._mergedSourceCaches[h].getSource().scope;a[y]=a[y]||this._changes.getUpdatedImages(y),a[y].length!==0&&this._mergedSourceCaches[h].reloadTilesForDependencies(["icons","patterns"],a[y])}for(const h in a)this._changes.resetUpdatedImages(h)}_updateWorkerLayers(a,h,y){const b=this.getFragmentStyle(a);b&&this.dispatcher.broadcast("updateLayers",{layers:h?b._serializeLayers(h):[],scope:a,removedIds:y||[],options:b.options})}setState(a,h){if(this._checkLoaded(),Qd(this,Mo(a)))return!1;(a=r.dn(a)).layers=yf(a.layers);const y=function(E,P){if(!E)return[{command:ir.setStyle,args:[P]}];let M=[];try{if(!r.bx(E.version,P.version))return[{command:ir.setStyle,args:[P]}];if(r.bx(E.center,P.center)||M.push({command:ir.setCenter,args:[P.center]}),r.bx(E.zoom,P.zoom)||M.push({command:ir.setZoom,args:[P.zoom]}),r.bx(E.bearing,P.bearing)||M.push({command:ir.setBearing,args:[P.bearing]}),r.bx(E.pitch,P.pitch)||M.push({command:ir.setPitch,args:[P.pitch]}),r.bx(E.sprite,P.sprite)||M.push({command:ir.setSprite,args:[P.sprite]}),r.bx(E.glyphs,P.glyphs)||M.push({command:ir.setGlyphs,args:[P.glyphs]}),r.bx(E.imports,P.imports)||function(Z=[],Y=[],J){Y=Y||[];const se=(Z=Z||[]).map(Yg),ne=Y.map(Yg),ae=Z.reduce(Qg,{}),fe=Y.reduce(Qg,{}),ue=se.slice();let Ce,me,Ie,Se;for(Ce=0,me=0;Ce<se.length;Ce++)Ie=se[Ce],fe.hasOwnProperty(Ie)?me++:(J.push({command:ir.removeImport,args:[Ie]}),ue.splice(ue.indexOf(Ie,me),1));for(Ce=0,me=0;Ce<ne.length;Ce++)Ie=ne[ne.length-1-Ce],ue[ue.length-1-Ce]!==Ie&&(ae.hasOwnProperty(Ie)?(J.push({command:ir.removeImport,args:[Ie]}),ue.splice(ue.lastIndexOf(Ie,ue.length-me),1)):me++,Se=ue[ue.length-Ce],J.push({command:ir.addImport,args:[fe[Ie],Se]}),ue.splice(ue.length-Ce,0,Ie));for(const ve of Y){const ke=ae[ve.id];ke&&(delete ke.data,r.bx(ke,ve)||J.push({command:ir.updateImport,args:[ve.id,ve]}))}}(E.imports,P.imports,M),r.bx(E.transition,P.transition)||M.push({command:ir.setTransition,args:[P.transition]}),r.bx(E.light,P.light)||M.push({command:ir.setLight,args:[P.light]}),r.bx(E.fog,P.fog)||M.push({command:ir.setFog,args:[P.fog]}),r.bx(E.snow,P.snow)||M.push({command:ir.setSnow,args:[P.snow]}),r.bx(E.rain,P.rain)||M.push({command:ir.setRain,args:[P.rain]}),r.bx(E.projection,P.projection)||M.push({command:ir.setProjection,args:[P.projection]}),r.bx(E.lights,P.lights)||M.push({command:ir.setLights,args:[P.lights]}),r.bx(E.camera,P.camera)||M.push({command:ir.setCamera,args:[P.camera]}),r.bx(E.iconsets,P.iconsets)||function(Z,Y,J){let se;for(se in Y=Y||{},Z=Z||{})Z.hasOwnProperty(se)&&(Y.hasOwnProperty(se)||J.push({command:ir.removeIconset,args:[se]}));for(se in Y){if(!Y.hasOwnProperty(se))continue;const ne=Y[se];Z.hasOwnProperty(se)?r.bx(Z[se],ne)||(J.push({command:ir.removeIconset,args:[se]}),J.push({command:ir.addIconset,args:[se,ne]})):J.push({command:ir.addIconset,args:[se,ne]})}}(E.iconsets,P.iconsets,M),!r.bx(E["color-theme"],P["color-theme"]))return[{command:ir.setStyle,args:[P]}];const L={},O=[];(function(Z,Y,J,se){let ne;for(ne in Y=Y||{},Z=Z||{})Z.hasOwnProperty(ne)&&(Y.hasOwnProperty(ne)||Kg(ne,J,se));for(ne in Y){if(!Y.hasOwnProperty(ne))continue;const ae=Y[ne];Z.hasOwnProperty(ne)?r.bx(Z[ne],ae)||(Z[ne].type==="geojson"&&ae.type==="geojson"&&f1(Z,Y,ne)?J.push({command:ir.setGeoJSONSourceData,args:[ne,ae.data]}):Zg(ne,Y,J,se)):p1(ne,Y,J)}})(E.sources,P.sources,O,L);const H=[];
822E.layers&&E.layers.forEach(Z=>{Z.source&&L[Z.source]?M.push({command:ir.removeLayer,args:[Z.id]}):H.push(Z)});let F=E.terrain;F&&L[F.source]&&(M.push({command:ir.setTerrain,args:[void 0]}),F=void 0),M=M.concat(O),r.bx(F,P.terrain)||M.push({command:ir.setTerrain,args:[P.terrain]}),function(Z,Y,J){Y=Y||[];const se=(Z=Z||[]).map(Yg),ne=Y.map(Yg),ae=Z.reduce(Qg,{}),fe=Y.reduce(Qg,{}),ue=se.slice(),Ce=Object.create(null);let me,Ie,Se,ve,ke,Ke,$e;for(me=0,Ie=0;me<se.length;me++)Se=se[me],fe.hasOwnProperty(Se)?Ie++:(J.push({command:ir.removeLayer,args:[Se]}),ue.splice(ue.indexOf(Se,Ie),1));for(me=0,Ie=0;me<ne.length;me++)Se=ne[ne.length-1-me],ue[ue.length-1-me]!==Se&&(ae.hasOwnProperty(Se)?(J.push({command:ir.removeLayer,args:[Se]}),ue.splice(ue.lastIndexOf(Se,ue.length-Ie),1)):Ie++,Ke=ue[ue.length-me],J.push({command:ir.addLayer,args:[fe[Se],Ke]}),ue.splice(ue.length-me,0,Se),Ce[Se]=!0);for(me=0;me<ne.length;me++)if(Se=ne[me],ve=ae[Se],ke=fe[Se],!Ce[Se]&&!r.bx(ve,ke))if(r.bx(ve.source,ke.source)&&r.bx(ve["source-layer"],ke["source-layer"])&&r.bx(ve.type,ke.type)){for($e in Xg(ve.layout,ke.layout,J,Se,null,ir.setLayoutProperty),Xg(ve.paint,ke.paint,J,Se,null,ir.setPaintProperty),r.bx(ve.slot,ke.slot)||J.push({command:ir.setSlot,args:[Se,ke.slot]}),r.bx(ve.filter,ke.filter)||J.push({command:ir.setFilter,args:[Se,ke.filter]}),r.bx(ve.minzoom,ke.minzoom)&&r.bx(ve.maxzoom,ke.maxzoom)||J.push({command:ir.setLayerZoomRange,args:[Se,ke.minzoom,ke.maxzoom]}),ve)ve.hasOwnProperty($e)&&$e!=="layout"&&$e!=="paint"&&$e!=="filter"&&$e!=="metadata"&&$e!=="minzoom"&&$e!=="maxzoom"&&$e!=="slot"&&($e.indexOf("paint.")===0?Xg(ve[$e],ke[$e],J,Se,$e.slice(6),ir.setPaintProperty):r.bx(ve[$e],ke[$e])||J.push({command:ir.setLayerProperty,args:[Se,$e,ke[$e]]}));for($e in ke)ke.hasOwnProperty($e)&&!ve.hasOwnProperty($e)&&$e!=="layout"&&$e!=="paint"&&$e!=="filter"&&$e!=="metadata"&&$e!=="minzoom"&&$e!=="maxzoom"&&$e!=="slot"&&($e.indexOf("paint.")===0?Xg(ve[$e],ke[$e],J,Se,$e.slice(6),ir.setPaintProperty):r.bx(ve[$e],ke[$e])||J.push({command:ir.setLayerProperty,args:[Se,$e,ke[$e]]}))}else J.push({command:ir.removeLayer,args:[Se]}),Ke=ue[ue.lastIndexOf(Se)+1],J.push({command:ir.addLayer,args:[ke,Ke]})}(H,P.layers,M)}catch(L){console.warn("Unable to compute style diff:",L),M=[{command:ir.setStyle,args:[P]}]}return M}(this.serialize(),a).filter(E=>!(E.command in b1));if(y.length===0)return!1;const b=y.filter(E=>!(E.command in QM));if(b.length>0)throw new Error(`Unimplemented: ${b.map(E=>E.command).join(", ")}.`);const T=[];return y.forEach(E=>{T.push(this[E.command](...E.args))}),h&&Promise.all(T).then(h).catch(h),this.stylesheet=a,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(a){if(a.size===0)return this;for(const[h,y]of a.entries()){if(this.getImage(h))return this.fire(new r.y(new Error(`An image with the name "${h.name}" already exists.`)));this.imageManager.addImage(h,this.scope,y),this._changes.updateImage(h,this.scope)}return this._updateWorkerImages(),this.fire(new r.z("data",{dataType:"style"})),this}addImage(a,h){return this.getImage(a)?this.fire(new r.y(new Error(`An image with the name "${a.name}" already exists.`))):(this.imageManager.addImage(a,this.scope,h),this._changes.updateImage(a,this.scope),this._updateWorkerImages(),this.fire(new r.z("data",{dataType:"style"})),this)}updateImage(a,h,y=!1){this.imageManager.updateImage(a,this.scope,h),y&&(this._changes.updateImage(a,this.scope),this._updateWorkerImages(),this.fire(new r.z("data",{dataType:"style"})))}getImage(a){return this.imageManager.getImage(a,this.scope)}removeImage(a){return this.getImage(a)?(this.imageManager.removeImage(a,this.scope),this._changes.updateImage(a,this.scope),this._updateWorkerImages(),this.fire(new r.z("data",{dataType:"style"})),this):this.fire(new r.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(a){return this.modelManager.addModelURLs(a,this.scope),this._updateWorkerModels(),this.fire(new r.z("data",{dataType:"style"})),this}addModel(a,h,y={}
vendor: 9,399 bytes, line 822
822){return this._checkLoaded(),this._validate(Kd,`models.${a}`,h,null,y)||(this.modelManager.addModel(a,h,this.scope),this.fire(new r.z("data",{dataType:"style"}))),this}hasModel(a){return this.modelManager.hasModel(a,this.scope)}removeModel(a){return this.hasModel(a)?(this.modelManager.removeModel(a,this.scope,!1,!0),this.fire(new r.z("data",{dataType:"style"})),this):this.fire(new r.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(a,h,y={}){if(this._checkLoaded(),this.getOwnSource(a)!==void 0)throw new Error(`There is already a source with ID "${a}".`);if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(hu,`sources.${a}`,h,null,y))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const b=ka(a,h,this.dispatcher,this);b.scope=this.scope,b.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(b.id),source:b.serialize(),sourceId:b.id}));const T=E=>{const P=(E?"symbol:":"other:")+b.id,M=r.B(P,this.scope),L=this._sourceCaches[P]=new gc(M,b,E);(E?this._symbolSourceCaches:this._otherSourceCaches)[b.id]=L,L.onAdd(this.map)};T(!1),h.type!=="vector"&&h.type!=="geojson"||T(!0),b.onAdd&&b.onAdd(this.map),y.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(a){this._checkLoaded();const h=this.getOwnSource(a);if(!h)throw new Error("There is no source with this ID");for(const b in this._layers)if(this._layers[b].source===a)return this.fire(new r.y(new Error(`Source "${a}" cannot be removed while layer "${b}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===a)return this.fire(new r.y(new Error(`Source "${a}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const b=Object.entries(this.stylesheet.iconsets).find(([T,E])=>E.type==="source"&&E.source===a);if(b)return this.fire(new r.y(new Error(`Source "${a}" cannot be removed while iconset "${b[0]}" is using it.`)))}const y=this.getOwnSourceCaches(a);for(const b of y){const T=r.dp(b.id);delete this._sourceCaches[T],this._changes.discardSourceCacheUpdate(b.id),b.fire(new r.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:b.getSource().id})),b.setEventedParent(null),b.clearTiles()}return delete this._otherSourceCaches[a],delete this._symbolSourceCaches[a],this.mergeSources(),h.setEventedParent(null),h.onRemove&&h.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(a,h){this._checkLoaded(),this.getOwnSource(a).setData(h),this._changes.setDirty()}getOwnSource(a){const h=this.getOwnSourceCache(a);return h&&h.getSource()}getOwnSources(){const a=[];for(const h in this._otherSourceCaches){const y=this.getOwnSourceCache(h);y&&a.push(y.getSource())}return a}areTilesLoaded(){const a=this._mergedSourceCaches;for(const h in a){const y=a[h]._tiles;for(const b in y){const T=y[b];if(T.state!=="loaded"&&T.state!=="errored")return!1}}return!0}setLights(a){if(this._checkLoaded(),!a)return delete this.ambientLight,void delete this.directionalLight;const h=this._getTransitionParameters();for(const T of a){if(this._validate(pu,"lights",T))return;switch(T.type){case"ambient":if(this.ambientLight){const E=this.ambientLight;E.set(T),E.updateTransitions(h)}else this.ambientLight=new ps(T,Hn||(Hn=new r.a9({color:new r.aa(r.a6.properties_light_ambient.color),"color-use-theme":new r.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new r.aa(r.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const E=this.directionalLight;E.set(T),E.updateTransitions(h)}else this.directionalLight=new ps(T,Zr||(Zr=new r.a9({direction:new r.ap(r.a6.properties_light_directional.direction),color:new r.aa(r.a6.properties_light_directional.color),"color-use-theme":new r.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new r.aa(r.a6.properties_light_directional.intensity),"cast-shadows":new r.aa(r.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new r.aa(r.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new r.aa(r.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const y=Object.assign(h,{worldview:this.map.getWorldview()}),b=new r.ac(this.z||0,y);this.ambientLight&&this.ambientLight.recalculate(b),this.directionalLight&&this.directionalLight.recalculate(b),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const a=this.directionalLight,h=this.ambientLight;if(!a||!h)return;const y=F=>.2126*(F[0]<=.03928?F[0]/12.92:Math.pow((F[0]+.055)/1.055,2.4))+.7152*(F[1]<=.03928?F[1]/12.92:Math.pow((F[1]+.055)/1.055,2.4))+.0722*(F[2]<=.03928?F[2]/12.92:Math.pow((F[2]+.055)/1.055,2.4)),b=a.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),T=a.properties.get("intensity"),E=a.properties.get("direction"),P=1-r.d3(E.x,E.y,E.z)[2]/90,M=y(b)*T*P,L=h.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=h.properties.get("intensity"),H=y(L)*O;return Number(((M+H)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const a=[];return this.directionalLight&&a.push(this.directionalLight.get()),this.ambientLight&&a.push(this.ambientLight.get()),a}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(a){if(a==null||a===""&&this.isRootStyle())return this;if(r.dq(a)){const h=r.dr(a),y=this.fragments.find(({id:T})=>T===h);if(!y)return;const b=r.dp(a);return y.style.getFragmentStyle(b)}{const h=this.fragments.find(({id:y})=>y===a);return h?h.style:void 0}}setFeaturesetSelectors(a){if(!a)return;const h={},y=(b,T="")=>`${b}::${T}`;this._featuresetSelectors={};for(const b in a){const T=this._featuresetSelectors[b]=[];for(const E of a[b].selectors){if(E.featureNamespace){const M=this.getOwnLayer(E.layer);if(!M){r.w(`Layer is undefined for selector: ${E.layer}`);continue}const L=y(M.source,M.sourceLayer);if(L in h&&h[L]!==E.featureNamespace){r.w(`"featureNamespace ${E.featureNamespace} of featureset ${b}'s selector is not associated to the same source, skip this selector`);continue}h[L]=E.featureNamespace}let P;if(E.properties)for(const M in E.properties){const L=r.U(E.properties[M]);L.result==="success"&&(P=P||{},P[M]=L.value)}T.push({layerId:E.layer,namespace:E.featureNamespace,properties:P,uniqueFeatureID:E._uniqueFeatureID})}}}getFeaturesetDescriptors(a){const h=this.getFragmentStyle(a);if(!h||!h.stylesheet.featuresets)return[];const y=[];for(const b in h.stylesheet.featuresets)y.push({featuresetId:b,importId:h.scope?h.scope:void 0});return y}getFeaturesetLayers(a,h){const y=this.getFragmentStyle(h),b=y.stylesheet.featuresets;if(!b||!b[a])return this.fire(new r.y(new Error(`The featureset '${a}' does not exist in the map's style and cannot be queried.`))),[];const T=[];for(const E of b[a].selectors){const P=y.getOwnLayer(E.layer);P&&T.push(P)}return T}getConfigProperty(a,h){const y=this.getFragmentStyle(a);if(!y)return null;const b=r.B(h,y.scope),T=y.options.get(b),E=T?T.value||T.default:null;return E?E.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(a,h){const y=r.B(a,h);return this._mergedIndoor[y]}setIndoorData(a,h){this.map.indoor.setIndoorData(h)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(a,h,y){const b=this.getFragmentStyle(a);if(!b)return;const T=b.stylesheet.schema;if(!T||!T[h])return;const E=r.U(y);if(E.result!=="success")return void Qd(this,E.value);const P=E.value.expression,M=r.B(h,b.scope),L=b.options.get(M);if(!L)return;let O;const{minValue:H,maxValue:F,stepValue:Z,type:Y,values:J}=T[h],se=r.U(T[h].default);se.result==="success"&&(O=se.value.expression),O?(this.options.set(M,Object.assign({},L,{value:P,default:O,minValue:H,maxValue:F,stepValue:Z,type:Y,values:J})),this.updateConfigDependencies(h)):this.fire(new r.y(new Error(`No schema defined for the config option "${h}" in the "${a}" fragment.`)))}getConfig(a){const h=this.getFragmentStyle(a);if(!h)return null;const y=h.stylesheet.schema;if(!y)return null;const b={};for(const T in y){const E=r.B(T,h.scope),P=h.options.get(E),M=P?P.value||P.default:null;b[T]=M?M.serialize():null}return b}setConfig(a,h){const y=this.getFragmentStyle(a);y&&(y.updateConfig(h,y.stylesheet.schema),this.updateConfigDependencies())}getSchema(a){const h=this.getFragmentStyle(a);return h?h.stylesheet.schema:null}setSchema(a,h){const y=this.getFragmentStyle(a);y&&(y.stylesheet.schema=h,y.updateConfig(y._config,h),this.updateConfigDependencies())}updateConfig(a,h){if(this._config=a,a||h)if(h)for(const y in h){let b,T;const E=r.U(h[y].default);if(E.result==="success"&&(b=E.value.expression),a&&a[y]!==void 0){const F=r.U(a[y]);F.result==="success"&&(T=F.value.expression)}const{minValue:P,maxValue:M,stepValue:L,type:O,values:H}=h[y];if(b){const F=r.B(y,this.scope);this.options.set(F,{default:b,value:T,minValue:P,maxValue:M,stepValue:L,type:O,values:H})}
822else this.fire(new r.y(new Error(`No schema defined for config option "${y}".`)))}else this.fire(new r.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(a,h=()=>!0){for(const y of a){const b=this.getLayer(y);b&&h(b)&&(b.possiblyEvaluateVisibility(),this._updateLayer(b),this._changes.setDirty())}}updateConfigDependencies(a){this._updateLayers(this._configDependentLayers,h=>!a||h.expressionDependencies.configDependencies.has(a)),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(h=>{const y=h._styleColorTheme.colorThemeOverride?h._styleColorTheme.colorThemeOverride:h._styleColorTheme.colorTheme;if(y){const b=h._evaluateColorThemeData(y);(!h._styleColorTheme.lut&&b!==""||h._styleColorTheme.lut&&b!==h._styleColorTheme.lut.data)&&h.setColorTheme(y)}}),this._changes.setDirty()}addLayer(a,h,y={}){this._checkLoaded();const b=a.id;if(this._layers[b])return void this.fire(new r.y(new Error(`Layer with i
822d "${b}" already exists on this map`)));let T;if(a.type==="custom"){if(Qd(this,r.ds(a)))return;T=r.dt(a,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof a.source=="object"&&(this.addSource(b,a.source),a=r.dn(a),a=Object.assign(a,{source:b})),this._validate(Wd,`layers.${b}`,a,{arrayIndex:-1},y))return;T=r.dt(a,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(T),T.setEventedParent(this,{layer:{id:b}})}const E=r.B(T.source,T.scope);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(E),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(E);let P=this._order.length;if(h){const H=this._order.indexOf(h);if(H===-1)return void this.fire(new r.y(new Error(`Layer with id "${h}" does not exist on this map.`)));T.slot===this._layers[h].slot?P=H:r.w(`Layer with id "${h}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(P,0,b),this._layerOrderChanged=!0,this._layers[b]=T;const M=this.getOwnLayerSourceCache(T),L=!!this.directionalLight&&this.directionalLight.shadowsEnabled();M&&T.canCastShadows()&&L&&(M.castsShadows=!0);const O=this._changes.getRemovedLayer(T);if(O&&T.source&&M&&T.type!=="custom"){this._changes.discardLayerRemoval(T);const H=r.B(T.source,T.scope);O.type!==T.type?this._changes.updateSourceCache(H,"clear"):(this._changes.updateSourceCache(H,"reload"),M.pause())}this._updateLayer(T),T.onAdd&&T.onAdd(this.map),T.scope=this.scope,this.mergeLayers()}moveLayer(a,h){this._checkLoaded();const y=this._checkLayer(a);if(!y||a===h)return;const b=this._order.indexOf(a);this._order.splice(b,1);let T=this._order.length;if(h){const E=this._order.indexOf(h);
822if(E===-1)return void this.fire(new r.y(new Error(`Layer with id "${h}" does not exist on this map.`)));y.slot===this._layers[h].slot?T=E:r.w(`Layer with id "${h}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(T,0,a),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(a){this._checkLoaded();const h=this._checkLayer(a);if(!h)return;h.setEventedParent(null);const y=this._order.indexOf(a);this._order.splice(y,1),delete this._layers[a],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(h.fqid),this._indoorDependentLayers.delete(h.fqid),this._changes.removeLayer(h);const b=this.getOwnLayerSourceCache(h);if(b&&b.castsShadows){let T=!1;for(const E in this._layers)if(this._layers[E].source===h.source&&this._layers[E].canCastShadows()){T=!0;break}b.castsShadows=T}h.onRemove&&h.onRemove(this.map),this.mergeLayers()}getOwnLayer(a){return this._layers[a]}hasLayer(a){return a in this._mergedLayers}hasLayerType(a){for(const h in this._layers)if(this._layers[h].type===a)return!0;return!1}setLayerZoomRange(a,h,y){this._checkLoaded();const b=this._checkLayer(a);b&&(b.minzoom===h&&b.maxzoom===y||(h!=null&&(b.minzoom=h),y!=null&&(b.maxzoom=y),this._updateLayer(b)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(a,h){this._checkLoaded();const y=this._checkLayer(a);y&&y.slot!==h&&(y.slot=h,this._updateLayer(y))}setFilter(a,h,y={}){this._checkLoaded();const b=this._checkLayer(a);if(b&&!r.bx(b.filter,h))return h==null?(b.filter=void 0,void this._updateLayer(b)):void(this._validate(Pn,`layers.${b.id}.filter`,h,{layerType:b.type},y)||(b.filter=r.dn(h),this._updateLayer(b)))}getFilter(a){const h=this._checkLayer(a);if(h)return r.dn(h.filter)}setLayoutProperty(a,h,y,b={}){this._checkLoaded();const T=this._checkLayer(a);if(T&&!r.bx(T.getLayoutProperty(h),y)){if(y!=null&&(!b||b.validate!==!1)&&Qd(T,Vc.call(Mo,{key:`layers.${a}.layout.${h}`,layerType:T.type,objectKey:h,value:y,styleSpec:r.a6,style:{glyphs:!0,sprite:!0}})))return;T.setLayoutProperty(h,y),T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),this._updateLayer(T)}}setLayerProperty(a,h,y,b={}){this._checkLoaded();const T=this._checkLayer(a);T&&(h==="appearances"?(T.setAppearances(y),this._changes.setDirty()):T.isPaintProperty(h)?this.setPaintProperty(a,h,y,b):this.setLayoutProperty(a,h,y,b))}getLayoutProperty(a,h){const y=this._checkLayer(a);if(y)return y.getLayoutProperty(h)}setPaintProperty(a,h,y,b={}){this._checkLoaded();const T=this._checkLayer(a);if(!T||r.bx(T.getPaintProperty(h),y)||y!=null&&(!b||b.validate!==!1)&&Qd(T,Ms.call(Mo,{key:`layers.${a}.paint.${h}`,layerType:T.type,objectKey:h,value:y,styleSpec:r.a6})))return;const E=T.setPaintProperty(h,y);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),E&&this._updateLayer(T),this._changes.updatePaintProperties(T)}getPaintProperty(a,h){const y=this._checkLayer(a);if(y)return y.getPaintProperty(h)}setFeatureState(a,h){if(this._checkLoaded(),"target"in a){if("featuresetId"in a.target){const{featuresetId:M,importId:L}=a.target,O=this.getFragmentStyle(L),H=O.getFeaturesetLayers(M);for(const{source:F,sourceLayer:Z}of H)O.setFeatureState({id:a.id,source:F,sourceLayer:Z},h)}else if("layerId"in a.target){const{layerId:M}=a.target,L=this.getLayer(M);this.setFeatureState({id:a.id,source:L.source,sourceLayer:L.sourceLayer},h)}return}const y=a.source,b=a.sourceLayer,T=this._checkSource(y);if(!T)return;const E=T.type;if(E==="geojson"&&b)return void this.fire(new r.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(E==="vector"&&!b)return void this.fire(new r.y(new Error("The sourceLayer parameter must be provided for vector source types.")));a.id===void 0&&this.fire(new r.y(new Error("The feature id parameter must be provided.")));const P=this.getOwnSourceCaches(y);for(const M of P)M.setFeatureState(b,a.id,h)}
vendor: 4,255 bytes, line 822
822removeFeatureState(a,h){if(this._checkLoaded(),"target"in a){if("featuresetId"in a.target){const{featuresetId:M,importId:L}=a.target,O=this.getFragmentStyle(L),H=O.getFeaturesetLayers(M);for(const{source:F,sourceLayer:Z}of H)O.removeFeatureState({id:a.id,source:F,sourceLayer:Z},h)}else if("layerId"in a.target){const{layerId:M}=a.target,L=this.getLayer(M);this.removeFeatureState({id:a.id,source:L.source,sourceLayer:L.sourceLayer},h)}return}const y=a.source,b=this._checkSource(y);if(!b)return;const T=b.type,E=T==="vector"?a.sourceLayer:void 0;if(T==="vector"&&!E)return void this.fire(new r.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(h&&typeof a.id!="string"&&typeof a.id!="number")return void this.fire(new r.y(new Error("A feature id is required to remove its specific state property.")));const P=this.getOwnSourceCaches(y);for(const M of P)M.removeFeatureState(E,a.id,h)}getFeatureState(a){if(this._checkLoaded(),"target"in a){let T;if("featuresetId"in a.target){const{featuresetId:E,importId:P}=a.target,M=this.getFragmentStyle(P),L=M.getFeaturesetLayers(E);for(const{source:O,sourceLayer:H}of L){const F=M.getFeatureState({id:a.id,source:O,sourceLayer:H});if(F&&!T)T=F;else if(!r.bx(T,F))return void this.fire(new r.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 a.target){const{layerId:E}=a.target,P=this.getLayer(E);T=this.getFeatureState({id:a.id,source:P.source,sourceLayer:P.sourceLayer})}return T}const h=a.source,y=a.sourceLayer,b=this._checkSource(h);if(b){if(b.type!=="vector"||y)return a.id===void 0&&this.fire(new r.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(h)[0].getFeatureState(y,a.id);this.fire(new r.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(a){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,a),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const a=this.getTerrain(),h=a&&this.terrain&&this.terrain.scope===this.scope?a:this.stylesheet.terrain;return r.du({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:h,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)},y=>y!==void 0)}_updateFilteredLayers(a){for(const h of Object.values(this._mergedLayers))a(h)&&this._updateLayer(h)}_updateLayer(a){this._changes.updateLayer(a);const h=this.getLayerSourceCache(a),y=r.B(a.source,a.scope),b=this._changes.getUpdatedSourceCaches();a.source&&!b[y]&&h&&h.getSource().type!=="raster"&&(this._changes.updateSourceCache(y,"reload"),h.pause()),a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(a){const h=P=>this._mergedLayers[P].is3D(!!this.terrain),y=this.order,b={},T=[];for(let P=y.length-1;P>=0;P--){const M=y[P];if(h(M)){b[M]=P;for(const L of a){const O=L[M];if(O)for(const H of O)T.push(H)}}}T.sort((P,M)=>M.intersectionZ-P.intersectionZ);const E=[];for(let P=y.length-1;P>=0;P--){const M=y[P];if(h(M))for(let L=T.length-1;L>=0;L--){const O=T[L].feature;if(O.layer&&b[O.layer.id]<P)break;E.push(O),T.pop()}else for(const L of a){const O=L[M];if(O)for(const H of O)E.push(H.feature)}}return E}queryRasterValue(a,h,y){const b=this.getOwnSource(a);return b?b.type!=="raster-array"?(this.fire(new r.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):b.queryRasterArrayValue(h,y):(this.fire(new r.y(new Error(`Source with i
822d "${a}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(a,h,y){let b;h&&!Array.isArray(h)&&h.filter&&(this._validate(Pn,"queryRenderedFeatures.filter",h.filter,null,h),b=r.b5(h.filter));const T={},E=O=>{if(Tv.has(O.type))return;const H=this.getOwnLayerSourceCache(O),F=T[H.id]=T[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};O.is3D(!!this.terrain)&&(F.has3DLayers=!0),F.layers[O.fqid]=F.layers[O.fqid]||{styleLayer:O,targets:[]},F.layers[O.fqid].targets.push({filter:b})};if(h&&h.layers){if(!Array.isArray(h.layers))return this.fire(new r.y(new Error("parameters.layers must be an Array."))),[];for(const O of h.layers){const H=this._layers[O];if(!H)return this.fire(new r.y(new Error(`The layer '${O}' does not exist in the map's style and cannot be queried for features.`))),[];E(H)}}else for(const O in this._layers)E(this._layers[O]);const P=this._queryRenderedFeatures(a,T,y),M=this._flattenAndSortRenderedFeatures(P),L=[];for(const O of M)r.dv(O.layer.id)===this.scope&&L.push(O);return L}queryRenderedFeatureset(a,h,y){let b;h&&!Array.isArray(h)&&h.filter&&(this._validate(Pn,"queryRenderedFeatures.filter",h.filter,null,h),b=r.b5(h.filter));const T="mock",E=[];if(h&&h.target)E.push(Object.assign({},h,{targetId:T,filter:b}));else{const O=this.getFeaturesetDescriptors();for(const H of O)E.push({targetId:T,filter:b,target:H});for(const{style:H}of this.fragments){const F=H.getFeaturesetDescriptors();for(const Z of F)E.push({targetId:T,filter:b,target:Z})}}const P=this.queryRenderedTargets(a,E,y),M=[],L=new Set;for(const O of P)for(const H of O.variants[T])hl(H,O,L)||M.push(new r.dw(O,H));return M}queryRenderedTargets(a,h,y){const b={},T=(P,M,L,O)=>{const H=b[M.id]=b[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};if(H.layers[P.fqid]=H.layers[P.fqid]||{styleLayer:P,targets:[]},P.is3D(!!this.terrain)&&(H.has3DLayers=!0),!O)return L.uniqueFeatureID=!1,void H.layers[P.fqid].targets.push(L);H.layers[P.fqid].targets.push(Object.assign({},L,{namespace:O.namespace,properties:O.properties,uniqueFeatureID:O.uniqueFeatureID}))};for(const P of h)if("featuresetId"in P.target){const{featuresetId:M,importId:L}=P.target,O=this.getFragmentStyle(L);if(!O||!O._featuresetSelectors)continue;const H=O._featuresetSelectors[M];if(!H){this.fire(new r.y(new Error(`The featureset '${M}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const F of H){const Z=O.getOwnLayer(F.layerId);Z&&!Tv.has(Z.type)&&T(Z,O.getOwnLayerSourceCache(Z),P,F)}}else if("layerId"in P.target){const{layerId:M}=P.target,L=this.getLayer(M);if(!L||Tv.has(L.type))continue;T(L,this.getLayerSourceCache(L),P)}const E=this._queryRenderedFeatures(a,b,y);return this._flattenAndSortRenderedFeatures(E)}_queryRenderedFeatures(a,h,y){const b=[],T=!!this.map._showQueryGeometry,E=fr.createFromScreenPoints(a,y);for(const P in h){const M=pl(E,h[P],this._availableImages,y,T);Object.keys(M).length&&b.push(M)}if(this.placement)for(const P in h){if(!h[P].sourceCache._onlySymbols)continue;const M=fv(E.screenGeometry,h[P],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(M).length&&b.push(M)}return b}querySourceFeatures(a,h){const y=h&&h.filter;y&&this._validate(Pn,"querySourceFeatures.filter",y,null,h);let b=[];const T=this.getOwnSourceCaches(a);for(const E of T)b=b.concat(qg(E,h));return b}addSourceType(a,h,y){return xc.getSourceType(a)?y(new Error(`A source type called "${a}" already exists.`)):(xc.setSourceType(a,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:h.workerSourceURL},y):y(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(a,h,y={}){this._checkLoaded();const b=this.light.getLight();let T=!1;for(const P in a)if(!r.bx(a[P],b[P])){T=!0;break}if(!T)return;const E=this._getTransitionParameters();this.light.setLight(a,h,y),this.light.updateTransitions(E)}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=r.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&r.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(a,h=1){if(this._checkLoaded(),!a)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),h===0&&delete this.terrain,a===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedU
vendor: 4,608 bytes, line 822
822pdate=!0);this.checkCanvasFingerprintNoise();let y=a;const b=a.source==null;if(h===1){if(this.disableElevatedTerrain)return;if(typeof y.source=="object"){const P="terrain-dem-src";this.addSource(P,y.source),y=r.dn(y),y=Object.assign(y,{source:P})}const T=Object.assign({},y),E={};if(this.terrain&&b){T.source=this.terrain.get().source;const P=this.terrain?this.getFragmentStyle(this.terrain.scope):null;P&&(E.style=P.serialize())}if(this._validate(Hd,"terrain",T,E))return}if(!this.terrain||this.terrain.scope!==this.scope&&!b||this.terrain&&h!==this.terrain.drapeRenderMode){if(!y)return;this._createTerrain(y,h),this.fire(new r.z("data",{dataType:"style"}))}else{const T=this.terrain,E=T.get();for(const P of Object.keys(r.a6.terrain))!y.hasOwnProperty(P)&&r.a6.terrain[P].default&&(y[P]=r.a6.terrain[P].default);for(const P in a)if(!r.bx(a[P],E[P])){T.set(a,this.options),this.stylesheet.terrain=a;const M=this._getTransitionParameters({duration:0});T.updateTransitions(M),this.fire(new r.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(a){const h=this.fog=new di(a,this.map.transform,this.scope,this.options);this.stylesheet.fog=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}_createSnow(a){const h=this.snow=new _r(a,this.map.transform,this.scope,this.options);this.stylesheet.snow=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}_createRain(a){const h=this.rain=new xs(a,this.map.transform,this.scope,this.options);this.stylesheet.rain=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(a){if(this._checkLoaded(),!a)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const h=this.fog;if(!r.bx(h.get(),a)){h.set(a,this.options),this.stylesheet.fog=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}}else this._createFog(a);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(a){if(this._checkLoaded(),!a)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const h=this.snow;if(!r.bx(h.get(),a)){h.set(a,this.options),this.stylesheet.snow=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}}else this._createSnow(a);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(a){if(this._checkLoaded(),!a)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const h=this.rain;if(!r.bx(h.get(),a)){h.set(a,this.options),this.stylesheet.rain=h.get();const y=this._getTransitionParameters({duration:0});h.updateTransitions(y)}}else this._createRain(a);this._markersNeedUpdate=!0}_reloadColorTheme(){const a=()=>{for(const b in this._layers)this._layers[b].lut=this._styleColorTheme.lut;for(const b in this._sourceCaches)this._sourceCaches[b].clearTiles()},h=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!h)return this._styleColorTheme.lut=null,void a();const y=this._evaluateColorThemeData(h);this._loadColorTheme(y).then(()=>{this.fire(new r.z("colorthemeset")),a()}).catch(b=>{r.w(`Couldn't set color theme: ${b}`)})}setColorTheme(a){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&r.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=a,this._reloadColorTheme()}setImportColorTheme(a,h){const y=this.getFragmentStyle(a);y&&(y._styleColorTheme.colorThemeOverride=h,y._reloadColorTheme())}_getTransitionParameters(a){return{now:r.o.now(),transition:Object.assign(this.transition,a)}}updateDrapeFirstLayers(){if(!this.terrain)return;const a=[],h=[];for(const y of this._mergedOrder)this.isLayerDraped(this._mergedLayers[y])?a.push(y):h.push(y);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...h)}_createTerrain(a,h){const y=this.terrain=new Ue(a,h,this.scope,this.options,this.map.getWorldview());h===1&&(this.stylesheet.terrain=a),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const b=this._getTransitionParameters({duration:0});y.updateTransitions(b)}_force3DLayerUpdate(){for(const a in this._layers){const h=this._layers[a];h.type==="fill-extrusion"&&this._updateLayer(h)}}
822_forceSymbolLayerUpdate(){for(const a in this._layers){const h=this._layers[a];h.type==="symbol"&&this._updateLayer(h)}}_validate(a,h,y,b,T={}){if(T&&T.validate===!1)return!1;const E=Object.assign({},this.serialize());return Qd(this,a.call(Mo,Object.assign({key:h,style:E,value:y,styleSpec:r.a6},b)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),r.dx.off("pluginStateChange",this._rtlTextPluginCallback);for(const a in this._mergedLayers)this._mergedLayers[a].setEventedParent(null);for(const a in this._mergedSourceCaches)this._mergedSourceCaches[a].clearTiles(),this._mergedSourceCaches[a].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(a){const h=this.getSourceCaches(a);for(const y of h)y.clearTiles()}clearSources(){for(const a in this._mergedSourceCaches)this._mergedSourceCaches[a].clearTiles()}clearLayers(){for(const a in this._mergedLayers){const h=this._mergedLayers[a];h._clear&&h._clear()}}reloadSource(a){const h=this.getSourceCaches(a);for(const y of h)y.resume(),y.reload()}
vendor: 5,865 bytes, line 822
822reloadSources(){for(const a of this.getSources())a.reload&&a.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(a=>{a.modelManager.reloadModels(a.scope)})}updateSources(a){let h;this.directionalLight&&(h=qE(this.directionalLight));const y=new Set;for(const b in this._mergedLayers){const T=this._mergedLayers[b];T.hasElevation()&&!y.has(T.source)&&y.add(T.source)}for(const b in this._mergedSourceCaches){const T=this._mergedSourceCaches[b],E=y.has(T._source.id);T.update(a,void 0,void 0,h,E)}}_generateCollisionBoxes(){for(const a in this._sourceCaches){const h=this._sourceCaches[a];h.resume(),h.reload()}}_updatePlacement(a,h,y,b,T,E,P=!1){let M=!1,L=!1;const O={},H={};for(const F of this._mergedOrder){const Z=this._mergedLayers[F];if(Z.type!=="symbol")continue;const Y=r.B(Z.source,Z.scope);let J=O[Y];if(!J){const ne=this.getLayerSourceCache(Z);if(!ne)continue;const ae=ne.getRenderableIds(!0).map(fe=>ne.getTileByID(fe));H[Y]=ae.slice(),J=O[Y]=ae.sort((fe,ue)=>ue.tileID.overscaledZ-fe.tileID.overscaledZ||(fe.tileID.isLessThan(ue.tileID)?-1:1))}const se=this.crossTileSymbolIndex.addLayer(Z,J,h.center.lng,h.projection);M=M||se}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),P=P||this._layerOrderChanged||b===0,this._layerOrderChanged&&this.fire(new r.z("neworder")),(P||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(r.o.now(),h.zoom))&&(this.pauseablePlacement=new Ya(h,this._mergedOrder,P,y,b,T,this.placement,this.fog&&h.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,O,H,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(r.o.now()),L=!0),M&&this.pauseablePlacement.placement.setStale()),L||M){this._buildingIndex.onNewFrame(h.zoom);for(let F=0;F<this._mergedOrder.length;F++){const Z=this._mergedLayers[this._mergedOrder[F]];if(Z.type!=="symbol")continue;const Y=this.isLayerClipped(Z);this.placement.updateLayerOpacities(Z,O[r.B(Z.source,Z.scope)],F,Y?E:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(r.o.now())}}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}addImport(a,h){this._checkLoaded();const y=this.stylesheet.imports=this.stylesheet.imports||[];if(y.findIndex(({id:T})=>T===a.id)!==-1)return void this.fire(new r.y(new Error(`Import with id '${a.id}' already exists in the map's style.`)));if(!h)return y.push(a),this._loadImports([a],!0);const b=y.findIndex(({id:T})=>T===h);return b===-1&&this.fire(new r.y(new Error(`Import with id "${h}" does not exist on this map.`))),this.stylesheet.imports=y.slice(0,b).concat(a).concat(y.slice(b)),this._loadImports([a],!0,h)}updateImport(a,h){this._checkLoaded();const y=this.stylesheet.imports||[],b=this.getImportIndex(a);return b===-1?this:typeof h=="string"?(this.setImportUrl(a,h),this):(h.url&&h.url!==y[b].url&&this.setImportUrl(a,h.url),r.bx(h.config,y[b].config)||this.setImportConfig(a,h.config,h.data.schema),r.bx(h.data,y[b].data)||this.setImportData(a,h.data),this)}moveImport(a,h){this._checkLoaded();let y=this.stylesheet.imports||[];const b=this.getImportIndex(a);if(b===-1)return this;const T=this.getImportIndex(h);if(T===-1)return this;const E=y[b],P=this.fragments[b];return y=y.filter(({id:M})=>M!==a),this.fragments=this.fragments.filter(({id:M})=>M!==a),this.stylesheet.imports=y.slice(0,T).concat(E).concat(y.slice(T)),this.fragments=this.fragments.slice(0,T).concat(P).concat(this.fragments.slice(T)),this.mergeLayers(),this}setImportUrl(a,h){this._checkLoaded();const y=this.stylesheet.imports||[],b=this.getImportIndex(a);if(b===-1)return this;y[b].url=h;const T=this.fragments[b];return T.style=this._createFragmentStyle(y[b]),T.style.on("style.import.load",()=>this.mergeAll()),T.style.loadURL(h),this}setImportData(a,h){this._checkLoaded();const y=this.getImportIndex(a),b=this.stylesheet.imports||[];return y===-1?this:h?(this.fragments[y].style.setState(h),this._reloadImports(),this):(delete b[y].data,this.setImportUrl(a,b[y].url))}setImportConfig(a,h,y){this._checkLoaded();const b=this.getImportIndex(a),T=this.stylesheet.imports||[];if(b===-1)return this;h?T[b].config=h:delete T[b].config;const E=this.fragments[b];y&&E.style.stylesheet&&(E.style.stylesheet.schema=y);const P=E.style.stylesheet&&E.style.stylesheet.schema;return E.config=h,E.style.updateConfig(h,P),this.updateConfigDependencies(),this}removeImport(a){this._checkLoaded();const h=this.stylesheet.imports||[],y=this.getImportIndex(a);y!==-1&&(h.splice(y,1),this.fragments[y].style._remove(),this.fragments.splice(y,1),this._reloadImports())}getImportIndex(a){const h=(this.stylesheet.imports||[]).findIndex(y=>y.id===a);return h===-1&&this.fire(new r.y(new Error(`Import '${a}' does not exist in the map's style and cannot be updated.`))),h}getLayer(a){return this._mergedLayers[a]}getSources(){const a=[];for(const h in this._mergedOtherSourceCaches){const y=this._mergedOtherSourceCaches[h];y&&a.push(y.getSource())}return a}getSource(a,h){const y=this.getSourceCache(a,h);return y&&y.getSource()}getLayerSource(a){const h=this.getLayerSourceCache(a);return h&&h.getSource()}getSourceCache(a,h){const y=r.B(a,h);return this._mergedOtherSourceCaches[y]}getLayerSourceCache(a){const h=r.B(a.source,a.scope);return a.type==="symbol"?this._mergedSymbolSourceCaches[h]:this._mergedOtherSourceCaches[h]}getSourceCaches(a){if(a==null)return Object.values(this._mergedSourceCaches);const h=[];return this._mergedOtherSourceCaches[a]&&h.push(this._mergedOtherSourceCaches[a]),this._mergedSymbolSourceCaches[a]&&h.push(this._mergedSymbolSourceCaches[a]),h}
822updateSourceCaches(){const a=this._changes.getUpdatedSourceCaches();for(const h in a){const y=a[h];y==="reload"?this.reloadSource(h):y==="clear"&&this.clearSource(h)}}updateLayers(a){const h=this._changes.getUpdatedPaintProperties();for(const y of h){const b=this.getLayer(y);b&&b.updateTransitions(a)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(a){this.stylesheet.glyphs=a,this.glyphManager.setURL(a)}getImages(a,h,y){this.imageManager.getImages(h.images,h.scope,y),this._updateTilesForChangedImages();const b=E=>{if(E){const P=h.images.map(M=>r.I.toString(M));E.setDependencies(h.tileID.key,h.type,P)}},T=r.B(h.source,h.scope);b(this._mergedOtherSourceCaches[T]),b(this._mergedSymbolSourceCaches[T]),h.images.some(E=>E.iconsetId)&&this.fire(new r.z("data",{dataType:"style"}))}rasterizeImages(a,h,y){this.imageManager.rasterizeImages(h,y)}getGlyphs(a,h,y){this.glyphManager.getGlyphs(h.stacks,y)}getResource(a,h,y){return r.dy(h,y)}getOwnSourceCache(a){return this._otherSourceCaches[a]}getOwnLayerSourceCache(a){return a.type==="symbol"?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}getOwnSourceCaches(a){const h=[];return this._otherSourceCaches[a]&&h.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&h.push(this._symbolSourceCaches[a]),h}_isSourceCacheLoaded(a){const h=this.getOwnSourceCaches(a);return h.length===0?(this.fire(new r.y(new Error(`There is no source with ID '${a}'`))),!1):h.every(y=>y.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(a,h){if(!this._clipLayerPresent&&a.type!=="fill-extrusion"&&a.type!=="building")return!1;const y=a.type==="fill-extrusion"&&(a.sourceLayer==="building"||a.sourceLayer==="procedural_buildings"),b=a.type==="building";if(a.is3D(!!this.terrain)){if(y||b||h&&h.type==="batched-model"||a.type==="model")return!0}else if(a.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(a=>{a.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}
822xc.getSourceType=function(g){return mc[g]},xc.setSourceType=function(g,a){mc[g]=a},xc.registerForPluginStateChange=r.dz;class ap extends r.E{constructor(a){super(),this._style=a,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},r.aX(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(a){a===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=a,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(a){this._activeFloorsVisible=a,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(a){for(const[h,y]of Object.entries(a.buildings))if(this._buildings[h])for(const b of y.floorIds)this._buildings[h].floors[b]||(this._buildings[h].floors[b]=y.floors[b]);else this._buildings[h]=y;for(const h of a.activeFloors)this._activeFloors.add(h);this._updateIndoorSelector()}getIndoorTileOptions(a,h){const y=this._style.getIndoorSourceLayers(a,h);return y&&this._indoorState?{sourceLayers:y,indoorState:this._indoorState}:null}_updateUI(a,h,y){const b=function(T,E,P,M){let L=null,O=Number.MAX_SAFE_INTEGER;if(M<16)return null;for(const[H,F]of Object.entries(T)){const Z=F.center;if(Z){const Y=E.distanceTo(r.aS.convert(Z));Y<O&&P.contains(Z)&&(O=Y,L=H)}}return L}(this._buildings,h,y,a);b!==this._closestBuildingId&&(this._closestBuildingId=b,this._updateIndoorSelector())}_updateIndoorSelector(){const a=this._buildings,h=this._closestBuildingId,y=h&&a?a[h]:void 0;if(!y)return void this.fire(new r.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));let b=null;for(const E of y.floorIds)if(this._activeFloors&&this._activeFloors.has(E)){b=E;break}const T=Array.from(y.floorIds).map(E=>({id:E,name:y.floors[E].name,zIndex:y.floors[E].zIndex})).sort((E,P)=>P.zIndex-E.zIndex);this.fire(new r.z("selector-update",{selectedFloorId:b,activeFloorsVisible:this._activeFloorsVisible,floors:T}))}_updateActiveFloors(){const a=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:a,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var dy=` 823#define EPSILON 0.0000001 824#define PI 3.141592653589793 825#ifdef RENDER_CUTOFF 826float 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);} 827#endif`,T1=` 828out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth) 829{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;} 830#ifdef INDICATOR_CUTOUT 831uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 832#endif 833vec4 applyCutout(vec4 color,float height) { 834#ifdef INDICATOR_CUTOUT 835float 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); 836#else 837return color; 838#endif 839} 840#ifdef DEBUG_WIREFRAME 841#define HANDLE_WIREFRAME_DEBUG \\ 842glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 843gl_FragDepth=gl_FragCoord.z-0.0001; 844#else 845#define HANDLE_WIREFRAME_DEBUG 846#endif 847#ifdef RENDER_CUTOFF 848uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 849#endif
850vec4 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;}`,C1=` 851#define EXTENT 8192.0 852#define RAD_TO_DEG 180.0/PI 853#define DEG_TO_RAD PI/180.0 854#define GLOBE_RADIUS EXTENT/PI/2.0 855float 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;} 856#ifdef PROJECTION_GLOBE_VIEW 857vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 858#ifndef PROJECTED_POS_ON_VIEWPORT 859float 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; 860#else 861return vec3(0.0); 862#endif 863}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);} 864#endif 865vec2 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( 866unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 867);}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);} 868#ifdef RENDER_CUTOFF 869uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 870#endif 871const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) 872{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} 873#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer 874#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib 875#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib 876#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib 877#define DECLARE_MATERIAL_TABLE_INFO 878#endif`,Tf="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
878void 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;}",Cf=` 879#define ELEVATION_SCALE 7.0 880#define ELEVATION_OFFSET 450.0 881#ifdef PROJECTION_GLOBE_VIEW 882uniform 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( 883mix(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;} 884#else 885vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 886#endif 887#ifdef TERRAIN 888uniform 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) { 889#ifdef TERRAIN_DEM_FLOAT_FORMAT 890vec2 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; 891#else 892float 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); 893#endif 894}float prevElevation(vec2 apos) { 895#ifdef TERRAIN_DEM_FLOAT_FORMAT 896vec2 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; 897#else 898float 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); 899#endif 900} 901#ifdef TERRAIN_VERTEX_MORPHING 902float elevation(vec2 apos) { 903#ifdef ZERO_EXAGGERATION 904return 0.0; 905#endif 906float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 907#else 908float elevation(vec2 apos) { 909#ifdef ZERO_EXAGGERATION 910return 0.0; 911#endif 912return currentElevation(apos);} 913#endif 914vec4 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);} 915#else 916float elevation(vec2 pos) { return 0.0; } 917#endif 918#ifdef DEPTH_OCCLUSION 919uniform 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; 920#ifdef DEPTH_D24 921float 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);} 922#else 923highp float unpack_depth_rgba(vec4 rgba_depth) 924{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;} 925#endif 926bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 927#ifdef CLIP_ZERO_TO_ONE 928coord.z=-1.0+2.0*coord.z; 929#endif 930#ifdef DEPTH_D24 931float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 932#else 933float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 934#endif 935return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
935size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 936#ifdef DEPTH_D24 937highp vec4 depth=vec4( 938texture(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 939);depth=unpack_depth4(depth); 940#else 941highp vec4 depth=vec4( 942unpack_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)) 943); 944#endif 945return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; 946#ifdef CLIP_ZERO_TO_ONE 947coord.z=-1.0+2.0*coord.z; 948#endif 949int 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) { 950#ifdef DEPTH_D24 951highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 952#else 953highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 954#endif 955res+=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; 956#ifdef CLIP_ZERO_TO_ONE 957coord.z=-1.0+2.0*coord.z; 958#endif 959highp 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));} 960#else 961bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 962#endif//DEPTH_OCCLUSION`,E1=`#ifdef FOG 963uniform 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);} 964#endif`,Cv=`#ifdef FOG 965uniform 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; 966#ifdef FLIP_Y 967uv.y=1.0-uv.y; 968#endif 969highp vec3 ray_dir=mix( 970mix(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;}
970vec3 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);} 971#endif`,Rl=`#ifdef RASTER_ARRAY 972uniform 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) 973);}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) 974);}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);} 975#endif`,Ev=`#ifdef RASTER_ARRAY 976uniform 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;} 977#endif 978uniform 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;}`,Ft=`#ifdef RENDER_SHADOWS 979uniform 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];} 980#endif//RENDER_SHADOWS`,A1=`#ifdef RENDER_SHADOWS 981precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
981p float bias) { 982#ifdef CLIP_ZERO_TO_ONE 983highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); 984#else 985highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); 986#endif 987return 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; 988#ifdef SHADOWS_SINGLE_CASCADE 989vec2 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); 990#else 991light_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); 992#endif 993}highp float calculate_shadow_bias(float NDotL) { 994#ifdef NORMAL_OFFSET 995return 0.5*u_shadow_bias.x; 996#else 997return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 998#endif 999}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) 1000{highp vec2 biasUV=vec2( 1001pos_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);} 1002#endif`;const Ef=[];bc(dy,Ef),bc(C1,Ef),bc(T1,Ef);const Af={"_prelude_fog.vertex.glsl":E1,"_prelude_terrain.vertex.glsl":Cf,"_prelude_shadow.vertex.glsl":Ft,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer 1003#define MATERIAL_TABLE_DEBUG 0 1004uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; 1005#if MATERIAL_TABLE_DEBUG 1006vec4 colorDebug; 1007#endif 1008};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);}
1008float 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++) { 1009if (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; 1010}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 { 1011iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; 1012#if MATERIAL_TABLE_DEBUG 1013const 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; 1014#endif 1015uint offset=0u; 1016#if MATERIAL_TABLE_DEBUG 1017bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} 1018#endif 1019offset++; 1020#if MATERIAL_TABLE_DEBUG 1021uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} 1022#endif 1023offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); 1024#if MATERIAL_TABLE_DEBUG 1025if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} 1026#endif 1027uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); 1028#if MATERIAL_TABLE_DEBUG 1029if(keepFinding) 1030{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;}}} 1031#endif 1032offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; 1033#if MATERIAL_TABLE_DEBUG 1034if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} 1035#endif 1036info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) 1037{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);} 1038#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) 1039#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) 1040#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) 1041#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); 1042#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; 1043#endif`,"_prelude_fog.fragment.glsl":Cv,"_prelude_shadow.fragment.glsl":A1,"_prelude_lighting.glsl":` 1044#ifdef LIGHTING_3D_MODE 1045uniform 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
1045));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);} 1046#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Rl,"_prelude_raster_particle.glsl":Ev},hy={};An("",Cf),An(Cv,E1),An(A1,Ft),An(Rl,""),An(Ev,"");const py=An(T1,C1),yu=dy;var Av={background:An(`#include "_prelude_fog.fragment.glsl" 1047#include "_prelude_lighting.glsl" 1048uniform vec4 u_color;uniform float u_opacity; 1049#ifdef LIGHTING_3D_MODE 1050in vec4 v_color; 1051#endif 1052void main() {vec4 out_color; 1053#ifdef LIGHTING_3D_MODE 1054out_color=v_color; 1055#else 1056out_color=u_color; 1057#endif 1058#ifdef FOG 1059out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1060#endif 1061glFragColor=out_color*u_opacity; 1062#ifdef OVERDRAW_INSPECTOR 1063glFragColor=vec4(1.0); 1064#endif 1065HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1066#include "_prelude_lighting.glsl" 1067in vec2 a_pos;uniform mat4 u_matrix; 1068#ifdef LIGHTING_3D_MODE 1069uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength; 1070#endif 1071void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 1072#ifdef LIGHTING_3D_MODE 1073v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 1074#endif 1075#ifdef FOG 1076v_fog_pos=fog_position(a_pos); 1077#endif 1078}`),backgroundPattern:An(`#include "_prelude_fog.fragment.glsl" 1079#include "_prelude_lighting.glsl" 1080uniform 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); 1081#ifdef LIGHTING_3D_MODE 1082out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1083#endif 1084#ifdef FOG 1085out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1086#endif 1087glFragColor=out_color*u_opacity; 1088#ifdef OVERDRAW_INSPECTOR 1089glFragColor=vec4(1.0); 1090#endif 1091HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1092uniform 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); 1093#ifdef FOG 1094v_fog_pos=fog_position(a_pos); 1095#endif 1096}`),building:An(`#include "_prelude_fog.fragment.glsl" 1097#include "_prelude_shadow.fragment.glsl" 1098#include "_prelude_lighting.glsl" 1099const 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; 1100#ifdef BUILDING_FAUX_FACADE 1101in 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; 1102#endif 1103#ifdef RENDER_SHADOWS 1104in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 1105#endif 1106#ifdef FLOOD_LIGHT
1107in highp float v_flood_radius;in float v_has_flood_light; 1108#endif 1109uniform 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));} 1110#ifdef BUILDING_FAUX_FACADE 1111float 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; 1112#if 0 1113if (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; 1114#else 1115if (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; 1116#endif 1117return out_color;} 1118#endif 1119vec3 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; 1120#ifdef BUILDING_FAUX_FACADE 1121if (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);} 1122#endif 1123vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 1124#ifdef RENDER_SHADOWS 1125shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 1126#else 1127shadowed_lighting_factor=dot(normal,u_lighting_directional_dir); 1128#endif 1129color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); 1130#ifdef FLOOD_LIGHT
1131float 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); 1132#endif 1133color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); 1134#ifdef FOG 1135color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 1136#endif 1137color*=u_opacity; 1138#ifdef INDICATOR_CUTOUT 1139color=applyCutout(color,v_pos.z); 1140#endif 1141#ifdef FEATURE_CUTOUT 1142color=apply_feature_cutout(color,gl_FragCoord); 1143#endif 1144glFragColor=color; 1145#ifdef DEBUG_SHOW_NORMALS 1146color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 1147#endif 1148#ifdef OVERDRAW_INSPECTOR 1149glFragColor=vec4(1.0); 1150#endif 1151HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1152#include "_prelude_shadow.vertex.glsl" 1153in 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; 1154#ifdef BUILDING_FAUX_FACADE 1155out 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; 1156#endif 1157#ifdef RENDER_SHADOWS 1158uniform 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; 1159#endif 1160#ifdef FLOOD_LIGHT 1161out highp float v_flood_radius;out float v_has_flood_light; 1162#endif 1163const 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));} 1164#ifdef BUILDING_FAUX_FACADE 1165mat3 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);} 1166#endif 1167#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 1168#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive 1169void main() { 1170#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 1171#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive 1172#ifdef FLOOD_LIGHT 1173v_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); 1174#endif 1175vec4 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; 1176#ifdef BUILDING_FAUX_FACADE 1177v_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);} 1178#endif 1179v_pos=a_pos_3f; 1180#ifdef RENDER_CUTOFF 1181vec4 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; 1182#endif 1183#ifdef RENDER_SHADOWS 1184vec3 shadow_pos=v_pos; 1185#ifdef NORMAL_OFFSET 1186vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 1187#endif 1188v_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);v_depth_shadows=gl_Position.w; 1189#endif 1190#ifdef FOG 1191v_fog_pos=fog_position(v_pos); 1192#endif 1193gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}`),buildingBloom:An(`in vec4 v_color_emissive; 1194#pragma mapbox: define-attribute highp vec4 bloom_attenuation 1195#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 1196float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; 1197#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 1198float 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));
1198opacity*=saturate(1.0-distance*distance); 1199#endif 1200glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 1201#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive 1202#pragma mapbox: define-attribute highp vec4 bloom_attenuation 1203out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 1204#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive 1205#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 1206#ifdef HAS_ATTRIBUTE_a_part_color_emissive 1207vec4 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); 1208#else 1209v_color_emissive=vec4(1.0); 1210#endif 1211gl_Position=u_matrix*vec4(a_pos_3f,1.0);}`),buildingDepth:An(`in highp float v_depth;void main() { 1212#ifndef DEPTH_TEXTURE 1213glFragColor=pack_depth(v_depth); 1214#endif 1215}`,"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:An(`#include "_prelude_fog.fragment.glsl" 1216#include "_prelude_lighting.glsl" 1217in vec3 v_data;in float v_visibility; 1218#pragma mapbox: define highp vec4 color 1219#pragma mapbox: define mediump float radius 1220#pragma mapbox: define lowp float blur 1221#pragma mapbox: define lowp float opacity 1222#pragma mapbox: define highp vec4 stroke_color 1223#pragma mapbox: define mediump float stroke_width 1224#pragma mapbox: define lowp float stroke_opacity 1225uniform float u_emissive_strength;void main() { 1226#pragma mapbox: initialize highp vec4 color 1227#pragma mapbox: initialize mediump float radius 1228#pragma mapbox: initialize lowp float blur 1229#pragma mapbox: initialize lowp float opacity 1230#pragma mapbox: initialize highp vec4 stroke_color 1231#pragma mapbox: initialize mediump float stroke_width 1232#pragma mapbox: initialize lowp float stroke_opacity 1233vec2 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 ? 1234smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 1235smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 1236antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 1237);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 1238#ifdef LIGHTING_3D_MODE 1239out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1240#endif 1241#ifdef FOG 1242out_color=fog_apply_premultiplied(out_color,v_fog_pos); 1243#endif 1244glFragColor=out_color*(v_visibility*opacity_t); 1245#ifdef OVERDRAW_INSPECTOR 1246glFragColor=vec4(1.0); 1247#endif 1248}`,`#include "_prelude_fog.vertex.glsl" 1249#include "_prelude_terrain.vertex.glsl" 1250#define NUM_VISIBILITY_RINGS 2 1251#define INV_SQRT2 0.70710678 1252#define ELEVATION_BIAS 0.0001 1253#define NUM_SAMPLES_PER_RING 16 1254uniform 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; 1255#ifdef PROJECTION_GLOBE_VIEW 1256in 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; 1257#endif 1258#ifdef ELEVATED_ROADS 1259in float a_circle_z_offset; 1260#endif 1261out vec3 v_data;out float v_visibility; 1262#pragma mapbox: define highp vec4 color 1263#pragma mapbox: define mediump float radius 1264#pragma mapbox: define lowp float blur 1265#pragma mapbox: define lowp float opacity 1266#pragma mapbox: define highp vec4 stroke_color 1267#pragma mapbox: define mediump float stroke_width 1268#pragma mapbox: define lowp float stroke_opacity 1269vec2 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) { 1270#if defined(TERRAIN) 1271return elevation(pos)+ELEVATION_BIAS; 1272#else 1273return 0.0; 1274#endif 1275}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); 1276#ifdef PITCH_WITH_MAP 1277#ifdef PROJECTION_GLOBE_VIEW 1278return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 1279#else 1280return u_matrix*( world_center+vec4(sample_offset,0,0) ); 1281#endif 1282#else 1283return projected_center+vec4(sample_offset,0,0); 1284#endif 1285}float get_sample_step() { 1286#ifdef PITCH_WITH_MAP 1287return 2.0*PI/float(NUM_SAMPLES_PER_RING); 1288#else 1289return PI/float(NUM_SAMPLES_PER_RING); 1290#endif 1291}void main() { 1292#pragma mapbox: initialize highp vec4 color 1293#pragma mapbox: initialize mediump float radius 1294#pragma mapbox: initialize lowp float blur 1295#pragma mapbox: initialize lowp float opacity 1296#pragma mapbox: initialize highp vec4 stroke_color 1297#pragma mapbox: initialize mediump float stroke_width 1298#pragma mapbox: initialize lowp float stroke_opacity 1299vec2 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; 1300#ifdef PROJECTION_GLOBE_VIEW 1301vec3 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); 1302#else
1303surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); 1304#endif 1305#ifdef ELEVATED_ROADS 1306world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 1307#endif 1308vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 1309#ifdef PITCH_WITH_MAP 1310#ifdef SCALE_WITH_MAP 1311view_scale=1.0; 1312#else 1313view_scale=projected_center.w/u_camera_to_center_distance; 1314#endif 1315#else 1316#ifdef SCALE_WITH_MAP 1317view_scale=u_camera_to_center_distance; 1318#else 1319view_scale=projected_center.w; 1320#endif 1321#endif 1322gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 1323#ifdef TERRAIN 1324float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 1325#ifdef PITCH_WITH_MAP 1326float 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; 1327#else 1328occlusion_world_center=world_center;occlusion_projected_center=projected_center; 1329#endif 1330for(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); 1331#else 1332visibility=1.0; 1333#endif 1334#ifdef PROJECTION_GLOBE_VIEW 1335visibility=1.0; 1336#endif 1337v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 1338#ifdef FOG 1339v_fog_pos=fog_position(world_center.xyz); 1340#endif 1341}`),clippingMask:An("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:An(`#include "_prelude_fog.fragment.glsl" 1342uniform highp float u_intensity;in vec2 v_extrude; 1343#pragma mapbox: define highp float weight 1344#define GAUSS_COEF 0.3989422804014327 1345void main() { 1346#pragma mapbox: initialize highp float weight 1347float 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); 1348#ifdef FOG 1349if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 1350#endif 1351#ifdef OVERDRAW_INSPECTOR 1352glFragColor=vec4(1.0); 1353#endif 1354HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 1355#include "_prelude_fog.vertex.glsl" 1356uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; 1357#ifdef PROJECTION_GLOBE_VIEW 1358in 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; 1359#endif 1360out vec2 v_extrude; 1361#pragma mapbox: define highp float weight 1362#pragma mapbox: define mediump float radius 1363const highp float ZERO=1.0/255.0/16.0; 1364#define GAUSS_COEF 0.3989422804014327 1365void main() { 1366#pragma mapbox: initialize highp float weight 1367#pragma mapbox: initialize mediump float radius 1368vec2 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; 1369#ifdef PROJECTION_GLOBE_VIEW 1370vec3 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); 1371#else 1372pos=vec3(tilePos+extrude,elevation(tilePos)); 1373#endif 1374gl_Position=u_matrix*vec4(pos,1); 1375#ifdef FOG 1376v_fog_pos=fog_position(pos); 1377#endif 1378}`),heatmapTexture:An(`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; 1379#ifdef OVERDRAW_INSPECTOR 1380glFragColor=vec4(0.0); 1381#endif 1382HANDLE_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:An("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" 1383in 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; 1384#ifdef PROJECTION_GLOBE_VIEW 1385uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 1386#endif 1387out 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); 1388#ifdef PROJECTION_GLOBE_VIEW 1389#ifndef PROJECTED_POS_ON_VIEWPORT 1390vec3 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); 1391#endif 1392#endif 1393vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 13940.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:An("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( 1395mix(-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( 13960.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:An("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" 1397in vec2 a_pos; 1398#ifdef PROJECTION_GLOBE_VIEW 1399in vec3 a_pos_3; 1400#endif 1401out 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; 1402#ifdef PROJECTION_GLOBE_VIEW
1403gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); 1404#else 1405gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); 1406#endif 1407}`),elevatedStructuresDepth:An(`void main() { 1408#ifndef DEPTH_TEXTURE 1409glFragColor=vec4(0.); 1410#endif 1411}`,"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:An(`#ifdef DEPTH_RECONSTRUCTION 1412in float v_height; 1413#endif 1414void main() { 1415#ifdef DEPTH_RECONSTRUCTION 1416if (v_height >=0.0) 1417discard; 1418#else 1419#ifdef FEATURE_CUTOUT 1420apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); 1421#endif 1422#endif 1423glFragColor=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; 1424#ifdef DEPTH_RECONSTRUCTION 1425out float v_height; 1426#endif 1427void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 1428#ifdef DEPTH_RECONSTRUCTION 1429if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 1430#endif 1431gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:An(`#include "_prelude_fog.fragment.glsl" 1432#include "_prelude_lighting.glsl" 1433#include "_prelude_shadow.fragment.glsl" 1434in vec3 v_normal;in float v_height; 1435#ifdef RENDER_SHADOWS 1436in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 1437#endif 1438vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1438vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 1439{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; 1440#pragma mapbox: define highp vec4 structure_color 1441void main() { 1442#pragma mapbox: initialize highp vec4 structure_color 1443vec3 color=structure_color.xyz; 1444#ifdef LIGHTING_3D_MODE 1445vec3 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); 1446#ifdef RENDER_SHADOWS 1447float 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); 1448#else 1449color=apply_lighting(color,transformed_normal); 1450#endif 1451color=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);} 1452#endif 1453#ifdef FOG 1454color=fog_apply(color,v_fog_pos); 1455#endif 1456vec4 out_color=vec4(color,1.0); 1457#ifdef INDICATOR_CUTOUT 1458out_color=applyCutout(out_color,v_height); 1459#endif 1460#ifdef FEATURE_CUTOUT 1461out_color=apply_feature_cutout(out_color,gl_FragCoord); 1462#endif 1463glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1464#include "_prelude_shadow.vertex.glsl" 1465in 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; 1466#ifdef RENDER_SHADOWS 1467uniform 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; 1468#endif 1469#pragma mapbox: define highp vec4 structure_color 1470void main() { 1471#pragma mapbox: initialize highp vec4 structure_color 1472v_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); 1473#ifdef RENDER_SHADOWS 1474vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1475#ifdef NORMAL_OFFSET 1476vec3 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(); 1477#endif 1478v_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; 1479#endif 1480#ifdef FOG 1481v_fog_pos=fog_position(a_pos); 1482#endif 1483}`),fill:An(`#include "_prelude_fog.fragment.glsl" 1484#include "_prelude_lighting.glsl" 1485#include "_prelude_shadow.fragment.glsl" 1486#pragma mapbox: define highp vec4 color 1487#pragma mapbox: define lowp float opacity 1488uniform float u_emissive_strength; 1489#ifdef RENDER_SHADOWS 1490uniform 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; 1491#endif 1492#ifdef ELEVATED_ROADS 1493in highp float v_road_z_offset; 1494#endif 1495#ifdef INDICATOR_CUTOUT 1496in highp float v_z_offset; 1497#endif 1498void main() { 1499#pragma mapbox: initialize highp vec4 color 1500#pragma mapbox: initialize lowp float opacity 1501vec4 out_color=color; 1502#ifdef LIGHTING_3D_MODE 1503out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1504#ifdef RENDER_SHADOWS 1505float 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); 1506#endif 1507#endif 1508#ifdef FOG 1509out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1510#endif 1511out_color*=opacity; 1512#ifdef INDICATOR_CUTOUT 1513if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 1514#endif 1515#ifdef FEATURE_CUTOUT 1516out_color=apply_feature_cutout(out_color,gl_FragCoord); 1517#endif 1518glFragColor=out_color; 1519#ifdef OVERDRAW_INSPECTOR 1520glFragColor=vec4(1.0); 1521#endif 1522HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1523#include "_prelude_shadow.vertex.glsl" 1524in vec2 a_pos; 1525#ifdef ELEVATED_ROADS 1526in float a_road_z_offset;out highp float v_road_z_offset; 1527#endif 1528#ifdef RENDER_SHADOWS 1529uniform 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; 1530#endif 1531#ifdef INDICATOR_CUTOUT 1532out highp float v_z_offset; 1533#endif 1534uniform mat4 u_matrix; 1535#pragma mapbox: define highp vec4 color 1536#pragma mapbox: define lowp float opacity 1537#pragma mapbox: define highp float z_offset 1538void main() { 1539#pragma mapbox: initialize highp vec4 color 1540#pragma mapbox: initialize lowp float opacity 1541#pragma mapbox: initialize highp float z_offset 1542#ifdef ELEVATED_ROADS 1543z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 1544#endif 1545float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 1546#ifdef RENDER_SHADOWS 1547vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1548#ifdef NORMAL_OFFSET 1549vec3 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(); 1550#endif 1551v_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; 1552#endif 1553#ifdef FOG 1554v_fog_pos=fog_position(a_pos); 1555#endif 1556#ifdef INDICATOR_CUTOUT 1557v_z_offset=z_offset; 1558#endif 1559}`),fillOutline:An(`#include "_prelude_fog.fragment.glsl" 1560#include "_prelude_lighting.glsl" 1561#include "_prelude_shadow.fragment.glsl" 1562in highp vec2 v_pos;uniform float u_emissive_strength; 1563#ifdef RENDER_SHADOWS 1564uniform 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; 1565#endif 1566#pragma mapbox: define highp vec4 outline_color 1567#pragma mapbox: define lowp float opacity 1568void main() { 1569#pragma mapbox: initialize highp vec4 outline_color 1570#pragma mapbox: initialize lowp float opacity 1571float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; 1572#ifdef LIGHTING_3D_MODE 1573out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1574#ifdef RENDER_SHADOWS 1575float 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); 1576#endif 1577#endif 1578#ifdef FOG 1579out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1580#endif 1581#ifdef FEATURE_CUTOUT 1582out_color=apply_feature_cutout(out_color,gl_FragCoord); 1583#endif 1584glFragColor=out_color*(alpha*opacity); 1585#ifdef OVERDRAW_INSPECTOR 1586glFragColor=vec4(1.0); 1587#endif 1588HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1589#include "_prelude_shadow.vertex.glsl" 1590in vec2 a_pos; 1591#ifdef ELEVATED_ROADS 1592in float a_road_z_offset; 1593#endif 1594#ifdef RENDER_SHADOWS 1595uniform 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; 1596#endif 1597uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 1598#pragma mapbox: define highp vec4 outline_color 1599#pragma mapbox: define lowp float opacity 1600#pragma mapbox: define highp float z_offset 1601void main() { 1602#pragma mapbox: initialize highp vec4 outline_color 1603#pragma mapbox: initialize lowp float opacity 1604#pragma mapbox: initialize highp float z_offset 1605#ifdef ELEVATED_ROADS 1606z_offset+=a_road_z_offset; 1607#endif 1608float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 1609#ifdef FLIP_Y 1610v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 1611#else 1612v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 1613#endif 1614#ifdef RENDER_SHADOWS 1615vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1616#ifdef NORMAL_OFFSET 1617vec3 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(); 1618#endif 1619v_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; 1620#endif 1621#ifdef FOG 1622v_fog_pos=fog_position(a_pos); 1623#endif 1624}`),fillOutlinePattern:An(`#include "_prelude_fog.fragment.glsl" 1625#include "_prelude_lighting.glsl" 1626#include "_prelude_shadow.fragment.glsl" 1627uniform vec2 u_texsize;uniform sampler2D u_image; 1628#ifdef FILL_PATTERN_TRANSITION 1629uniform float u_pattern_transition; 1630#endif 1631uniform float u_emissive_strength; 1632#ifdef APPLY_LUT_ON_GPU 1633uniform highp sampler3D u_lutTexture; 1634#endif 1635#ifdef RENDER_SHADOWS 1636uniform 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; 1637#endif 1638in highp vec2 v_pos;in highp vec2 v_pos_world; 1639#pragma mapbox: define lowp float opacity 1640#pragma mapbox: define lowp vec4 pattern 1641#ifdef FILL_PATTERN_TRANSITION 1642#pragma mapbox: define mediump vec4 pattern_b 1643#endif 1644void main() { 1645#pragma mapbox: initialize lowp float opacity 1646#pragma mapbox: initialize mediump vec4 pattern 1647#ifdef FILL_PATTERN_TRANSITION 1648#pragma mapbox: initialize mediump vec4 pattern_b 1649#endif 1650vec2 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); 1651#ifdef APPLY_LUT_ON_GPU 1652out_color=applyLUT(u_lutTexture,out_color); 1653#endif 1654#ifdef FILL_PATTERN_TRANSITION 1655vec2 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; 1656#endif 1657#ifdef LIGHTING_3D_MODE 1658out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1659#ifdef RENDER_SHADOWS 1660float 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); 1661#endif 1662#endif 1663#ifdef FEATURE_CUTOUT 1664out_color=apply_feature_cutout(out_color,gl_FragCoord); 1665#endif 1666#ifdef FOG 1667out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1668#endif 1669glFragColor=out_color*(alpha*opacity); 1670#ifdef OVERDRAW_INSPECTOR 1671glFragColor=vec4(1.0); 1672#endif 1673HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1674#include "_prelude_shadow.vertex.glsl" 1675uniform 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; 1676#ifdef ELEVATED_ROADS 1677in float a_road_z_offset; 1678#endif 1679#ifdef RENDER_SHADOWS 1680uniform 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; 1681#endif 1682out highp vec2 v_pos;out highp vec2 v_pos_world; 1683#pragma mapbox: define lowp float opacity 1684#pragma mapbox: define lowp vec4 pattern 1685#ifdef FILL_PATTERN_TRANSITION 1686#pragma mapbox: define mediump vec4 pattern_b 1687#endif 1688#pragma mapbox: define lowp float pixel_ratio 1689#pragma mapbox: define highp float z_offset 1690void main() { 1691#pragma mapbox: initialize lowp float opacity 1692#pragma mapbox: initialize mediump vec4 pattern 1693#ifdef FILL_PATTERN_TRANSITION 1694#pragma mapbox: initialize mediump vec4 pattern_b 1695#endif 1696#pragma mapbox: initialize lowp float pixel_ratio 1697#pragma mapbox: initialize highp float z_offset 1698vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; 1699#ifdef ELEVATED_ROADS 1700z_offset+=a_road_z_offset; 1701#endif 1702float 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); 1703#ifdef FLIP_Y 1704v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 1705#else 1706v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 1707#endif 1708#ifdef RENDER_SHADOWS 1709vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1710#ifdef NORMAL_OFFSET 1711vec3 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(); 1712#endif 1713v_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; 1714#endif 1715#ifdef FOG 1716v_fog_pos=fog_position(a_pos); 1717#endif 1718}`),fillPattern:An(`#include "_prelude_fog.fragment.glsl" 1719#include "_prelude_lighting.glsl" 1720#include "_prelude_shadow.fragment.glsl" 1721uniform vec2 u_texsize;uniform sampler2D u_image; 1722#ifdef FILL_PATTERN_TRANSITION 1723uniform float u_pattern_transition; 1724#endif 1725in highp vec2 v_pos;uniform float u_emissive_strength; 1726#ifdef RENDER_SHADOWS 1727uniform 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; 1728#endif 1729#ifdef ELEVATED_ROADS 1730in highp float v_road_z_offset; 1731#endif 1732#ifdef APPLY_LUT_ON_GPU 1733uniform highp sampler3D u_lutTexture; 1734#endif 1735#pragma mapbox: define lowp float opacity 1736#pragma mapbox: define lowp vec4 pattern 1737#ifdef FILL_PATTERN_TRANSITION 1738#pragma mapbox: define mediump vec4 pattern_b 1739#endif 1740void main() { 1741#pragma mapbox: initialize lowp float opacity 1742#pragma mapbox: initialize mediump vec4 pattern 1743#ifdef FILL_PATTERN_TRANSITION 1744#pragma mapbox: initialize mediump vec4 pattern_b 1745#endif 1746vec2 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); 1747#ifdef APPLY_LUT_ON_GPU 1748out_color=applyLUT(u_lutTexture,out_color); 1749#endif 1750#ifdef FILL_PATTERN_TRANSITION 1751vec2 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; 1752#endif 1753#ifdef LIGHTING_3D_MODE 1754out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 1755#ifdef RENDER_SHADOWS 1756float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1757#ifdef ELEVATED_ROADS 1758out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1759#else 1760out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1761#endif 1762#endif 1763#endif 1764#ifdef FEATURE_CUTOUT 1765out_color=apply_feature_cutout(out_color,gl_FragCoord); 1766#endif 1767#ifdef FOG 1768out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1769#endif 1770glFragColor=out_color*opacity; 1771#ifdef OVERDRAW_INSPECTOR 1772glFragColor=vec4(1.0); 1773#endif 1774HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1775#include "_prelude_shadow.vertex.glsl" 1776uniform 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; 1777#ifdef ELEVATED_ROADS 1778in float a_road_z_offset;out highp float v_road_z_offset; 1779#endif 1780#ifdef RENDER_SHADOWS 1781uniform 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; 1782#endif 1783out highp vec2 v_pos; 1784#pragma mapbox: define lowp float opacity 1785#pragma mapbox: define lowp vec4 pattern 1786#ifdef FILL_PATTERN_TRANSITION 1787#pragma mapbox: define mediump vec4 pattern_b 1788#endif 1789#pragma mapbox: define lowp float pixel_ratio 1790#pragma mapbox: define highp float z_offset 1791void main() { 1792#pragma mapbox: initialize lowp float opacity 1793#pragma mapbox: initialize mediump vec4 pattern 1794#pragma mapbox: initialize lowp float pixel_ratio 1795#pragma mapbox: initialize highp float z_offset 1796#ifdef FILL_PATTERN_TRANSITION 1797#pragma mapbox: initialize mediump vec4 pattern_b 1798#endif 1799vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 1800#ifdef ELEVATED_ROADS 1801z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 1802#endif 1803float 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); 1804#ifdef RENDER_SHADOWS 1805vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 1806#ifdef NORMAL_OFFSET 1807vec3 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(); 1808#endif 1809v_pos_light_view_0=u
1809_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; 1810#endif 1811#ifdef FOG 1812v_fog_pos=fog_position(a_pos); 1813#endif 1814}`),fillExtrusion:An(`#include "_prelude_fog.fragment.glsl" 1815#include "_prelude_shadow.fragment.glsl" 1816#include "_prelude_lighting.glsl" 1817in vec4 v_color;in vec4 v_flat; 1818#ifdef RENDER_SHADOWS 1819in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 1820#endif 1821uniform lowp float u_opacity; 1822#ifdef FAUX_AO 1823uniform lowp vec2 u_ao;in vec2 v_ao; 1824#endif 1825#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1826in vec4 v_roof_color; 1827#endif 1828#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1829in highp vec3 v_normal; 1830#endif 1831uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 1832#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1833in float v_flood_radius;in float v_has_floodlight; 1834#endif 1835in float v_height; 1836#pragma mapbox: define highp float emissive_strength 1837void main() { 1838#pragma mapbox: initialize highp float emissive_strength 1839#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1840vec3 normal=normalize(v_normal); 1841#endif 1842float z;vec4 color=v_color; 1843#ifdef ZERO_ROOF_RADIUS 1844z=float(normal.z > 0.00001); 1845#ifdef LIGHTING_3D_MODE 1846normal=mix(normal,vec3(0.0,0.0,1.0),z); 1847#else 1848color=mix(v_color,v_roof_color,z); 1849#endif 1850#endif 1851float h=max(0.0,v_height);float ao_shade=1.0; 1852#ifdef FAUX_AO 1853float 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; 1854#ifdef ZERO_ROOF_RADIUS 1855concave*=(1.0-z); 1856#endif 1857float 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); 1858#ifdef LIGHTING_3D_MODE 1859#ifdef FLOOD_LIGHT 1860color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 1861#else 1862color.rgb*=ao_shade; 1863#endif 1864#else 1865color.rgb*=ao_shade; 1866#endif 1867#endif 1868#ifdef LIGHTING_3D_MODE 1869float flood_radiance=0.0; 1870#ifdef FLOOD_LIGHT 1871flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 1872#endif 1873#ifdef RENDER_SHADOWS 1874#ifdef FLOOD_LIGHT 1875float 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); 1876#else 1877float shadowed_lighting_factor; 1878#ifdef RENDER_CUTOFF 1879shadowed_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;} 1880#else 1881shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 1882#endif 1883color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 1884#endif 1885#else 1886color.rgb=apply_lighting(color.rgb,normal); 1887#ifdef FLOOD_LIGHT 1888color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 1889#endif 1890#endif 1891color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 1892#endif 1893#ifdef FOG 1894color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 1895#endif 1896#ifdef INDICATOR_CUTOUT 1897color=applyCutout(color,h); 1898#endif 1899#ifdef FEATURE_CUTOUT 1900color=apply_feature_cutout(color,gl_FragCoord); 1901#endif 1902glFragColor=color; 1903#ifdef OVERDRAW_INSPECTOR 1904glFragColor=vec4(1.0); 1905#endif 1906HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1907#include "_prelude_terrain.vertex.glsl" 1908#include "_prelude_shadow.vertex.glsl" 1909#include "_prelude_lighting.glsl" 1910#include "_prelude_material_table.vertex.glsl" 1911uniform 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; 1912#ifdef RENDER_WALL_MODE 1913in vec3 a_join_normal_inside; 1914#endif 1915#ifdef PROJECTION_GLOBE_VIEW 1916in 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; 1917#endif 1918#ifdef TERRAIN
1919uniform int u_height_type;uniform int u_base_type; 1920#endif 1921uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; 1922#ifdef RENDER_SHADOWS 1923uniform 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; 1924#endif 1925#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1926out vec4 v_roof_color; 1927#endif 1928#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1929out highp vec3 v_normal; 1930#endif 1931#ifdef FAUX_AO 1932uniform lowp vec2 u_ao;out vec2 v_ao; 1933#endif 1934#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 1935out float v_flood_radius;out float v_has_floodlight; 1936#endif 1937out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1938#pragma mapbox: define highp float base 1939#pragma mapbox: define highp float height 1940#pragma mapbox: define highp vec4 color 1941#pragma mapbox: define highp float flood_light_wall_radius 1942#pragma mapbox: define highp float line_width 1943#pragma mapbox: define highp float emissive_strength 1944void main() {DECLARE_MATERIAL_TABLE_INFO 1945#pragma mapbox: initialize highp float base 1946#pragma mapbox: initialize highp float height 1947#pragma mapbox: initialize highp vec4 color 1948#pragma mapbox: initialize highp float flood_light_wall_radius 1949#pragma mapbox: initialize highp float line_width 1950#pragma mapbox: initialize highp float emissive_strength 1951base*=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)); 1952#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1953v_normal=normal; 1954#endif 1955base=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); 1956#if defined(HAS_CENTROID) || defined(TERRAIN) 1957centroid_pos=a_centroid_pos; 1958#endif 1959float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1960#ifdef TERRAIN 1961bool 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); 1962#else 1963h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); 1964#endif 1965#ifdef PROJECTION_GLOBE_VIEW 1966float 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); 1967#endif 1968float cutoff=1.0;vec3 scaled_pos=pos; 1969#ifdef RENDER_CUTOFF 1970vec3 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); 1971#ifdef CLIP_ZERO_TO_ONE 1972cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1973#else 1974cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1975#endif 1976if (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); 1977#endif 1978float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1979#ifdef RENDER_WALL_MODE 1980vec2 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; 1981#endif 1982gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1983#ifdef RENDER_SHADOWS 1984vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1985#ifdef NORMAL_OFFSET 1986vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1987#endif 1988v_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); 1989#endif 1990float NdotL=0.0;float colorvalue=0.0; 1991#ifndef LIGHTING_3D_MODE 1992colorvalue=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*=( 1993(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1994#endif 1995#ifdef FAUX_AO
1996float 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; 1997#ifdef TERRAIN 1998top_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); 1999#endif 2000v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 2001#ifdef PROJECTION_GLOBE_VIEW 2002top_height+=u_height_lift; 2003#endif 2004gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 2005#endif 2006#ifdef LIGHTING_3D_MODE 2007#ifdef FLOOD_LIGHT 2008float 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; 2009#endif 2010v_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); 2011#else 2012v_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; 2013#endif 2014#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 2015float 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; 2016#endif 2017#ifdef FOG 2018v_fog_pos=fog_position(pos); 2019#endif 2020}`),fillExtrusionDepth:An(`in highp float v_depth;void main() { 2021#ifndef DEPTH_TEXTURE 2022glFragColor=pack_depth(v_depth); 2023#endif 2024}`,`#include "_prelude_terrain.vertex.glsl" 2025#include "_prelude_material_table.vertex.glsl" 2026uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 2027#ifdef TERRAIN 2028uniform int u_height_type;uniform int u_base_type; 2029#endif 2030in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; 2031#ifdef RENDER_WALL_MODE 2032in vec3 a_join_normal_inside; 2033#endif 2034#pragma mapbox: define highp float base 2035#pragma mapbox: define highp float height 2036#pragma mapbox: define highp float line_width 2037#pragma mapbox: define highp vec4 color 2038out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO 2039#pragma mapbox: initialize highp float base 2040#pragma mapbox: initialize highp float height 2041#pragma mapbox: initialize highp float line_width 2042#pragma mapbox: initialize highp vec4 color 2043base*=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); 2044#if defined(HAS_CENTROID) || defined(TERRAIN) 2045centroid_pos=a_centroid_pos; 2046#endif 2047vec3 pos; 2048#ifdef TERRAIN 2049bool 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); 2050#else 2051pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 2052#endif 2053#ifdef RENDER_WALL_MODE 2054vec2 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; 2055#endif 2056float 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:An(`#include "_prelude_fog.fragment.glsl" 2057#include "_prelude_lighting.glsl" 2058uniform vec2 u_texsize;uniform sampler2D u_image; 2059#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2060uniform float u_pattern_transition; 2061#endif 2062#ifdef FAUX_AO 2063uniform lowp vec2 u_ao;in vec3 v_ao; 2064#endif 2065#ifdef LIGHTING_3D_MODE 2066in vec3 v_normal; 2067#endif 2068#ifdef APPLY_LUT_ON_GPU 2069uniform highp sampler3D u_lutTexture; 2070#endif 2071in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 2072#pragma mapbox: define highp float base 2073#pragma mapbox: define highp float height 2074#pragma mapbox: define mediump vec4 pattern 2075#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2076#pragma mapbox: define mediump vec4 pattern_b 2077#endif 2078#pragma mapbox: define highp float pixel_ratio 2079void main() { 2080#pragma mapbox: initialize highp float base 2081#pragma mapbox: initialize highp float height 2082#pragma mapbox: initialize mediump vec4 pattern 2083#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2084#pragma mapbox: initialize mediump vec4 pattern_b 2085#endif 2086#pragma mapbox: initialize highp float pixel_ratio 2087vec2 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); 2088#ifdef APPLY_LUT_ON_GPU 2089out_color=applyLUT(u_lutTexture,out_color); 2090#endif 2091#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2092vec2 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; 2093#endif 2094#ifdef LIGHTING_3D_MODE 2095out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 2096#else 2097out_color=out_color*v_lighting; 2098#endif 2099#ifdef FAUX_AO 2100float 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
2100),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; 2101#endif 2102#ifdef FOG 2103out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 2104#endif 2105#ifdef INDICATOR_CUTOUT 2106out_color=applyCutout(out_color,height); 2107#endif 2108glFragColor=out_color; 2109#ifdef OVERDRAW_INSPECTOR 2110glFragColor=vec4(1.0); 2111#endif 2112HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2113#include "_prelude_terrain.vertex.glsl" 2114#include "_prelude_lighting.glsl" 2115#include "_prelude_material_table.vertex.glsl" 2116uniform 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; 2117#ifdef RENDER_WALL_MODE 2118in vec3 a_join_normal_inside; 2119#endif 2120#ifdef PROJECTION_GLOBE_VIEW 2121in 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; 2122#endif 2123#ifdef TERRAIN 2124uniform int u_height_type;uniform int u_base_type; 2125#endif 2126out highp vec2 v_pos;out vec4 v_lighting; 2127#ifdef FAUX_AO 2128uniform lowp vec2 u_ao;out vec3 v_ao; 2129#endif 2130#ifdef LIGHTING_3D_MODE 2131out vec3 v_normal; 2132#endif 2133#pragma mapbox: define highp float base 2134#pragma mapbox: define highp float height 2135#pragma mapbox: define highp vec4 color 2136#pragma mapbox: define mediump vec4 pattern 2137#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2138#pragma mapbox: define mediump vec4 pattern_b 2139#endif 2140#pragma mapbox: define highp float pixel_ratio 2141#pragma mapbox: define highp float line_width 2142void main() {DECLARE_MATERIAL_TABLE_INFO 2143#pragma mapbox: initialize highp float base 2144#pragma mapbox: initialize highp float height 2145#pragma mapbox: initialize highp vec4 color 2146#pragma mapbox: initialize mediump vec4 pattern 2147#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 2148#pragma mapbox: initialize mediump vec4 pattern_b 2149#endif 2150#pragma mapbox: initialize highp float pixel_ratio 2151#pragma mapbox: initialize highp float line_width 2152vec2 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); 2153#if defined(HAS_CENTROID) || defined(TERRAIN) 2154centroid_pos=a_centroid_pos; 2155#endif 2156float ele=0.0;float h=z;vec3 p;float c_ele; 2157#ifdef TERRAIN 2158bool 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); 2159#else 2160p=vec3(pos_nx.xy,z); 2161#endif 2162#ifdef PROJECTION_GLOBE_VIEW 2163float 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); 2164#endif 2165#ifdef RENDER_WALL_MODE 2166vec2 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; 2167#endif 2168float 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 2169? pos_nx.xy 2170: 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; 2171#ifdef LIGHTING_3D_MODE 2172NdotL=calculate_NdotL(normal); 2173#else 2174NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 2175#endif 2176if (normal.y !=0.0) {float r=0.84; 2177#ifndef LIGHTING_3D_MODE 2178r=mix(0.7,0.98,1.0-u_lightintensity); 2179#endif 2180NdotL*=( 2181(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 2182#ifdef FAUX_AO
2183float 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; 2184#ifdef TERRAIN 2185top_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); 2186#endif 2187v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); 2188#ifdef PROJECTION_GLOBE_VIEW 2189top_height+=u_height_lift; 2190#endif 2191gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 2192#endif 2193#ifdef LIGHTING_3D_MODE 2194v_normal=normal; 2195#else 2196v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 2197#endif 2198#ifdef FOG 2199v_fog_pos=fog_position(p); 2200#endif 2201}`),groundShadow:An(`#include "_prelude_shadow.fragment.glsl" 2202precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2203#ifdef FOG 2204in float v_fog_opacity; 2205#endif 2206void 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); 2207#ifdef RENDER_CUTOFF 2208shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 2209#endif 2210#ifdef FOG 2211shadow=mix(shadow,vec3(1.0),v_fog_opacity); 2212#endif 2213#ifdef INDICATOR_CUTOUT 2214shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 2215#endif 2216glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 2217uniform 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; 2218#ifdef FOG 2219out float v_fog_opacity; 2220#endif 2221void 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); 2222#ifdef FOG 2223v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); 2224#endif 2225}`),fillExtrusionGroundEffect:An(`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; 2226#ifdef SDF_SUBPASS 2227in 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);} 2228#ifdef FOG 2229in highp float v_fog; 2230#endif 2231#endif 2232void main() { 2233#ifdef CLEAR_SUBPASS 2234vec4 color=vec4(1.0); 2235#ifdef CLEAR_FROM_TEXTURE 2236color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 2237#endif 2238glFragColor=color; 2239#else 2240#ifdef SDF_SUBPASS 2241highp 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; 2242#ifdef FOG 2243fog=v_fog; 2244#endif 2245#ifdef RENDER_CUTOFF 2246fog*=v_cutoff_opacity; 2247#endif 2248glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 2249#else 2250vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 2251#ifdef OVERDRAW_INSPECTOR 2252color=vec4(1.0); 2253#endif 2254glFragColor=color; 2255#endif 2256HANDLE_WIREFRAME_DEBUG; 2257#endif 2258}`,`#include "_prelude_fog.vertex.glsl" 2259in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; 2260#ifdef SDF_SUBPASS 2261out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 2262#ifdef FOG 2263out highp float v_fog; 2264#endif 2265#endif 2266uniform 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; 2267#pragma mapbox: define highp float flood_light_ground_radius 2268const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
2269#pragma mapbox: initialize highp float flood_light_ground_radius 2270vec2 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; 2271#ifdef SDF_SUBPASS 2272v_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); 2273#ifdef FOG 2274v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 2275#endif 2276#endif 2277float hidden_by_landmark=0.0; 2278#ifdef HAS_CENTROID 2279hidden_by_landmark=a_hidden_by_landmark; 2280#endif 2281float 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)); 2282#ifdef RENDER_CUTOFF 2283v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2284#endif 2285}`),hillshadePrepare:An(`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( 2286(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 2287)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 2288deriv.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:An(`#include "_prelude_fog.fragment.glsl" 2289#include "_prelude_lighting.glsl" 2290uniform 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; 2291#ifdef LIGHTING_3D_MODE 2292glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 2293#endif 2294#ifdef FOG 2295glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 2296#endif 2297#ifdef OVERDRAW_INSPECTOR 2298glFragColor=vec4(1.0); 2299#endif 2300HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2301uniform 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; 2302#ifdef FOG 2303v_fog_pos=fog_position(a_pos); 2304#endif 2305}`),line:An(`#include "_prelude_fog.fragment.glsl" 2306#include "_prelude_lighting.glsl" 2307#include "_prelude_shadow.fragment.glsl" 2308uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
2308uniform 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; 2309#ifdef ELEVATED_ROADS 2310in highp float v_road_z_offset; 2311#endif 2312#ifdef RENDER_LINE_DASH 2313uniform sampler2D u_dash_image;in vec2 v_tex; 2314#endif 2315#ifdef RENDER_LINE_GRADIENT 2316uniform sampler2D u_gradient_image; 2317#endif 2318#ifdef INDICATOR_CUTOUT 2319in highp float v_z_offset; 2320#endif 2321#ifdef RENDER_SHADOWS 2322uniform 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; 2323#endif 2324float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength; 2325#pragma mapbox: define highp vec4 color 2326#pragma mapbox: define lowp float floorwidth 2327#pragma mapbox: define lowp vec4 dash 2328#pragma mapbox: define lowp float blur 2329#pragma mapbox: define lowp float opacity 2330#pragma mapbox: define lowp float border_width 2331#pragma mapbox: define lowp vec4 border_color 2332float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 2333#pragma mapbox: initialize highp vec4 color 2334#pragma mapbox: initialize lowp float floorwidth 2335#pragma mapbox: initialize lowp vec4 dash 2336#pragma mapbox: initialize lowp float blur 2337#pragma mapbox: initialize lowp float opacity 2338#pragma mapbox: initialize lowp float border_width 2339#pragma mapbox: initialize lowp vec4 border_color 2340float 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); 2341#ifdef RENDER_LINE_DASH 2342float sdfdist=texture(u_dash_image,v_tex).r;
2342float 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); 2343#endif 2344highp vec4 out_color; 2345#ifdef RENDER_LINE_GRADIENT 2346out_color=texture(u_gradient_image,v_uv.xy); 2347#else 2348out_color=color; 2349#endif 2350float trim_alpha=1.0; 2351#ifdef RENDER_LINE_TRIM_OFFSET 2352highp 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;} 2353#endif 2354if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 2355#ifdef RENDER_LINE_BORDER 2356float 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);}} 2357#endif 2358#ifdef LIGHTING_3D_MODE 2359out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 2360#ifdef RENDER_SHADOWS 2361float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 2362#ifdef ELEVATED_ROADS 2363out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2364#else 2365out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2366#endif 2367#endif 2368#endif 2369#ifdef FOG 2370out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 2371#endif 2372out_color*=(alpha*opacity); 2373#ifdef INDICATOR_CUTOUT 2374out_color=applyCutout(out_color,v_z_offset); 2375#endif 2376#ifdef FEATURE_CUTOUT 2377out_color=apply_feature_cutout(out_color,gl_FragCoord); 2378#endif 2379glFragColor=out_color; 2380#ifdef OVERDRAW_INSPECTOR 2381glFragColor=vec4(1.0); 2382#endif 2383HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2384#include "_prelude_shadow.vertex.glsl" 2385#include "_prelude_terrain.vertex.glsl" 2386#define EXTRUDE_SCALE 0.015873016 2387in vec2 a_pos_normal;in vec4 a_data; 2388#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 2389in vec3 a_z_offset_width; 2390#endif 2391#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 2392in highp vec3 a_packed; 2393#endif 2394#ifdef RENDER_LINE_DASH 2395in float a_linesofar; 2396#endif 2397uniform 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; 2398#ifdef ELEVATED 2399uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 2400#ifdef ELEVATION_REFERENCE_SEA 2401return 0.0; 2402#else 2403return elevation(apos); 2404#endif 2405} 2406#endif 2407out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; 2408#ifdef ELEVATED_ROADS 2409out highp float v_road_z_offset; 2410#endif 2411#ifdef RENDER_LINE_DASH 2412uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 2413#endif 2414#ifdef RENDER_LINE_GRADIENT 2415uniform float u_image_height; 2416#endif 2417#ifdef INDICATOR_CUTOUT 2418out highp float v_z_offset; 2419#endif 2420#ifdef RENDER_SHADOWS 2421uniform 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; 2422#endif 2423#pragma mapbox: define highp vec4 color 2424#pragma mapbox: define lowp float floorwidth 2425#pragma mapbox: define lowp vec4 dash 2426#pragma mapbox: define lowp float blur 2427#pragma mapbox: define lowp float opacity 2428#pragma mapbox: define mediump float gapwidth 2429#pragma mapbox: define lowp float offset 2430#pragma mapbox: define mediump float width 2431#pragma mapbox: define lowp float border_width 2432#pragma mapbox: define lowp vec4 border_color 2433void main() { 2434#pragma mapbox: initialize highp vec4 color 2435#pragma mapbox: initialize lowp float floorwidth 2436#pragma mapbox: initialize lowp vec4 dash 2437#pragma mapbox: initialize lowp float blur 2438#pragma mapbox: initialize lowp float opacity 2439#pragma mapbox: initialize mediump float gapwidth 2440#pragma mapbox: initialize lowp float offset 2441#pragma mapbox: initialize mediump float width 2442#pragma mapbox: initialize lowp float border_width 2443#pragma mapbox: initialize lowp vec4 border_color 2444float a_z_offset; 2445#if defined(ELEVATED) || defined(ELEVATED_ROADS) 2446a_z_offset=a_z_offset_width.x; 2447#endif 2448float 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; 2449#ifdef VARIABLE_LINE_WIDTH 2450float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0; 2451#else 2452halfwidth=(u_width_scale*width)/2.0; 2453#endif 2454offset=-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;
2454vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 2455#ifdef ELEVATED_ROADS 2456v_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; 2457#else 2458#ifdef ELEVATED 2459vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 2460#ifdef CROSS_SLOPE_VERTICAL 2461float 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); 2462#else 2463#ifdef CROSS_SLOPE_HORIZONTAL 2464float 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; 2465#else 2466float 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; 2467#endif 2468#endif 2469gl_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); 2470#else 2471gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 2472#endif 2473#endif 2474#ifdef ELEVATED_ROADS 2475#ifdef RENDER_SHADOWS 2476vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 2477#ifdef NORMAL_OFFSET 2478vec3 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(); 2479#endif 2480v_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; 2481#endif 2482#endif 2483#ifndef RENDER_TO_TEXTURE 2484float 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)); 2485#else 2486v_gamma_scale=1.0; 2487#endif 2488#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 2489highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; 2490#ifdef RENDER_LINE_GRADIENT 2491highp 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); 2492#else 2493v_uv=vec3(a_uv_x,0.0,line_progress); 2494#endif 2495#endif 2496#ifdef RENDER_LINE_DASH 2497float 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); 2498#endif 2499v_width2=vec2(outset,inset); 2500#ifdef FOG 2501v_fog_pos=fog_position(pos); 2502#endif 2503#ifdef INDICATOR_CUTOUT 2504v_z_offset=a_z_offset; 2505#endif 2506}`),linePattern:An(`#include "_prelude_fog.fragment.glsl" 2507#include "_prelude_lighting.glsl" 2508#include "_prelude_shadow.fragment.glsl" 2509uniform 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; 2510#ifdef APPLY_LUT_ON_GPU 2511uniform highp sampler3D u_lutTexture; 2512#endif 2513#ifdef LINE_PATTERN_TRANSITION 2514uniform float u_pattern_transition; 2515#endif 2516in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 2517#ifdef RENDER_LINE_TRIM_OFFSET 2518in highp vec3 v_uv; 2519#endif 2520#ifdef ELEVATED_ROADS 2521in highp float v_road_z_offset; 2522#endif 2523#ifdef LINE_JOIN_NONE 2524in vec2 v_pattern_data; 2525#endif 2526#ifdef INDICATOR_CUTOUT 2527in highp float v_z_offset; 2528#endif 2529#ifdef RENDER_SHADOWS 2530uniform 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; 2531#endif 2532uniform float u_emissive_strength; 2533#pragma mapbox: define mediump vec4 pattern 2534#ifdef LINE_PATTERN_TRANSITION 2535#pragma mapbox: define mediump vec4 pattern_b 2536#endif 2537#pragma mapbox: define mediump float pixel_ratio 2538#pragma mapbox: define mediump float blur 2539#pragma mapbox: define mediump float opacity 2540void main() { 2541#pragma mapbox: initialize mediump vec4 pattern 2542#ifdef LINE_PATTERN_TRANSITION 2543#pragma mapbox: initialize mediump vec4 pattern_b 2544#endif 2545#pragma mapbox: initialize mediump float pixel_ratio 2546#pragma mapbox: initialize mediump float blur 2547#pragma mapbox: initialize mediump float opacity 2548vec2 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); 2549#ifdef APPLY_LUT_ON_GPU 2550color=applyLUT(u_lutTexture,color); 2551#endif 2552#ifdef LINE_PATTERN_TRANSITION 2553vec2 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; 2554#endif 2555#ifdef RENDER_LINE_TRIM_OFFSET 2556highp 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);} 2557#endif 2558#ifdef LINE_JOIN_NONE 2559highp 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);} 2560#endif 2561#ifdef LIGHTING_3D_MODE 2562color=apply_lighting_with_emission_ground(color,u_emissive_strength); 2563#ifdef RENDER_SHADOWS 2564float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 2565#ifdef ELEVATED_ROADS 2566color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2567#else 2568color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2569#endif 2570#endif 2571#endif 2572#ifdef FOG 2573color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2574#endif 2575color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 2576#ifdef INDICATOR_CUTOUT 2577color=applyCutout(color,v_z_offset); 2578#endif 2579glFragColor=color; 2580#ifdef OVERDRAW_INSPECTOR 2581glFragColor=vec4(1.0); 2582#endif 2583HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2584#include "_prelude_shadow.vertex.glsl" 2585#include "_prelude_terrain.vertex.glsl" 2586#define scale 0.015873016 2587in vec2 a_pos_normal;in vec4 a_data; 2588#if defined(ELEVATED) || defined(ELEVATED_ROADS) 2589in vec3 a_z_offset_width; 2590#endif 2591#ifdef RENDER_LINE_TRIM_OFFSET 2592in highp vec3 a_packed; 2593#endif 2594in highp float a_linesofar; 2595#ifdef LINE_JOIN_NONE 2596in highp vec3 a_pattern_data;out vec2 v_pattern_data; 2597#endif 2598#ifdef INDICATOR_CUTOUT 2599out highp float v_z_offset; 2600#endif 2601uniform 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; 2602#ifdef ELEVATED 2603uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 2604#ifdef ELEVATION_REFERENCE_SEA 2605return 0.0; 2606#else 2607return elevation(apos); 2608#endif 2609} 2610#endif 2611out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 2612#ifdef RENDER_LINE_TRIM_OFFSET 2613out highp vec3 v_uv; 2614#endif 2615#ifdef ELEVATED_ROADS 2616out highp float v_road_z_offset; 2617#endif 2618#ifdef RENDER_SHADOWS 2619uniform 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; 2620#endif 2621#pragma mapbox: define mediump float blur 2622#pragma mapbox: define mediump float opacity 2623#pragma mapbox: define mediump float offset 2624#pragma mapbox: define mediump float gapwidth 2625#pragma mapbox: define mediump float width 2626#pragma mapbox: define mediump float floorwidth 2627#pragma mapbox: define mediump vec4 pattern 2628#ifdef LINE_PATTERN_TRANSITION 2629#pragma mapbox: define mediump vec4 pattern_b 2630#endif 2631#pragma mapbox: define mediump float pixel_ratio 2632void main() { 2633#pragma mapbox: initialize mediump float blur 2634#pragma mapbox: initialize mediump float opacity 2635#pragma mapbox: initialize mediump float offset 2636#pragma mapbox: initialize mediump float gapwidth 2637#pragma mapbox: initialize mediump float width 2638#pragma mapbox: initialize mediump float floorwidth 2639#pragma mapbox: initialize mediump vec4 pattern 2640#ifdef LINE_PATTERN_TRANSITION 2641#pragma mapbox: initialize mediump vec4 pattern_b 2642#endif 2643#pragma mapbox: initialize mediump float pixel_ratio 2644float a_z_offset; 2645#if defined(ELEVATED) || defined(ELEVATED_ROADS) 2646a_z_offset=a_z_offset_width.x; 2647#endif 2648float 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;
2648vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 2649#ifdef ELEVATED_ROADS 2650v_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; 2651#else 2652#ifdef ELEVATED 2653vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; 2654#ifdef CROSS_SLOPE_VERTICAL 2655float 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); 2656#else 2657#ifdef CROSS_SLOPE_HORIZONTAL 2658float 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; 2659#else 2660float 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; 2661#endif 2662#endif 2663gl_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); 2664#else 2665gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 2666#endif 2667#endif 2668#ifdef ELEVATED_ROADS 2669#ifdef RENDER_SHADOWS 2670vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 2671#ifdef NORMAL_OFFSET 2672vec3 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(); 2673#endif 2674v_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; 2675#endif 2676#endif 2677#ifndef RENDER_TO_TEXTURE 2678float 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)); 2679#else 2680v_gamma_scale=1.0; 2681#endif 2682#ifdef RENDER_LINE_TRIM_OFFSET 2683highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 2684#endif 2685v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 2686#ifdef LINE_JOIN_NONE 2687v_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); 2688#endif 2689#ifdef FOG 2690v_fog_pos=fog_position(pos); 2691#endif 2692#ifdef INDICATOR_CUTOUT 2693v_z_offset=a_z_offset; 2694#endif 2695}`),raster:An(`#include "_prelude_fog.fragment.glsl" 2696#include "_prelude_lighting.glsl" 2697#include "_prelude_raster_array.glsl" 2698uniform 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; 2699#ifdef PROJECTION_GLOBE_VIEW 2700in float v_split_fade; 2701#endif 2702uniform 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; 2703#ifndef RASTER_ARRAY 2704uniform highp sampler2D u_image0;uniform sampler2D u_image1; 2705#endif 2706#ifdef RASTER_COLOR 2707uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 2708#endif 2709void main() {vec4 color0,color1,color;vec2 value; 2710#ifdef RASTER_COLOR 2711#ifdef RASTER_ARRAY 2712#ifdef RASTER_ARRAY_LINEAR 2713value=mix( 2714raTexture2D_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 2715); 2716#else 2717value=mix( 2718raTexture2D_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 2719); 2720#endif 2721if (value.y > 0.0) value.x/=value.y; 2722#else 2723color=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); 2724#endif 2725color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 2726#else 2727color0=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); 2728#endif 2729color.a*=u_opacity; 2730#ifdef GLOBE_POLES 2731color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 2732#endif 2733vec3 rgb=color.rgb;rgb=vec3( 2734dot(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); 2735#ifdef LIGHTING_3D_MODE 2736out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 2737#endif 2738#ifdef FOG 2739highp 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)); 2740#endif 2741glFragColor=vec4(out_color*color.a,color.a); 2742#ifdef PROJECTION_GLOBE_VIEW 2743glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 2744#endif 2745#ifdef RENDER_CUTOFF 2746glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 2747#endif 2748#ifdef OVERDRAW_INSPECTOR 2749glFragColor=vec4(1.0); 2750#endif 2751HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2752uniform 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; 2753#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2754#ifdef GLOBE_POLES 2755in vec3 a_globe_pos;in vec2 a_uv; 2756#else 2757in vec2 a_pos;in vec2 a_texture_pos; 2758#endif 2759out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 2760#ifdef PROJECTION_GLOBE_VIEW 2761out float v_split_fade; 2762#endif 2763void main() {vec2 uv; 2764#ifdef GLOBE_POLES 2765vec3 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; 2766#ifdef FOG 2767v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 2768#endif 2769#else 2770float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; 2771#ifdef PROJECTION_GLOBE_VIEW 2772vec3 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]); 2773v_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];
2773if (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; 2774#ifdef FOG 2775v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2776#endif 2777#else 2778gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2779#ifdef FOG 2780v_fog_pos=fog_position(a_pos); 2781#endif 2782#endif 2783#endif 2784v_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; 2785#ifdef RENDER_CUTOFF 2786v_depth=gl_Position.z; 2787#endif 2788}`),rasterParticle:An(`#include "_prelude_fog.fragment.glsl" 2789#include "_prelude_lighting.glsl" 2790uniform 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; 2791#ifdef LIGHTING_3D_MODE 2792out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; 2793#endif 2794#ifdef FOG 2795highp 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)); 2796#endif 2797glFragColor=vec4(out_color*color.a,color.a); 2798#ifdef OVERDRAW_INSPECTOR 2799glFragColor=vec4(1.0); 2800#endif 2801HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2802uniform 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; 2803#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2804in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 2805#ifdef PROJECTION_GLOBE_VIEW 2806vec3 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; 2807#ifdef FOG 2808v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2809#endif 2810#else 2811uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); 2812#ifdef FOG 2813v_fog_pos=fog_position(a_pos); 2814#endif 2815#endif 2816v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:An("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" 2817in 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( 2818mod(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:An("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:An(`#include "_prelude_raster_particle.glsl" 2819uniform 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;
2819vec2 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( 2820linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 2821);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:An(`#include "_prelude_lighting.glsl" 2822#include "_prelude_shadow.fragment.glsl" 2823#define SDF_PX 8.0 2824#define SDF 1.0 2825#define ICON 0.0 2826uniform 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; 2827#ifdef ICON_TRANSITION 2828uniform float u_icon_transition; 2829#endif 2830#ifdef COLOR_ADJUSTMENT 2831uniform mat4 u_color_adj_mat; 2832#endif 2833#ifdef INDICATOR_CUTOUT 2834in highp float v_z_offset; 2835#else 2836#ifdef RENDER_SHADOWS 2837in highp float v_z_offset; 2838#endif 2839#endif 2840in vec2 v_tex_a; 2841#ifdef ICON_TRANSITION 2842in vec2 v_tex_b; 2843#endif 2844in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 2845#ifdef RENDER_TEXT_AND_SYMBOL 2846in float is_sdf;in vec2 v_tex_a_icon; 2847#endif 2848#ifdef RENDER_SHADOWS 2849uniform 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; 2850#endif 2851#ifdef APPLY_LUT_ON_GPU 2852uniform highp sampler3D u_lutTexture; 2853#endif 2854#pragma mapbox: define highp vec4 fill_color 2855#pragma mapbox: define highp vec4 halo_color 2856#pragma mapbox: define lowp float opacity 2857#pragma mapbox: define lowp float halo_width 2858#pragma mapbox: define lowp float halo_blur 2859#pragma mapbox: define lowp float emissive_strength 2860void main() { 2861#pragma mapbox: initialize highp vec4 fill_color 2862#pragma mapbox: initialize highp vec4 halo_color 2863#pragma mapbox: initialize lowp float opacity 2864#pragma mapbox: initialize lowp float halo_width 2865#pragma mapbox: initialize lowp float halo_blur 2866#pragma mapbox: initialize lowp float emissive_strength 2867vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 2868#ifdef RENDER_TEXT_AND_SYMBOL 2869if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; 2870#ifdef OVERDRAW_INSPECTOR 2871glFragColor=vec4(1.0); 2872#endif 2873return;} 2874#endif 2875#ifdef RENDER_SDF 2876float 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; 2877#else 2878#ifdef ICON_TRANSITION 2879vec4 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); 2880#else 2881out_color=texture(u_texture,v_tex_a); 2882#endif 2883#ifdef APPLY_LUT_ON_GPU 2884out_color=applyLUT(u_lutTexture,out_color); 2885#endif 2886#ifdef COLOR_ADJUSTMENT 2887out_color=u_color_adj_mat*out_color; 2888#endif 2889#endif 2890out_color*=opacity*fade_opacity; 2891#ifdef LIGHTING_3D_MODE 2892out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 2893#ifdef RENDER_SHADOWS 2894float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 2895#ifdef TERRAIN 2896out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2897#else 2898out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2899#endif 2900#endif 2901#endif 2902#ifdef INDICATOR_CUTOUT 2903out_color=applyCutout(out_color,v_z_offset); 2904#endif 2905#ifdef FEATURE_CUTOUT 2906out_color=apply_feature_cutout(out_color,gl_FragCoord); 2907#endif 2908glFragColor=out_color; 2909#ifdef OVERDRAW_INSPECTOR 2910glFragColor=vec4(1.0); 2911#endif 2912HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 2913#include "_prelude_shadow.vertex.glsl" 2914#define APPEARANCE_ICON 1.0 2915in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; 2916#ifdef Z_OFFSET 2917in float a_auto_z_offset; 2918#endif 2919#ifdef PROJECTION_GLOBE_VIEW 2920in vec3 a_globe_anchor;in vec3 a_globe_normal; 2921#endif 2922#ifdef ICON_TRANSITION 2923in vec2 a_texb; 2924#endif 2925#ifdef OCCLUSION_QUERIES 2926in float a_occlusion_query_opacity; 2927#endif 2928#ifdef ELEVATED_ROADS 2929in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2930#endif 2931#ifdef INDICATOR_CUTOUT 2932out highp float v_z_offset; 2933#else 2934#ifdef RENDER_SHADOWS 2935out highp float v_z_offset; 2936#endif 2937#endif 2938uniform 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; 2939#ifdef PROJECTION_GLOBE_VIEW 2940uniform 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; 2941#endif 2942out vec2 v_tex_a; 2943#ifdef ICON_TRANSITION 2944out vec2 v_tex_b; 2945#endif 2946out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2947#ifdef RENDER_TEXT_AND_SYMBOL 2948out float is_sdf;out vec2 v_tex_a_icon; 2949#endif 2950#ifdef RENDER_SHADOWS 2951uniform 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; 2952#endif 2953#pragma mapbox: define highp vec4 fill_color 2954#pragma mapbox: define highp vec4 halo_color 2955#pragma mapbox: define lowp float opacity 2956#pragma mapbox: define lowp float halo_width 2957#pragma mapbox: define lowp float halo_blur 2958#pragma mapbox: define lowp float emissive_strength 2959#pragma mapbox: define lowp float occlusion_opacity 2960#pragma mapbox: define lowp float z_offset 2961void main() { 2962#pragma mapbox: initialize highp vec4 fill_color 2963#pragma mapbox: initialize highp vec4 halo_color 2964#pragma mapbox: initialize lowp float opacity 2965#pragma mapbox: initialize lowp float halo_width 2966#pragma mapbox: initialize lowp float halo_blur 2967#pragma mapbox: initialize lowp float emissive_strength 2968#pragma mapbox: initialize lowp float occlusion_opacity 2969#pragma mapbox: initialize lowp float z_offset 2970vec2 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); 2971#ifdef Z_OFFSET 2972e+=a_auto_z_offset; 2973#endif 2974vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2975#ifdef PROJECTION_GLOBE_VIEW 2976mercator_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; 2977#else 2978world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2979#endif 2980vec4 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 ? 2981camera_to_anchor_distance/u_camera_to_center_distance : 2982u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 29830.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; 2984#ifdef PROJECTION_GLOBE_VIEW 2985vec3 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; 2986#else 2987offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2988#endif 2989vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2990#ifdef PROJECTION_GLOBE_VIEW 2991#ifdef PROJECTED_POS_ON_VIEWPORT 2992projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2993#else 2994vec3 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); 2995#endif 2996#else 2997projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2998#endif 2999highp 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); 3000#ifdef TERRAIN 3001#ifdef PITCH_WITH_MAP_TERRAIN 3002vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 3003#endif 3004#endif 3005#ifdef Z_OFFSET 3006z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 3007#else 3008z+=u_pitch_with_map ? z_offset : 0.0; 3009#endif 3010float 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)); 3011#ifdef DEPTH_OCCLUSION 3012float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 3013#endif 3014#ifdef OCCLUSION_QUERIES 3015float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 3016#endif 3017#ifdef Z_TEST_OCCLUSION 3018out_fade_opacity*=occlusion_opacity; 3019#endif 3020float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 3021#ifdef PROJECTION_GLOBE_VIEW 3022vec3 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; 3023#else 3024#ifdef ELEVATED_ROADS 3025vec3 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; 3026#else 3027pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 3028#endif 3029#endif 3030gl_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; 3031#ifdef RENDER_TEXT_AND_SYMBOL 3032is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 3033#endif 3034#ifdef ICON_TRANSITION 3035v_tex_b=a_texb/u_texsize; 3036#endif 3037#ifdef RENDER_SHADOWS 3038vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 3039#ifdef NORMAL_OFFSET 3040vec3 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(); 3041#endif 3042v_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; 3043#endif 3044#ifdef INDICATOR_CUTOUT 3045v_z_offset=e; 3046#else 3047#ifdef RENDER_SHADOWS 3048v_z_offset=e; 3049#endif 3050#endif 3051}`),terrainRaster:An(`#include "_prelude_fog.fragment.glsl" 3052#include "_prelude_shadow.fragment.glsl" 3053#include "_prelude_lighting.glsl" 3054uniform sampler2D u_image0;in vec2 v_pos0; 3055#ifdef FOG 3056in float v_fog_opacity; 3057#endif 3058#ifdef RENDER_SHADOWS 3059in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 3060#endif 3061uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 3062#ifdef LIGHTING_3D_MODE 3063const vec3 normal=vec3(0.0,0.0,1.0); 3064#ifdef RENDER_SHADOWS 3065float cutoffOpacity=1.0; 3066#ifdef RENDER_CUTOFF 3067cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 3068#endif 3069#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 3070vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;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; 3071#else 3072float 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)); 3073#endif 3074#else 3075float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 3076#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 3077color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0; 3078#endif 3079#endif 3080#else 3081color=image_color; 3082#endif 3083#ifdef FOG 3084#ifdef ZERO_EXAGGERATION 3085color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 3086#else 3087color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 3088#endif 3089#endif 3090glFragColor=color; 3091#ifdef OVERDRAW_INSPECTOR 3092glFragColor=vec4(1.0); 3093#endif 3094HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3095#include "_prelude_terrain.vertex.glsl" 3096uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; 3097#ifdef FOG 3098out float v_fog_opacity; 3099#endif 3100#ifdef RENDER_SHADOWS 3101uniform 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; 3102#endif 3103void 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); 3104#ifdef FOG 3105#ifdef ZERO_EXAGGERATION 3106v_fog_pos=fog_position(decodedPos); 3107#else 3108v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 3109#endif 3110#endif 3111#ifdef RENDER_SHADOWS 3112vec3 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.); 3113#endif 3114}`),terrainDepth:An("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_ter
3114rain.vertex.glsl" 3115uniform 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:An(`#include "_prelude_fog.fragment.glsl" 3116in 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( 3117cos_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; 3118#ifdef FOG 3119sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 3120#endif 3121sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 3122#ifdef OVERDRAW_INSPECTOR 3123glFragColor=vec4(1.0); 3124#endif 3125}`,Tf),skyboxGradient:An(`#include "_prelude_fog.fragment.glsl" 3126in 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)); 3127#ifdef FOG 3128color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 3129#endif 3130color*=u_opacity;glFragColor=color; 3131#ifdef OVERDRAW_INSPECTOR 3132glFragColor=vec4(1.0); 3133#endif 3134}`,Tf),skyboxCapture:An
vendor: 3,792 bytes, lines 3134-3145
3134(` 3135in 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; 3136#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 3137#define BETA_M vec3(21e-6,21e-6,21e-6) 3138#define MIE_G 0.76 3139#define DENSITY_HEIGHT_SCALE_R 8000.0 3140#define DENSITY_HEIGHT_SCALE_M 1200.0 3141#define PLANET_RADIUS 6360e3 3142#define ATMOSPHERE_RADIUS 6420e3 3143#define SAMPLE_STEPS 10 3144#define DENSITY_STEPS 4 3145float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
3145Raster:An(`#include "_prelude_fog.fragment.glsl" 3146#include "_prelude_lighting.glsl" 3147uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0; 3148#ifndef FOG 3149uniform 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; 3150#endif 3151void main() {vec4 color; 3152#ifdef CUSTOM_ANTIALIASING 3153highp vec2 uv=gl_FragCoord.xy/u_viewport; 3154#ifdef FLIP_Y 3155uv.y=1.0-uv.y; 3156#endif 3157highp vec3 ray_dir=mix( 3158mix(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); 3159#ifdef LIGHTING_3D_MODE 3160#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 3161raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 3162#else 3163raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 3164#endif 3165#else 3166color=vec4(raster.rgb*antialias,raster.a*antialias); 3167#endif 3168#else 3169color=texture(u_image0,v_pos0); 3170#ifdef LIGHTING_3D_MODE 3171#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 3172color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0; 3173#else 3174color=apply_lighting_ground(color); 3175#endif 3176#endif 3177#endif 3178#ifdef FOG 3179color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 3180#endif 3181color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 3182#ifdef OVERDRAW_INSPECTOR 3183glFragColor=vec4(1.0); 3184#endif 3185HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3186#include "_prelude_terrain.vertex.glsl" 3187uniform 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; 3188#ifdef GLOBE_POLES 3189in vec3 a_globe_pos;in vec2 a_uv; 3190#else 3191in vec2 a_pos; 3192#endif 3193out vec2 v_pos0;void main() { 3194#ifdef GLOBE_POLES 3195vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 3196#else 3197float 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); 3198#endif 3199v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 3200#ifdef GLOBE_POLES 3201vec3 up_vector=globe_derived_up_vector; 3202#else 3203vec3 up_vector=elevationVector(tile_pos); 3204#endif 3205float height=elevation(tile_pos);globe_pos+=up_vector*height; 3206#ifndef GLOBE_POLES 3207globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 3208#endif 3209#ifdef GLOBE_POLES 3210vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 3211#else 3212vec4 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); 3213#endif 3214gl_Position=u_proj_matrix*interpolated_pos; 3215#ifdef FOG 3216v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 3217#endif 3218}`),globeAtmosphere:An(`#include "_prelude_fog.fragment.glsl" 3219uniform 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; 3220#ifdef PROJECTION_GLOBE_VIEW 3221globe_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) { 3222#ifdef ALPHA_PASS 3223glFragColor=vec4(0,0,0,0);return; 3224#else 3225#ifdef NATIVE 3226glFragColor=vec4(1,1,1,1); 3227#else 3228glFragColor=vec4(0,0,0,1); 3229#endif 3230return; 3231#endif 3232} 3233#endif 3234highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 32350.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 3236#ifdef PROJECTION_GLOBE_VIEW 3237highp 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 ? 3238PI-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); 3239#else 3240horizon_angle=horizon_angle_mercator; 3241#endif 3242horizon_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;
3242vec3 color_stop_2=u_space_color.rgb; 3243#ifdef ALPHA_PASS 3244float 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); 3245#else 3246vec3 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); 3247#endif 3248}`,`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( 3249mix(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( 3250mix(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:An(`#include "_prelude_fog.fragment.glsl" 3251#include "_prelude_shadow.fragment.glsl" 3252#include "_prelude_lighting.glsl" 3253uniform 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; 3254#ifdef RENDER_SHADOWS 3255in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 3256#endif 3257#ifdef OCCLUSION_TEXTURE_TRANSFORM 3258uniform vec4 u_occlusionTextureTransform; 3259#endif 3260#pragma mapbox: define-attribute highp vec3 normal_3f 3261#pragma mapbox: define-attribute highp vec3 color_3f 3262#pragma mapbox: define-attribute highp vec4 color_4f 3263#pragma mapbox: define-attribute highp vec2 uv_2f 3264#pragma mapbox: initialize-attribute highp vec3 normal_3f 3265#pragma mapbox: initialize-attribute highp vec3 color_3f 3266#pragma mapbox: initialize-attribute highp vec4 color_4f 3267#pragma mapbox: initialize-attribute highp vec2 uv_2f 3268#ifdef HAS_ATTRIBUTE_a_pbr 3269in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 3270#endif 3271#ifdef HAS_TEXTURE_u_baseColorTexture 3272uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 3273#endif 3274#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 3275uniform sampler2D u_metallicRoughnessTexture; 3276#endif 3277#ifdef HAS_TEXTURE_u_occlusionTexture 3278uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 3279#endif 3280#ifdef HAS_TEXTURE_u_normalTexture 3281uniform sampler2D u_normalTexture; 3282#endif 3283#ifdef HAS_TEXTURE_u_emissionTexture 3284uniform sampler2D u_emissionTexture; 3285#endif 3286#ifdef APPLY_LUT_ON_GPU 3287uniform highp sampler3D u_lutTexture; 3288#endif 3289#ifdef TERRAIN_FRAGMENT_OCCLUSION 3290in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 3291#ifdef DEPTH_D24 3292highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 3293#else 3294highp float unpack_depth_rgba(highp vec4 rgba_depth) 3295{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;} 3296#endif 3297bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 3298#ifdef FLIP_Y 3299coord.y=1.0-coord.y; 3300#endif 3301#ifdef DEPTH_D24 3302highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 3303#else 3304highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 3305#endif 3306return v_depth > depth+0.0005;} 3307#endif 3308#define saturate(_x) clamp(_x,0.,1.) 3309vec3 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) 3310{ 3311#ifdef LIGHTING_3D_MODE 3312vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 3313#ifdef RENDER_SHADOWS 3314lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 3315#else 3316lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 3317#endif 3318return apply_lighting(albedo,transformed_normal,lighting_factor); 3319#else 3320vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
3320Color),vec3(1.0));return c3; 3321#endif 3322}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 3323#ifdef HAS_ATTRIBUTE_a_color_3f 3324albedo*=vec4(color_3f,1.0); 3325#endif 3326#ifdef HAS_ATTRIBUTE_a_pbr 3327#else 3328#ifdef HAS_ATTRIBUTE_a_color_4f 3329albedo*=color_4f; 3330#endif 3331#endif 3332#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 3333vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 3334#ifdef UNPREMULT_TEXTURE_IN_SHADER 3335if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; 3336#endif 3337if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 3338#endif 3339vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 3340#ifdef APPLY_LUT_ON_GPU 3341color=applyLUT(u_lutTexture,color); 3342#endif 3343return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 3344#ifdef HAS_TEXTURE_u_normalTexture 3345highp 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; 3346#ifdef FLIP_Y 3347T=-T;B=-B; 3348#endif 3349highp 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; 3350#else 3351return mat3(1.0); 3352#endif 3353}highp vec3 getNormal(){highp vec3 n; 3354#ifdef HAS_ATTRIBUTE_a_normal_3f 3355n=normalize(normal_3f); 3356#else 3357highp 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)); 3358#ifdef FLIP_Y 3359n=normalize(cross(fdx,fdy)); 3360#else 3361n=normalize(cross(fdx,fdy))*-1.0; 3362#endif 3363#endif 3364#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 3365vec3 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); 3366#endif 3367return 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; 3368#ifdef HAS_ATTRIBUTE_a_pbr 3369mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 3370#endif 3371#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 3372vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 3373#endif 3374const 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) 3375{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) 3376{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 3377{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) 3378{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) 3379{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) 3380{ 3381#ifdef LIGHTING_3D_MODE 3382return mat.diffuseColor; 3383#else 3384return mat.diffuseColor/PI; 3385#endif 3386}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 3387{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) 3388{vec3 env_light=vec3(0.65,0.65,0.65); 3389#ifdef LIGHTING_3D_MODE 3390float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 3391#endif 3392vec3 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) 3393{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; 3394#ifdef RENDER_SHADOWS 3395lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 3396#else 3397lighting_factor=NdotL; 3398#endif 3399vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
3399Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 3400#if !defined(LIGHTING_3D_MODE) 3401const 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); 3402#endif 3403color*=intensityFactor;return color;}void main() { 3404#ifdef TERRAIN_FRAGMENT_OCCLUSION 3405if (isOccluded()) {discard;} 3406#endif 3407vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 3408#ifdef LIGHTING_3D_MODE 3409lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 3410#endif 3411vec4 finalColor; 3412#ifdef DIFFUSE_SHADED 3413vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 3414#ifdef HAS_TEXTURE_u_occlusionTexture 3415float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 3416#endif 3417finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 3418#else 3419Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 3420#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 3421#ifdef OCCLUSION_TEXTURE_TRANSFORM 3422vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 3423#else 3424vec2 uv=uv_2f; 3425#endif 3426ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 3427#endif 3428vec4 emissive=u_emissiveFactor; 3429#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 3430emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 3431#endif 3432#ifdef APPLY_LUT_ON_GPU 3433float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 3434#endif 3435color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 3436#ifdef HAS_ATTRIBUTE_a_pbr 3437float 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; 3438#ifdef APPLY_LUT_ON_GPU 3439color_mix=applyLUT(u_lutTexture,color_mix); 3440#endif 3441color=mix(color,color_mix,min(1.0,resEmission)); 3442#ifdef HAS_ATTRIBUTE_a_color_4f 3443float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
3443y));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); 3444#endif 3445#endif 3446vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 3447#endif 3448#ifdef FOG 3449finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 3450#endif 3451#ifdef RENDER_CUTOFF 3452finalColor*=v_cutoff_opacity; 3453#endif 3454#ifdef INDICATOR_CUTOUT 3455finalColor=applyCutout(finalColor,v_position_height.w); 3456#endif 3457#ifdef FEATURE_CUTOUT 3458finalColor=apply_feature_cutout(finalColor,gl_FragCoord); 3459#endif 3460glFragColor=finalColor; 3461#ifdef OVERDRAW_INSPECTOR 3462glFragColor=vec4(1.0); 3463#endif 3464HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3465#include "_prelude_shadow.vertex.glsl" 3466in vec3 a_pos_3f; 3467#pragma mapbox: define-attribute highp vec3 normal_3f 3468#pragma mapbox: define-attribute highp vec2 uv_2f 3469#pragma mapbox: define-attribute highp vec3 color_3f 3470#pragma mapbox: define-attribute highp vec4 color_4f 3471#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr 3472#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 3473uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 3474#ifdef INSTANCED_ARRAYS 3475in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 3476#else 3477uniform highp mat4 u_normal_matrix; 3478#endif 3479#ifdef RENDER_SHADOWS 3480uniform 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; 3481#endif 3482out vec4 v_position_height;out lowp vec4 v_color_mix; 3483#ifdef TERRAIN_FRAGMENT_OCCLUSION 3484out highp float v_depth; 3485#endif 3486#ifdef HAS_ATTRIBUTE_a_pbr 3487out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 3488#endif 3489vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 3490#pragma mapbox: initialize-attribute highp vec3 normal_3f 3491#pragma mapbox: initialize-attribute highp vec2 uv_2f 3492#pragma mapbox: initialize-attribute highp vec3 color_3f 3493#pragma mapbox: initialize-attribute highp vec4 color_4f 3494#pragma mapbox: initialize-attribute-custom highp vec4 pbr 3495#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 3496highp mat4 normal_matrix; 3497#ifdef INSTANCED_ARRAYS 3498normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 3499#else 3500normal_matrix=u_normal_matrix; 3501#endif 3502vec3 local_pos;mat3 rs; 3503#ifdef MODEL_POSITION_ON_GPU 3504vec3 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; 3505#else 3506local_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); 3507#endif 3508v_position_height.w=a_pos_3f.z; 3509#ifdef HAS_ATTRIBUTE_a_pbr 3510vec4 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; 3511#endif 3512#ifdef FOG 3513v_fog_pos=fog_position(local_pos); 3514#endif 3515#ifdef RENDER_CUTOFF 3516v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 3517#endif 3518#ifdef TERRAIN_FRAGMENT_OCCLUSION 3519v_depth=gl_Position.z/gl_Position.w; 3520#ifdef CLIP_ZERO_TO_ONE 3521v_depth=-1.0+2.0*v_depth; 3522#endif 3523#endif 3524#ifdef HAS_ATTRIBUTE_a_normal_3f 3525#ifdef MODEL_POSITION_ON_GPU 3526float 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); 3527#else
3528normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 3529#endif 3530#endif 3531#ifdef HAS_ATTRIBUTE_a_pbr 3532#ifdef HAS_ATTRIBUTE_a_color_4f 3533v_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); 3534#endif 3535#endif 3536#ifdef RENDER_SHADOWS 3537vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 3538#ifdef NORMAL_OFFSET 3539#ifdef HAS_ATTRIBUTE_a_normal_3f 3540#ifdef MODEL_POSITION_ON_GPU 3541vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 3542#else 3543vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 3544#endif 3545#endif 3546#endif 3547v_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; 3548#endif 3549}`),modelDepth:An(`in highp float v_depth;void main() { 3550#ifndef DEPTH_TEXTURE 3551glFragColor=pack_depth(v_depth); 3552#endif 3553}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; 3554#ifdef MODEL_POSITION_ON_GPU 3555#ifdef INSTANCED_ARRAYS 3556in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 3557#else 3558uniform highp mat4 u_instance; 3559#endif 3560uniform highp mat4 u_node_matrix; 3561#endif 3562void main() { 3563#ifdef MODEL_POSITION_ON_GPU 3564highp mat4 instance; 3565#ifdef INSTANCED_ARRAYS 3566instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 3567#else 3568instance=u_instance; 3569#endif 3570vec3 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;
3570rs[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); 3571#else 3572gl_Position=u_matrix*vec4(a_pos_3f,1); 3573#endif 3574v_depth=gl_Position.z/gl_Position.w;}`),stars:An(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 3575{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;}`,` 3576in 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:An("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;}",` 3577in 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; 3578uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 3579uniform float u_horizontalOscillationRate; 3580uniform 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+ 3581localY*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:An("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;}",` 3582in 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; 3583uniform float u_velocity; 3584uniform 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;
3584pos*=halfBoxSize; 3585pos+=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+ 3586localY*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:An("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:An("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 3587in 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; 3588#ifdef TERRAIN 3589float e=elevation(world_pos.xy);world_pos.z+=e; 3590#endif 3591vec4 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 bc(g,a){const h=g.replace(/\s*\/\/[^\n]*\n/g,` 3592`).split(` 3593`);for(let y of h)if(y=y.trim(),y[0]==="#"&&y.includes("if")&&!y.includes("endif")){y=y.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const b=y.split(" ");for(const T of b)a.includes(T)||a.push(T)}}function An(g,a){const h=/#include\s+"([^"]+)"/g,y=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,b={},T=[],E=[];if(g=g.replace(h,(M,L)=>(E.push(L),"")),(a=a.replace(h,(M,L)=>(T.push(L),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let P=[...Ef];bc(g,P),bc(a,P);for(const M of[...T,...E])Af[M]||console.error(`Undefined include: ${M}`),hy[M]||(hy[M]=[],bc(Af[M],hy[M])),P=[...P,...hy[M]];return{fragmentSource:g=g.replace(y,(M,L,O,H,F)=>(b[F]=!0,L==="define"?` 3594#ifndef HAS_UNIFORM_u_${F} 3595in ${O} ${H} ${F}; 3596#else 3597uniform ${O} ${H} u_${F}; 3598#endif 3599`:L==="initialize"?` 3600#ifdef HAS_UNIFORM_u_${F} 3601 ${O} ${H} ${F} = u_${F}; 3602#endif 3603`:L==="define-attribute"?` 3604#ifdef HAS_ATTRIBUTE_a_${F} 3605 in ${O} ${H} ${F}; 3606#endif 3607`:L==="initialize-attribute"?"":void 0)),vertexSource:a=a.replace(y,(M,L,O,H,F)=>{const Z=`MATERIAL_ATTRIBUTE_OFFSET_${F}`,Y=H==="float"?"vec2":H,J=`GET_ATTRIBUTE_${Y}(a_${F}, materialInfo, ${Z})`,se=F.match(/color/)?"color":Y;return L==="define-attribute-vertex-shader-only"?` 3608#ifdef HAS_ATTRIBUTE_a_${F} 3609in ${O} ${H} a_${F}; 3610#endif 3611`:b[F]?L==="define"?` 3612#ifndef HAS_UNIFORM_u_${F} 3613uniform lowp float u_${F}_t; 3614 #if !defined(${Z}) 3615 in ${O} ${Y} a_${F}; 3616 #endif 3617out ${O} ${H} ${F}; 3618#else 3619uniform ${O} ${H} u_${F}; 3620#endif 3621`:L==="initialize"?se==="vec4"?` 3622#ifndef HAS_UNIFORM_u_${F} 3623 ${F} = a_${F}; 3624#else 3625 ${O} ${H} ${F} = u_${F}; 3626#endif 3627`:` 3628#if !defined(HAS_UNIFORM_u_${F}) 3629 #ifdef ${Z} 3630 ${F} = unpack_mix_${se}(${J}, u_${F}_t); 3631 #else 3632 ${F} = unpack_mix_${se}(a_${F}, u_${F}_t); 3633 #endif 3634#else 3635 ${O} ${H} ${F} = u_${F}; 3636#endif 3637`:L==="define-attribute"?` 3638#ifdef HAS_ATTRIBUTE_a_${F} 3639 in ${O} ${H} a_${F}; 3640 out ${O} ${H} ${F}; 3641#endif 3642`:L==="initialize-attribute"?` 3643#ifdef HAS_ATTRIBUTE_a_${F} 3644 ${F} = a_${F}; 3645#endif 3646`:void 0:L==="define"?` 3647#ifndef HAS_UNIFORM_u_${F} 3648uniform lowp float u_${F}_t; 3649 #if !defined(${Z}) 3650 in ${O} ${Y} a_${F}; 3651 #endif 3652#else 3653uniform ${O} ${H} u_${F}; 3654#endif 3655`:L==="define-instanced"?se==="mat4"?` 3656#ifdef INSTANCED_ARRAYS 3657in vec4 a_${F}0; 3658in vec4 a_${F}1; 3659in vec4 a_${F}2; 3660in vec4 a_${F}3; 3661#else 3662uniform ${O} ${H} u_${F}; 3663#endif 3664`:` 3665#ifdef INSTANCED_ARRAYS 3666in ${O} ${Y} a_${F}; 3667#else 3668uniform ${O} ${H} u_${F}; 3669#endif 3670`:L==="initialize-attribute-custom"?` 3671#ifdef HAS_ATTRIBUTE_a_${F} 3672 ${O} ${H} ${F} = a_${F}; 3673#endif 3674`:se==="vec4"?` 3675#ifndef HAS_UNIFORM_u_${F} 3676 #ifdef ${Z} 3677 ${O} ${H} ${F} = ${J}; 3678 #else 3679 ${O} ${H} ${F} = a_${F}; 3680 #endif 3681#else 3682 ${O} ${H} ${F} = u_${F}; 3683#endif 3684`:` 3685#ifndef HAS_UNIFORM_u_${F} 3686 #ifdef ${Z} 3687 ${O} ${H} ${F} = unpack_mix_${se}(${J}, u_${F}_t); 3688 #else 3689 ${O} ${H} ${F} = unpack_mix_${se}(a_${F}, u_${F}_t); 3690 #endif 3691#else 3692 ${O} ${H} ${F} = u_${F}; 3693#endif 3694`}),usedDefines:P,vertexIncludes:T,fragmentIncludes:E}}class If{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(a,h,y,b,T,E,P,M){this.context=a;let L=this.boundPaintVertexBuffers.length!==b.length;for(let H=0;!L&&H<b.length;H++)this.boundPaintVertexBuffers[H]!==b[H]&&(L=!0);let O=this.boundDynamicVertexBuffers.length!==P.length;for(let H=0;!O&&H<P.length;H++)this.boundDynamicVertexBuffers[H]!==P[H]&&(O=!0);if(!this.vao||this.boundProgram!==h||this.boundLayoutVertexBuffer!==y||L||O||this.boundIndexBuffer!==T||this.boundVertexOffset!==E)this.freshBind(h,y,b,T,E,P,M);else{a.bindVertexArrayOES.set(this.vao);for(const H of P)H&&(H.bind(),M&&H.instanceCount&&H.setVertexAttribDivisor(a.gl,h,M));T&&T.dynamicDraw&&T.bind()}}freshBind(a,h,y,b,T,E,P){const M=this.context,L=M.gl;this.vao&&this.destroy(),this.vao=M.gl.createVertexArray(),M.bindVertexArrayOES.set(this.vao),this.boundProgram=a,this.boundLayoutVertexBuffer=h,this.boundPaintVertexBuffers=y,this.boundIndexBuffer=b,this.boundVertexOffset=T,this.boundDynamicVertexBuffers=E,h.enableAttributes(L,a),h.bind(),h.setVertexAttribPointers(L,a,T);for(const O of y)O.enableAttributes(L,a),O.bind(),O.setVertexAttribPointers(L,a,T);for(const O of E)O&&(O.enableAttributes(L,a),O.bind(),O.setVertexAttribPointers(L,a,T),P&&O.instanceCount&&O.setVertexAttribDivisor(L,a,P));b&&b.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function JM(g,a){const h=Math.pow(2,a.canonical.z),y=a.canonical.y;return[new r.ae(0,y/h).toLngLat().lat,new r.ae(0,(y+1)/h).toLngLat().lat]}function eD(g,a,h,y,b,T,E){const P=g.context,M=P.gl,L=h.hillshadeFBO;if(!L)return;g.prepareDrawTile();const O=g.isTileAffectedByFog(a),H=g.getOrCreateProgram("hillshade",{overrideFog:O});P.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,L.colorAttachment.get());const F=((se,ne,ae,fe)=>{const ue=ae.paint.get("hillshade-shadow-color"),Ce=ae.paint.get("hillshade-shadow-color-use-theme").
vendor: 46,837 bytes, lines 3694-3704
3694constantOr("default")==="none",me=ae.paint.get("hillshade-highlight-color"),Ie=ae.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",Se=ae.paint.get("hillshade-accent-color"),ve=ae.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ke=ae.paint.get("hillshade-emissive-strength");let Ke=r.an(ae.paint.get("hillshade-illumination-direction"));if(ae.paint.get("hillshade-illumination-anchor")==="viewport")Ke-=se.transform.angle;else if(se.style&&se.style.enable3dLights()&&se.style.directionalLight){const ct=se.style.directionalLight.properties.get("direction"),it=r.d3(ct.x,ct.y,ct.z);Ke=r.an(it[1])}const $e=!se.options.moving;return{u_matrix:fe||se.transform.calculateProjMatrix(ne.tileID.toUnwrapped(),$e),u_image:0,u_latrange:JM(0,ne.tileID),u_light:[ae.paint.get("hillshade-exaggeration"),Ke],u_shadow:ue.toPremultipliedRenderColor(Ce?null:ae.lut),u_highlight:me.toPremultipliedRenderColor(Ie?null:ae.lut),u_emissive_strength:ke,u_accent:Se.toPremultipliedRenderColor(ve?null:ae.lut)}})(g,h,y,g.terrain?a.projMatrix:null);g.uploadCommonUniforms(P,H,a.toUnwrapped());const{tileBoundsBuffer:Z,tileBoundsIndexBuffer:Y,tileBoundsSegments:J}=g.getTileBoundsBuffers(h);H.draw(g,M.TRIANGLES,b,T,E,$i.disabled,F,y.id,Z,Y,J)}function Iv(g,a,h){if(!a.needsDEMTextureUpload)return;const y=g.context,b=y.gl;y.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||g.getTileTexture(h.stride);const T=h.getPixels();a.demTexture?a.demTexture.update(T,{premultiply:!1}):a.demTexture=new r.T(y,T,b.R32F,{premultiply:!1}),a.needsDEMTextureUpload=!1}function tD(g,a,h){const y=g.context,b=y.gl;if(!a.dem)return;const T=a.dem;if(y.activeTexture.set(b.TEXTURE1),Iv(g,a,T),!a.demTexture)return;a.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE);const E=T.dim;y.activeTexture.set(b.TEXTURE0);let P=a.hillshadeFBO;if(!P){const F=new r.T(y,{width:E,height:E,data:null},b.RGBA8);F.bind(b.LINEAR,b.CLAMP_TO_EDGE),P=a.hillshadeFBO=y.createFramebuffer(E,E,!0,"renderbuffer"),P.colorAttachment.set(F.texture)}y.bindFramebuffer.set(P.framebuffer),y.viewport.set([0,0,E,E]);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:L,tileBoundsSegments:O}=g.getMercatorTileBoundsBuffers(),H=[];g.linearFloatFilteringSupported()&&H.push("TERRAIN_DEM_FLOAT_FORMAT"),g.getOrCreateProgram("hillshadePrepare",{defines:H}).draw(g,b.TRIANGLES,hi.disabled,Yi.disabled,mn.unblended,$i.disabled,((F,Z)=>{const Y=Z.stride,J=r.bB();return r.cd(J,0,r.al,-r.al,0,0,1),r.bq(J,J,[0,-r.al,0]),{u_matrix:J,u_image:1,u_dimension:[Y,Y],u_zoom:F.overscaledZ}})(a.tileID,T),h.id,M,L,O),a.needsHillshadePrepare=!1}class as{constructor(a){this.gl=a.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(a){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class WE extends as{getDefault(){return r.ao.transparent.toNonPremultipliedRenderColor(null)}set(a){const h=this.current;(a.r!==h.r||a.g!==h.g||a.b!==h.b||a.a!==h.a||this.dirty)&&(this.gl.clearColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class I1 extends as{getDefault(){return 1}set(a){(a!==this.current||this.dirty)&&(this.gl.clearDepth(a),this.current=a,this.dirty=!1)}}class iD extends as{getDefault(){return 0}set(a){(a!==this.current||this.dirty)&&(this.gl.clearStencil(a),this.current=a,this.dirty=!1)}}class nD extends as{getDefault(){return[!0,!0,!0,!0]}set(a){const h=this.current;(a[0]!==h[0]||a[1]!==h[1]||a[2]!==h[2]||a[3]!==h[3]||this.dirty)&&(this.gl.colorMask(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class rD extends as{getDefault(){return!0}set(a){(a!==this.current||this.dirty)&&(this.gl.depthMask(a),this.current=a,this.dirty=!1)}}class sD extends as{getDefault(){return 255}set(a){(a!==this.current||this.dirty)&&(this.gl.stencilMask(a),this.current=a,this.dirty=!1)}}class KE extends as{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(a){const h=this.current;(a.func!==h.func||a.ref!==h.ref||a.mask!==h.mask||this.dirty)&&(this.gl.stencilFunc(a.func,a.ref,a.mask),this.current=a,this.dirty=!1)}}class oD extends as{getDefault(){const a=this.gl;return[a.KEEP,a.KEEP,a.KEEP]}set(a){const h=this.current;(a[0]!==h[0]||a[1]!==h[1]||a[2]!==h[2]||this.dirty)&&(this.gl.stencilOp(a[0],a[1],a[2]),this.current=a,this.dirty=!1)}}class kv extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;a?h.enable(h.STENCIL_TEST):h.disable(h.STENCIL_TEST),this.current=a,this.dirty=!1}}class aD extends as{getDefault(){return[0,1]}set(a){const h=this.current;(a[0]!==h[0]||a[1]!==h[1]||this.dirty)&&(this.gl.depthRange(a[0],a[1]),this.current=a,this.dirty=!1)}}class ZE extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;a?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),this.current=a,this.dirty=!1}}class k1 extends as{getDefault(){return this.gl.LESS}set(a){(a!==this.current||this.dirty)&&(this.gl.depthFunc(a),this.current=a,this.dirty=!1)}}class Pv extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;a?h.enable(h.BLEND):h.disable(h.BLEND),this.current=a,this.dirty=!1}}class P1 extends as{getDefault(){const a=this.gl;return[a.ONE,a.ZERO,a.ONE,a.ZERO]}set(a){const h=this.current;(a[0]!==h[0]||a[1]!==h[1]||a[2]!==h[2]||a[3]!==h[3]||this.dirty)&&(this.gl.blendFuncSeparate(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class lp extends as{getDefault(){return r.ao.transparent.toNonPremultipliedRenderColor(null)}set(a){const h=this.current;(a.r!==h.r||a.g!==h.g||a.b!==h.b||a.a!==h.a||this.dirty)&&(this.gl.blendColor(a.r,a.g,a.b,a.a),this.current=a,this.dirty=!1)}}class kf extends as{getDefault(){return this.gl.FUNC_ADD}set(a){(a!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(a,a),this.current=a,this.dirty=!1)}}class fy extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;a?h.enable(h.CULL_FACE):h.disable(h.CULL_FACE),this.current=a,this.dirty=!1}}class Pf extends as{getDefault(){return this.gl.BACK}set(a){(a!==this.current||this.dirty)&&(this.gl.cullFace(a),this.current=a,this.dirty=!1)}}class XE extends as{getDefault(){return this.gl.CCW}set(a){(a!==this.current||this.dirty)&&(this.gl.frontFace(a),this.current=a,this.dirty=!1)}}let N1=class extends as{getDefault(){return null}set(g){(g!==this.current||this.dirty)&&(this.gl.useProgram(g),this.current=g,this.dirty=!1)}};class YE extends as{getDefault(){return this.gl.TEXTURE0}set(a){(a!==this.current||this.dirty)&&(this.gl.activeTexture(a),this.current=a,this.dirty=!1)}}class Nf extends as{getDefault(){const a=this.gl;return[0,0,a.drawingBufferWidth,a.drawingBufferHeight]}set(a){const h=this.current;(a[0]!==h[0]||a[1]!==h[1]||a[2]!==h[2]||a[3]!==h[3]||this.dirty)&&(this.gl.viewport(a[0],a[1],a[2],a[3]),this.current=a,this.dirty=!1)}}class Nv extends as{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.bindFramebuffer(h.FRAMEBUFFER,a),this.current=a,this.dirty=!1}}class Mv extends as{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.bindRenderbuffer(h.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class M1 extends as{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.bindTexture(h.TEXTURE_2D,a),this.current=a,this.dirty=!1}}class Dv extends as{getDefault(){return null}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.bindBuffer(h.ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class my extends as{getDefault(){return null}set(a){const h=this.gl;h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),this.current=a,this.dirty=!1}}class QE extends as{getDefault(){return null}set(a){this.gl&&(a!==this.current||this.dirty)&&(this.gl.bindVertexArray(a),this.current=a,this.dirty=!1)}}class JE extends as{getDefault(){return 4}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_ALIGNMENT,a),this.current=a,this.dirty=!1}}class e2 extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a),this.current=a,this.dirty=!1}}class Mf extends as{getDefault(){return!1}set(a){if(a===this.current&&!this.dirty)return;const h=this.gl;h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,a),this.current=a,this.dirty=!1}}class Rv extends as{constructor(a,h){super(a),this.context=a,this.parent=h}getDefault(){return null}}class lD extends Rv{setDirty(){this.dirty=!0}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,a,0),this.current=a,this.dirty=!1}}class t2 extends Rv{attachment(){return this.gl.DEPTH_ATTACHMENT}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferRenderbuffer(h.FRAMEBUFFER,this.attachment(),h.RENDERBUFFER,a),this.current=a,this.dirty=!1}}class cD extends Rv{attachment(){return this.gl.DEPTH_ATTACHMENT}set(a){if(a===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const h=this.gl;h.framebufferTexture2D(h.FRAMEBUFFER,this.attachment(),h.TEXTURE_2D,a,0),this.current=a,this.dirty=!1}}class D1 extends t2{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const R1=(g,a,h)=>({u_matrix:g,u_image0:0,u_skirt_height:a,u_ground_shadow_factor:h}),jv=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J)=>({u_proj_matrix:Float32Array.from(g),u_globe_matrix:a,u_normalize_matrix:Float32Array.from(y),u_merc_matrix:h,u_zoom_transition:b,u_merc_center:T,u_image0:0,u_frustum_tl:E,u_frustum_tr:P,u_frustum_br:M,u_frustum_bl:L,u_globe_pos:O,u_globe_radius:H,u_viewport:F,u_grid_matrix:J?Float32Array.from(J):new Float32Array(9),u_skirt_height:Z,u_far_z_cutoff:Y});function zv(g,a){return g!=null&&a!=null&&!(!g.hasData()||!a.hasData())&&g.demTexture!=null&&a.demTexture!=null&&g.tileID.key!==a.tileID.key}const cp=new class{constructor(){this.operations={}}newMorphing(g,a,h,y,b){if(g in this.operations){const T=this.operations[g];T.to.tileID.key!==h.tileID.key&&(T.queued=h)}else this.operations[g]={startTime:y,phase:0,duration:b,from:a,to:h,queued:null}}getMorphValuesForProxy(g){if(!(g in this.operations))return null;const a=this.operations[g];return{from:a.from,to:a.to,phase:a.phase}}update(g){for(const a in this.operations){const h=this.operations[a];for(h.phase=(g-h.startTime)/h.duration;h.phase>=1||!this._validOp(h);)if(!this._nextOp(h,g)){delete this.operations[a];break}}}_nextOp(g,a){return!!g.queued&&(g.from=g.to,g.to=g.queued,g.queued=null,g.phase=0,g.startTime=a,!0)}_validOp(g){return g.from.hasData()&&g.to.hasData()}},j1={0:null,1:"TERRAIN_VERTEX_MORPHING"};function i2(g,a,h){if(a===0)return 0;const y=a<1&&h===514?.25/a:1;return 6*Math.pow(1.5,22-g)*Math.max(a,1)*y}function gy(g,a){const h=1<<g.z;return!a&&(g.x===0||g.x===h-1)||g.y===0||g.y===h-1}const up=g=>({u_matrix:g});function Lv(g,a,h,y,b){if(b>0){const T=r.o.now(),E=(T-g.timeAdded)/b,P=a?(T-a.timeAdded)/b:-1,M=h.getSource(),L=y.coveringZoomLevel({tileSize:M.tileSize,roundZoom:M.roundZoom}),O=!a||Math.abs(a.tileID.overscaledZ-L)>Math.abs(g.tileID.overscaledZ-L),H=O&&g.refreshedUponExpiration?1:r.aA(O?E:1-P,0,1);return a?{opacity:1,mix:1-H,isFading:E<1}:{opacity:H,mix:0,isFading:E<1}}return{opacity:1,mix:0,isFading:!1}}class jl extends gc{constructor(a){const h=ka("mock-dem",{type:"raster-dem",maxzoom:a.transform.maxZoom},a.style.dispatcher,a.style);super("mock-dem",h,!1),h.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,h){a.state="loaded",h(null)}}class z1 extends gc{constructor(a){const h=ka("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},a.style.dispatcher,a.style);super("proxy",h,!1),h.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(a,h,y){if(a.freezeTileCoverage)return;this.transform=a;const b=a.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((T,E)=>{if(T[E.key]="",!this._tiles[E.key]){const P=new fu(E,this._source.tileSize*E.overscaleFactor(),a.tileZoom,void 0,void 0,this._source.worldview);P.state="loaded",this._tiles[E.key]=P}return T},{});for(const T in this._tiles)T in b||(this.freeFBO(T),this._tiles[T].unloadVectorData(),delete this._tiles[T])}freeFBO(a){const h=this.proxyCachedFBO[a];if(h!==void 0){const y=Object.values(h);this.renderCachePool.push(...y),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class yy extends r.aP{constructor(a,h,y){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=h,this.projMatrix=y}}class _y extends r.bU{constructor(a,h){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},a.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),a.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),a.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=a,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[y,b,T]=function(M){const L=new r.bc,O=new r.b0,H=131;L.reserve(17161),O.reserve(33800);const F=r.al/128,Z=r.al+F/2,Y=Z+F;for(let se=-F;se<Y;se+=F)for(let ne=-F;ne<Y;ne+=F){const ae=ne<0||ne>Z||se<0||se>Z?24575:0,fe=r.aA(Math.round(ne),0,r.al),ue=r.aA(Math.round(se),0,r.al);L.emplaceBack(fe+ae,ue)}const J=(se,ne)=>{const ae=ne*H+se;O.emplaceBack(ae+1,ae,ae+H),O.emplaceBack(ae+H,ae+H+1,ae+1)};for(let se=1;se<129;se++)for(let ne=1;ne<129;ne++)J(ne,se);return[0,129].forEach(se=>{for(let ne=0;ne<130;ne++)J(ne,se),J(se,ne)}),[L,O,32768]}(),E=a.context;this.gridBuffer=E.createVertexBuffer(y,r.be.members),this.gridIndexBuffer=E.createIndexBuffer(b),this.gridSegments=r.bf.simpleSegment(0,0,y.length,b.length),this.gridNoSkirtSegments=r.bf.simpleSegment(0,0,y.length,T),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new z1(h.map),this.orthoMatrix=r.bB(),r.cd(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,r.al,0,r.al,0,1);const P=E.gl;this._overlapStencilMode=new Yi({func:P.GEQUAL,mask:255},0,255,P.KEEP,P.KEEP,P.REPLACE),this._previousZoom=a.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=h,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new jl(h.map),this._pendingGroundEffectLayers=[]}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),this._style=a,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(a,h,y){if(a&&a.terrain){this._style!==a&&(this.style=a,this._evaluationZoom=void 0);const b=a.terrain.properties,T=a.terrain.drapeRenderMode===0,E=a.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=r.o.now();const P=a.terrain&&a.terrain.scope,M=b.get("source"),L=T?this._mockSourceCache:a.getSourceCache(M,P);if(!L)return void r.w(`Couldn't find terrain source "${M}".`);if(this.sourceCache=L,this._attenuationRange=a.terrain.getAttenuationRange(),this._exaggeration=E?this.calculateExaggeration(h):b.get("exaggeration"),!h.projection.requiresDraping&&E&&this._exaggeration===0)return void this._disable();this.enabled=!0;const O=()=>{this.sourceCache.used&&r.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 3695This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const H=this.getScaledDemTileSize();this.sourceCache.update(h,H,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,O(),this._initializing=!0),O(),h.updateElevation(!0,y),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(h),this._emptyDEMTextureDirty=!0,this._previousZoom=h.zoom}else this._disable()}calculateExaggeration(a){if(this._attenuationRange&&a.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(a.zoom);const h=this._previousCameraAltitude,y=a.getFreeCameraOptions().position.z/a.pixelsPerMeter*a.worldSize;this._previousCameraAltitude=y;const b=h!=null?y-h:Number.MAX_VALUE;if(Math.abs(b)<2)return this._exaggeration;const T=a.zoom,E=this._style.terrain;if(!this._previousUpdateTimestamp)return E.getExaggeration(T);let P=T-this._previousZoom;const M=this._previousUpdateTimestamp;let L=T;this._evaluationZoom!=null&&(L=this._evaluationZoom,Math.abs(T-L)>.5&&(P=.5*(T-L+P)),P*b<0&&(L+=P)),this._evaluationZoom=L;const O=E.getExaggeration(L),H=O===E.getExaggeration(Math.max(0,L-.1));if(H&&Math.abs(O-this._exaggeration)<.01)return O;let F=Math.min(.1,.00375*(this._updateTimestamp-M));return(H||O<.1||Math.abs(P)<1e-4)&&(F=Math.min(.2,4*F)),r.ak(this._exaggeration,O,F)}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(a){a.dataType==="source"&&a.coord?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):a.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 a in this._style._mergedSourceCaches)this._style._mergedSourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(a=>a.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 a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(a){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const h=this.proxySourceCache,y=this.painter.transform;this._initializing&&(this._initializing=y._centerAltitude===0&&this.getAtPointOrZero(r.ae.fromLngLat(y.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const b=this.proxyCoords=h.getIds().map(M=>{const L=h.getTileByID(M).tileID;return L.projMatrix=y.calculateProjMatrix(L.toUnwrapped()),L});(function(M,L){const O=L.transform.pointCoordinate(L.transform.getCameraPoint()),H=new r.P(O.x,O.y);M.sort((F,Z)=>{if(Z.overscaledZ-F.overscaledZ)return Z.overscaledZ-F.overscaledZ;const Y=new r.P(F.canonical.x+(1<<F.canonical.z)*F.wrap,F.canonical.y),J=new r.P(Z.canonical.x+(1<<Z.canonical.z)*Z.wrap,Z.canonical.y),se=H.mult(1<<F.canonical.z);return se.x-=.5,se.y-=.5,se.distSqr(Y)-se.distSqr(J)})})(b,this.painter);const T=this.proxyToSource||{};this.proxyToSource={},b.forEach(M=>{this.proxyToSource[M.key]={}}),this.terrainTileForTile={};const E=this._style._mergedSourceCaches;for(const M in E){const L=E[M];if(!L.used||(L!==this.sourceCache&&this.resetTileLookupCache(L.id),this._setupProxiedCoordsForOrtho(L,a[M],T),L.usedForTerrain))continue;const O=a[M];L.getSource().reparseOverscaled&&this._assignTerrainTiles(O)}this.proxiedCoords[h.id]=b.map(M=>new yy(M,M.key,this.orthoMatrix)),this._assignTerrainTiles(b),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(T),this.renderingToTexture=!1;const P={};this._visibleDemTiles=[];for(const M of this.proxyCoords){const L=this.terrainTileForTile[M.key];if(!L)continue;const O=L.tileID.key;O in P||(this._visibleDemTiles.push(L),P[O]=O)}}_assignTerrainTiles(a){this._initializing||a.forEach(h=>{if(this.terrainTileForTile[h.key])return;const y=this._findTileCoveringTileID(h,this.sourceCache);y&&(this.terrainTileForTile[h.key]=y)})}_prepareDEMTextures(){const a=this.painter.context,h=a.gl;for(const y in this.terrainTileForTile){const b=this.terrainTileForTile[y],T=b.dem;!T||b.demTexture&&!b.needsDEMTextureUpload||(a.activeTexture.set(h.TEXTURE1),Iv(this.painter,b,T))}}_prepareDemTileUniforms(a,h,y,b){if(!h||h.demTexture==null)return!1;const T=a.tileID.canonical,E=Math.pow(2,h.tileID.canonical.z-T.z),P=b||"";return y[`u_dem_tl${P}`]=[T.x*E%1,T.y*E%1],y[`u_dem_scale${P}`]=E,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let a=0;const h=this._visibleDemTiles.reduce((y,b)=>{if(!b.dem)return y;const T=b.dem.tree.minimums[0];return T>0&&a++,y+T},0);return a?h/a:0}_updateEmptyDEMTexture(){const a=this.painter.context,h=a.gl;a.activeTexture.set(h.TEXTURE2);const y=this._getLoadedAreaMinimum(),b=new r.dK({width:1,height:1},new Float32Array([y]));this._emptyDEMTextureDirty=!1;let T=this._emptyDEMTexture;return T?T.update(b,{premultiply:!1}):T=this._emptyDEMTexture=new r.T(a,b,h.R32F,{premultiply:!1}),T}setupElevationDraw(a,h,y){const b=this.painter.context,T=b.gl,E={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};E.u_exaggeration=this.exaggeration();let P=null,M=null,L=1;if(y&&y.morphing&&this._useVertexMorphing){const Z=y.morphing.srcDemTile,Y=y.morphing.dstDemTile;L=y.morphing.phase,Z&&Y&&(this._prepareDemTileUniforms(a,Z,E,"_prev")&&(M=Z),this._prepareDemTileUniforms(a,Y,E)&&(P=Y))}const O=Z=>Z&&Z.demTexture&&this.painter.linearFloatFilteringSupported()?T.LINEAR:T.NEAREST;let H=null;var F;if(this.enabled?M&&P?(H=P.demTexture,b.activeTexture.set(T.TEXTURE4),M.demTexture.bind(O(M),T.CLAMP_TO_EDGE),E.u_dem_lerp=L):(P=this.terrainTileForTile[a.tileID.key],H=this._prepareDemTileUniforms(a,P,E)?P.demTexture:this.emptyDEMTexture):H=this.emptyDEMTexture,b.activeTexture.set(T.TEXTURE2),H&&(E.u_dem_size=(F=H).size[0]===1?1:F.size[0]-2,H.bind(O(P),T.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(y&&y.useDepthForOcclusion,h,E),y&&y.useMeterToDem&&P){const Z=(1<<P.tileID.canonical.z)*r.ce(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;E.u_meter_to_dem=Z}if(y&&y.labelPlaneMatrixInv&&(E.u_label_plane_matrix_inv=y.labelPlaneMatrixInv),h.setTerrainUniformValues(b,E),this.painter.transform.projection.name==="globe"){const Z=this.globeUniformValues(this.painter.transform,a.tileID.canonical,y&&y.useDenormalizedUpVectorScale);h.setGlobeUniformValues(b,Z)}}globeUniformValues(a,h,y){const b=a.projection;return{u_tile_tl_up:b.upVector(h,0,0),u_tile_tr_up:b.upVector(h,r.al,0),u_tile_br_up:b.upVector(h,r.al,r.al),u_tile_bl_up:b.upVector(h,0,r.al),u_tile_up_scale:y?r.dL(1):b.upVectorScale(h,a.center.lat,a.worldSize).metersToTile}}renderToBackBuffer(a){const h=this.painter,y=this.painter.context;a.length!==0&&(y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height]),h.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(b,T,E,P,M){if(b.transform.projection.name==="globe")(function(L,O,H,F,Z){const Y=L.context,J=Y.gl;let se,ne;const ae=L.transform,fe=r.dD(L,Y,ae),ue=(ct,it)=>{if(ne===it)return;const gt=[j1[it],"PROJECTION_GLOBE_VIEW"];fe&>.push("CUSTOM_ANTIALIASING");const jt=L.isTileAffectedByFog(ct);se=L.getOrCreateProgram("globeRaster",{defines:gt,overrideFog:jt}),ne=it},Ce=L.colorModeForRenderPass(),me=new hi(J.LEQUAL,hi.ReadWrite,L.depthRangeFor3D);cp.update(Z);const Ie=r.dE(ae),Se=[r.aF(ae.center.lng),r.aJ(ae.center.lat)],ve=L.globeSharedBuffers,ke=[ae.width*r.o.devicePixelRatio,ae.height*r.o.devicePixelRatio],Ke=Float32Array.from(ae.globeMatrix),$e={useDenormalizedUpVectorScale:!0};{const ct=L.transform,it=i2(ct.zoom,O.exaggeration(),O.sourceCache._source.tileSize);ne=-1;const gt=J.TRIANGLES;for(const jt of F){const et=H.getTile(jt),Oe=Yi.disabled,yt=O.prevTerrainTileForTile[jt.key],nt=O.terrainTileForTile[jt.key];zv(yt,nt)&&cp.newMorphing(jt.key,yt,nt,Z,250),Y.activeTexture.set(J.TEXTURE0),et.texture&&et.texture.bind(J.LINEAR,J.CLAMP_TO_EDGE);const wt=cp.getMorphValuesForProxy(jt.key),Bt=wt?1:0;wt&&Object.assign($e,{morphing:{srcDemTile:wt.from,dstDemTile:wt.to,phase:r.dC(wt.phase)}});const oi=r.dF(jt.canonical),Mt=r.dG(oi.getCenter().lat),Lt=r.dH(jt.canonical,oi,Mt,ct.worldSize/ct._pixelsPerMercatorPixel),li=r.bj(r.dI(jt.canonical)),ti=jv(ct.expandedFarZProjMatrix,Ke,Ie,li,r.aj(ct.zoom),Se,ct.frustumCorners.TL,ct.frustumCorners.TR,ct.frustumCorners.BR,ct.frustumCorners.BL,ct.globeCenterInViewSpace,ct.globeRadius,ke,it,ct._farZ,Lt);if(ue(jt,Bt),se&&(O.setupElevationDraw(et,se,$e),L.uploadCommonUniforms(Y,se,jt.toUnwrapped()),ve)){const[Yt,ii,ji]=ve.getGridBuffers(Mt,it!==0);se.draw(L,gt,me,Oe,Ce,$i.backCCW,ti,"globe_raster",Yt,ii,ji)}}}if(ve&&(L.renderDefaultNorthPole||L.renderDefaultSouthPole)){const ct=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];fe&&ct.push("CUSTOM_ANTIALIASING"),se=L.getOrCreateProgram("globeRaster",{defines:ct});for(const it of F){const{x:gt,y:jt,z:et}=it.canonical,Oe=jt===0,yt=jt===(1<<et)-1,[nt,wt,Bt,oi]=ve.getPoleBuffers(et,!1);if(oi&&(Oe||yt)){const Mt=H.getTile(it);Y.activeTexture.set(J.TEXTURE0),Mt.texture&&Mt.texture.bind(J.LINEAR,J.CLAMP_TO_EDGE);let Lt=r.dJ(et,gt,ae);const li=r.bj(r.dI(it.canonical)),ti=(Yt,ii)=>Yt.draw(L,J.TRIANGLES,me,Yi.disabled,Ce,$i.disabled,jv(ae.expandedFarZProjMatrix,Lt,Lt,li,0,Se,ae.frustumCorners.TL,ae.frustumCorners.TR,ae.frustumCorners.BR,ae.frustumCorners.BL,ae.globeCenterInViewSpace,ae.globeRadius,ke,0,ae._farZ),"globe_pole_raster",ii,Bt,oi);O.setupElevationDraw(Mt,se,$e),L.uploadCommonUniforms(Y,se,it.toUnwrapped()),Oe&&L.renderDefaultNorthPole&&ti(se,nt),yt&&L.renderDefaultSouthPole&&(Lt=r.cR(r.bB(),Lt,[1,-1,1]),ti(se,wt))}}}})(b,T,E,P,M);else{const L=b.context,O=L.gl;let H,F;const Z=b.shadowRenderer,Y=Xu(b,b.longestCutoffRange),J=Ce=>{if(F===Ce)return;const me=[];me.push(j1[Ce]),Y.shouldRenderCutoff&&me.push("RENDER_CUTOFF"),Z&&(me.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Z.useNormalOffset&&me.push("NORMAL_OFFSET")),H=b.getOrCreateProgram("terrainRaster",{defines:me}),F=Ce},se=b.colorModeForRenderPass(),ne=new hi(O.LEQUAL,hi.ReadWrite,b.depthRangeFor3D);cp.update(M);const ae=b.transform,fe=i2(ae.zoom,T.exaggeration(),T.sourceCache._source.tileSize);let ue=[0,0,0];if(Z){const Ce=b.style.directionalLight,me=b.style.ambientLight;Ce&&me&&(ue=vc(b.style,Ce,me))}{F=-1;const Ce=O.TRIANGLES,[me,Ie]=[T.gridIndexBuffer,T.gridSegments];for(const Se of P){const ve=E.getTile(Se),ke=Yi.disabled,Ke=T.prevTerrainTileForTile[Se.key],$e=T.terrainTileForTile[Se.key];zv(Ke,$e)&&cp.newMorphing(Se.key,Ke,$e,M,250),L.activeTexture.set(O.TEXTURE0),ve.texture&&ve.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE);const ct=cp.getMorphValuesForProxy(Se.key),it=ct?1:0;let gt;ct&&(gt={morphing:{srcDemTile:ct.from,dstDemTile:ct.to,phase:r.dC(ct.phase)}});const jt=R1(Se.projMatrix,gy(Se.canonical,ae.renderWorldCopies)?fe/10:fe,ue);if(J(it),!H)continue;T.setupElevationDraw(ve,H,gt);const et=Se.toUnwrapped();Z&&Z.setupShadows(et,H),b.uploadCommonUniforms(L,H,et,null,Y),H.draw(b,Ce,ne,ke,se,$i.backCCW,jt,"terrain_raster",T.gridBuffer,me,Ie)}}}}(h,this,this.proxySourceCache,a,this._updateTimestamp),this.renderingToTexture=!0,h.gpuTimingDeferredRenderEnd(),a.splice(0,a.length))}renderBatch(a){if(this._drapedRenderBatches.length===0)return a+1;this.renderingToTexture=!0;const h=this.painter,y=this.painter.context,b=this.proxySourceCache,T=this.proxiedCoords[b.id],E=this._drapedRenderBatches.shift(),P=h.style.order,M=[];let L=0;for(const O of T){const H=b.getTileByID(O.proxyTileKey),F=b.proxyCachedFBO[O.key]?b.proxyCachedFBO[O.key][a]:void 0,Z=F!==void 0?b.renderCache[F]:this.pool[L++],Y=F!==void 0;if(H.texture=Z.tex,Y&&!Z.dirty){M.push(H.tileID);continue}let J;y.bindFramebuffer.set(Z.fb.framebuffer),this.renderedToTile=!1,Z.dirty&&(y.clear({color:r.ao.transparent,stencil:0}),Z.dirty=!1);for(let se=E.start;se<=E.end;++se){const ne=h.style._mergedLayers[P[se]];if(ne.isHidden(h.transform.zoom))continue;const ae=h.style.getLayerSourceCache(ne),fe=ae?this.proxyToSource[O.key][ae.id]:[O];if(!fe)continue;const ue=fe;y.viewport.set([0,0,Z.fb.width,Z.fb.height]),J!==(ae?ae.id:null)&&(this._setupStencil(Z,fe,ne,ae),J=ae?ae.id:null),h.renderLayer(h,ae,ne,ue)}if(this._drapedRenderBatches.length===0)for(const se of this._pendingGroundEffectLayers){const ne=h.style._mergedLayers[P[se]];if(ne.isHidden(h.transform.zoom))continue;const ae=h.style.getLayerSourceCache(ne),fe=ae?this.proxyToSource[O.key][ae.id]:[O];if(!fe)continue;const ue=fe;y.viewport.set([0,0,Z.fb.width,Z.fb.height]),J!==(ae?ae.id:null)&&(this._setupStencil(Z,fe,ne,ae),J=ae?ae.id:null),h.renderLayer(h,ae,ne,ue)}this.renderedToTile?(Z.dirty=!0,M.push(H.tileID)):Y||--L,L===5&&(L=0,this.renderToBackBuffer(M))}return this.renderToBackBuffer(M),this.renderingToTexture=!1,y.bindFramebuffer.set(null),y.viewport.set([0,0,h.width,h.height]),E.end+1}postRender(){}isLayerOrderingCorrect(a){const h=a.order.length;let y=-1,b=h;for(let T=0;T<h;++T)this._style.isLayerDraped(a._mergedLayers[a.order[T]])?y=Math.max(y,T):b=Math.min(b,T);return b>y}getMinElevationBelowMSL(){let a=0;return this._visibleDemTiles.filter(h=>h.dem).forEach(h=>{a=Math.min(a,h.dem.tree.minimums[0])}),a===0?a:(a-30)*this._exaggeration}raycast(a,h,y){if(!this._visibleDemTiles)return null;const b=this._visibleDemTiles.filter(T=>T.dem).map(T=>{const E=T.tileID,P=1<<E.overscaledZ,{x:M,y:L}=E.canonical,O=M/P,H=(M+1)/P,F=L/P,Z=(L+1)/P;return{minx:O,miny:F,maxx:H,maxy:Z,t:T.dem.tree.raycastRoot(O,F,H,Z,a,h,y),tile:T}});b.sort((T,E)=>(T.t!==null?T.t:Number.MAX_VALUE)-(E.t!==null?E.t:Number.MAX_VALUE));for(const T of b){if(T.t==null)return null;const E=T.tile.dem.tree.raycast(T.minx,T.miny,T.maxx,T.maxy,a,h,y);if(E!=null)return E}return null}_createFBO(){const a=this.painter.context,h=a.gl,y=this.drapeBufferSize;a.activeTexture.set(h.TEXTURE0);const b=new r.T(a,{width:y[0],height:y[1],data:null},h.RGBA8);b.bind(h.LINEAR,h.CLAMP_TO_EDGE);const T=a.createFramebuffer(y[0],y[1],!0,null);return T.colorAttachment.set(b.texture),T.depthAttachment=new D1(a,T.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,y[0],y[1]),this._stencilRef=0,T.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):T.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:T,tex:b,dirty:!1}}_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 a in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[a].hasTransition())return!0;return this._style.order.some(a=>{const h=this._style._mergedLayers[a],y=h.isHidden(this.painter.transform.zoom);return h.type==="hillshade"||h.type==="custom"?!y&&h.shouldRedrape():!y&&h.hasTransition()})}_clearLineLayersFromRenderCache(){let a=!1;for(const y of this._style.getSources())if(y instanceof ga){a=!0;break}if(!a)return;const h={};for(let y=0;y<this._style.order.length;++y){const b=this._style._mergedLayers[this._style.order[y]],T=this._style.getLayerSourceCache(b);if(T&&!h[T.id]&&!b.isHidden(this.painter.transform.zoom)&&b.type==="line"&&b.widthExpression()instanceof r.ad){h[T.id]=!0;for(const E of this.proxyCoords){const P=this.proxyToSource[E.key][T.id];if(P)for(const M of P)this._clearRenderCacheForTile(T.id,M)}}}}_clearRasterLayersFromRenderCache(){let a=!1;for(const y in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[y]._source instanceof fc){a=!0;break}if(!a)return;const h={};for(let y=0;y<this._style.order.length;++y){const b=this._style._mergedLayers[this._style.order[y]],T=this._style.getLayerSourceCache(b);if(!T||h[T.id]||b.isHidden(this.painter.transform.zoom)||b.type!=="raster")continue;const E=b.paint.get("raster-fade-duration");for(const P of this.proxyCoords){const M=this.proxyToSource[P.key][T.id];if(M)for(const L of M){const O=Lv(T.getTile(L),T.findLoadedParent(L,0),T,this.painter.transform,E);(O.opacity!==1||O.mix!==0)&&this._clearRenderCacheForTile(T.id,L)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const a=this._style.order,h=a.length;if(h===0)return;const y=[];this._pendingGroundEffectLayers=[];let b,T=0,E=this._style._mergedLayers[a[T]];for(;!this._style.isLayerDraped(E)&&E.isHidden(this.painter.transform.zoom)&&++T<h;)E=this._style._mergedLayers[a[T]];for(;T<h;++T){const P=this._style._mergedLayers[a[T]];P.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(P)?b===void 0&&(b=T):(P.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(T),b!==void 0&&(y.push({start:b,end:T-1}),b=void 0)))}if(b!==void 0&&y.push({start:b,end:T-1}),y.length!==0){const P=y[y.length-1];this._pendingGroundEffectLayers.every(M=>M>P.end)||r.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=y}_setupRenderCache(a){const h=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,h.renderCache.length>h.renderCachePool.length){const E=Object.values(h.proxyCachedFBO);h.proxyCachedFBO={};for(let P=0;P<E.length;++P){const M=Object.values(E[P]);h.renderCachePool.push(...M)}}return}this._clearRasterLayersFromRenderCache();const y=this.proxyCoords,b=this._tilesDirty;for(let E=y.length-1;E>=0;E--){const P=y[E];if(h.getTileByID(P.key),h.proxyCachedFBO[P.key]!==void 0){const M=a[P.key],L=this.proxyToSource[P.key];let O=0;for(const H in L){const F=L[H],Z=M[H];if(!Z||Z.length!==F.length||F.some((Y,J)=>Y!==Z[J]||b[H]&&b[H].hasOwnProperty(Y.key))){O=-1;break}++O}for(const H in h.proxyCachedFBO[P.key])h.renderCache[h.proxyCachedFBO[P.key][H]].dirty=O<0||O!==Object.values(M).length}}const T=[...this._drapedRenderBatches];T.sort((E,P)=>P.end-P.start-(E.end-E.start));for(const E of T)for(const P of y){if(h.proxyCachedFBO[P.key])continue;let M=h.renderCachePool.pop();M===void 0&&h.renderCache.length<50&&(M=h.renderCache.length,h.renderCache.push(this._createFBO())),M!==void 0&&(h.proxyCachedFBO[P.key]={},h.proxyCachedFBO[P.key][E.start]=M,h.renderCache[M].dirty=!0)}this._tilesDirty={}}_setupStencil(a,h,y,b){if(!b||!this._sourceTilesOverlap[b.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const T=this.painter.context,E=T.gl;if(h.length<=1)return void(this._overlapStencilType=!1);let P;if(y.isTileClipped())P=h.length,this._overlapStencilMode.test={func:E.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(h[0].overscaledZ>h[h.length-1].overscaledZ))return void(this._overlapStencilType=!1);P=1,this._overlapStencilMode.test={func:E.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+P>255&&(T.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=P,this._overlapStencilMode.ref=this._stencilRef,y.isTileClipped()&&this._renderTileClippingMasks(h,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(a){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[a.key]),this._overlapStencilMode):Yi.disabled}_renderTileClippingMasks(a,h){const y=this.painter,b=this.painter.context,T=b.gl;y._tileClippingMaskIDs={},b.setColorMode(mn.disabled),b.setDepthMode(hi.disabled);const E=y.getOrCreateProgram("clippingMask");for(const P of a){const M=y._tileClippingMaskIDs[P.key]=--h;E.draw(y,T.TRIANGLES,hi.disabled,new Yi({func:T.ALWAYS,mask:0},M,255,T.KEEP,T.KEEP,T.REPLACE),mn.disabled,$i.disabled,up(P.projMatrix),"$clipping",y.tileExtentBuffer,y.quadTriangleIndexBuffer,y.tileExtentSegments)}}pointCoordinate(a){const h=this.painter.transform;if(a.x<0||a.x>h.width||a.y<0||a.y>h.height)return null;const y=[a.x,a.y,1,1];r.aC(y,y,h.pixelMatrixInverse),r.cJ(y,y,1/y[3]),y[0]/=h.worldSize,y[1]/=h.worldSize;const b=h._camera.position,T=r.ce(1,h.center.lat),E=[b[0],b[1],b[2]/T,0],P=r.d9([],y.slice(0,3),E);r.aw(P,P);const M=this.raycast(E,P,this._exaggeration);return M!==null&&M?(r.bG(E,E,P,M),E[3]=E[2],E[2]*=T,E):null}_setupProxiedCoordsForOrtho(a,h,y){if(a.getSource()instanceof r.aT)return this._setupProxiedCoordsForImageSource(a,h,y);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const b=this.proxiedCoords[a.id]=[],T=this.proxyCoords;for(let M=0;M<T.length;M++){const L=T[M],O=this._findTileCoveringTileID(L,a);if(O){const H=this._createProxiedId(L,O,y[L.key]&&y[L.key][a.id]);b.push(H),this.proxyToSource[L.key][a.id]=[H]}}let E=!1;const P=new Set;for(let M=0;M<h.length;M++){const L=a.getTile(h[M]);if(!L||!L.hasData())continue;const O=this._findTileCoveringTileID(L.tileID,this.proxySourceCache);if(O&&O.tileID.canonical.z!==L.tileID.canonical.z){const H=this.proxyToSource[O.tileID.key][a.id],F=this._createProxiedId(O.tileID,L,y[O.tileID.key]&&y[O.tileID.key][a.id]);H?H.splice(H.length-1,0,F):this.proxyToSource[O.tileID.key][a.id]=[F];const Z=this.proxyToSource[O.tileID.key][a.id];P.has(Z)||P.add(Z),b.push(F),E=!0}}if(this._sourceTilesOverlap[a.id]=E,E&&this._debugParams.sortTilesHiZFirst)for(const M of P)M.sort((L,O)=>O.overscaledZ-L.overscaledZ)}_setupProxiedCoordsForImageSource(a,h,y){if(!a.getSource().loaded())return;const b=this.proxiedCoords[a.id]=[],T=this.proxyCoords,E=a.getSource(),P=E.tileID;if(!P)return;const M=new r.P(P.x,P.y)._div(1<<P.z),L=E.coordinates.map(r.ae.fromLngLat).reduce((H,F)=>(H.min.x=Math.min(H.min.x,F.x-M.x),H.min.y=Math.min(H.min.y,F.y-M.y),H.max.x=Math.max(H.max.x,F.x-M.x),H.max.y=Math.max(H.max.y,F.y-M.y),H),{min:new r.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new r.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),O=(H,F)=>{const Z=H.wrap+H.canonical.x/(1<<H.canonical.z),Y=H.canonical.y/(1<<H.canonical.z),J=r.al/(1<<H.canonical.z),se=F.wrap+F.canonical.x/(1<<F.canonical.z),ne=F.canonical.y/(1<<F.canonical.z);return Z+J<se+L.min.x||Z>se+L.max.x||Y+J<ne+L.min.y||Y>ne+L.max.y};for(let H=0;H<T.length;H++){const F=T[H];for(let Z=0;Z<h.length;Z++){const Y=a.getTile(h[Z]);if(!Y||!Y.hasData()||O(F,Y.tileID))continue;const J=this._createProxiedId(F,Y,y[F.key]&&y[F.key][a.id]),se=this.proxyToSource[F.key][a.id];se?se.push(J):this.proxyToSource[F.key][a.id]=[J],b.push(J)}}}_createProxiedId(a,h,y){let b=this.orthoMatrix;if(y){const T=y.find(E=>E.key===h.tileID.key);if(T)return T}if(h.tileID.key!==a.key){const T=a.canonical.z-h.tileID.canonical.z;let E,P,M;b=r.bB();const L=h.tileID.wrap-a.wrap<<a.overscaledZ;T>0?(E=r.al>>T,P=E*((h.tileID.canonical.x<<T)-a.canonical.x+L),M=E*((h.tileID.canonical.y<<T)-a.canonical.y)):(E=r.al<<-T,P=r.al*(h.tileID.canonical.x-(a.canonical.x+L<<-T)),M=r.al*(h.tileID.canonical.y-(a.canonical.y<<-T))),r.cd(b,0,E,0,E,0,1),r.bq(b,b,[P,M,0])}return new yy(h.tileID,a.key,b)}_findTileCoveringTileID(a,h){let y=h.getTile(a);if(y&&y.hasData())return y;const b=this._findCoveringTileCache[h.id],T=b[a.key];if(y=T?h.getTileByID(T):null,y&&y.hasData()||T===null)return y;let E=y?y.tileID:a,P=E.overscaledZ;const M=h.getSource().minzoom,L=[];if(!T){const H=h.getSource().maxzoom;if(a.canonical.z>=H){const F=a.canonical.z-H;h.getSource().reparseOverscaled?(P=Math.max(a.canonical.z+2,h.transform.tileZoom),E=new r.aP(P,a.wrap,H,a.canonical.x>>F,a.canonical.y>>F)):F!==0&&(P=H,E=new r.aP(P,a.wrap,H,a.canonical.x>>F,a.canonical.y>>F))}E.key!==a.key&&(L.push(E.key),y=h.getTile(E))}const O=H=>{L.forEach(F=>{b[F]=H}),L.length=0};for(P-=1;P>=M&&(!y||!y.hasData());P--){y&&O(y.tileID.key);const H=E.calculateScaledKey(P);if(y=h.getTileByID(H),y&&y.hasData())break;const F=b[H];if(F===null)break;F===void 0?L.push(H):y=h.getTileByID(F)}return O(y?y.tileID.key:null),y&&y.hasData()?y:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(a,h){let y=this._tilesDirty[a];y||(y=this._tilesDirty[a]={}),y[h.key]=!0}}function L1(g,a,h){const y=function(P,M,L){const O=r.bI(M,P),H=r.bI(L,[.2126,.7152,.0722]),F=(Y,J,se)=>(1-se)*Y+se*J,Z=F(1-.3*Math.min(H,1),1,Math.min(O+1,1));return F(.92,1,Math.asin(r.aA(M[2],-1,1))/Math.PI+.5)*Z}(g,[0,0,1],a),b=[0,0,0];r.c4(b,h.slice(0,3),y);const T=[0,0,0];r.c4(T,a.slice(0,3),g[2]);const E=[0,0,0];return r.d7(E,b,T),r.da(E)}const O1=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],F1=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class vy{static cacheKey(a,h,y,b){let T=`${h}${b?b.cacheKey:""}`;for(const E of y)a.usedDefines.includes(E)&&(T+=`/${E}`);return T}constructor(a,h,y,b,T,E){const P=a.gl;this.program=P.createProgram(),this.configuration=b,this.name=h,this.fixedDefines=[...E];let M=b?b.defines():[];M=M.concat(E.map(Y=>`#define ${Y}`));const L=`#version 300 es 3696`;let O=L+M.concat("precision mediump float;",yu,py.fragmentSource).join(` 3697`);for(const Y of y.fragmentIncludes)O+=` 3698${Af[Y]}`;O+=` 3699${y.fragmentSource}`;let H=L+M.concat("precision highp float;",yu,py.vertexSource).join(` 3700`);for(const Y of y.vertexIncludes)H+=` 3701${Af[Y]}`;this.forceManualRenderingForInstanceIDShaders=a.forceManualRenderingForInstanceIDShaders&&y.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(H+=` 3702uniform int u_instanceID; 3703`),H+=` 3704${y.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(H=H.replaceAll("gl_InstanceID","u_instanceID"));const F=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);P.shaderSource(F,O),P.compileShader(F),P.attachShader(this.program,F);const Z=P.createShader(P.VERTEX_SHADER);P.isContextLost()?this.failedToCreate=!0:(P.shaderSource(Z,H),P.compileShader(Z),P.attachShader(this.program,Z),this.attributes={},P.linkProgram(this.program),P.deleteShader(Z),P.deleteShader(F),this.fixedUniforms=T(a),this.binderUniforms=b?b.getUniforms(a):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(Y=>({u_instanceID:new r.cg(Y)}))(a)),(E.includes("TERRAIN")||h.indexOf("symbol")!==-1||h.indexOf("circle")!==-1)&&(this.terrainUniforms=(Y=>({u_dem:new r.cg(Y),u_dem_prev:new r.cg(Y),u_dem_tl:new r.cj(Y),u_dem_scale:new r.ci(Y),u_dem_tl_prev:new r.cj(Y),u_dem_scale_prev:new r.ci(Y),u_dem_size:new r.ci(Y),u_dem_lerp:new r.ci(Y),u_exaggeration:new r.ci(Y),u_depth:new r.cg(Y),u_depth_size_inv:new r.cj(Y),u_depth_range_unpack:new r.cj(Y),u_occluder_half_size:new r.ci(Y),u_occlusion_depth_offset:new r.ci(Y),u_meter_to_dem:new r.ci(Y),u_label_plane_matrix_inv:new r.ck(Y)}))(a)),E.includes("GLOBE")&&(this.globeUniforms=(Y=>({u_tile_tl_up:new r.ch(Y),u_tile_tr_up:new r.ch(Y),u_tile_br_up:new r.ch(Y),u_tile_bl_up:new r.ch(Y),u_tile_up_scale:new r.ci(Y)}))(a)),E.includes("FOG")&&(this.fogUniforms=(Y=>({u_fog_matrix:new r.ck(Y),u_fog_range:new r.cj(Y),u_fog_color:new r.d2(Y),u_fog_horizon_blend:new r.ci(Y),u_fog_vertical_limit:new r.cj(Y),u_fog_temporal_offset:new r.ci(Y),u_frustum_tl:new r.ch(Y),u_frustum_tr:new r.ch(Y),u_frustum_br:new r.ch(Y),u_frustum_bl:new r.ch(Y),u_globe_pos:new r.ch(Y),u_globe_radius:new r.ci(Y),u_globe_transition:new r.ci(Y),u_is_globe:new r.cg(Y),u_viewport:new r.cj(Y)}))(a)),E.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(Y=>({u_cutoff_params:new r.d2(Y)}))(a)),E.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(Y=>({u_lighting_ambient_color:new r.ch(Y),u_lighting_directional_dir:new r.ch(Y),u_lighting_directional_color:new r.ch(Y),u_ground_radiance:new r.ch(Y)}))(a)),E.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(Y=>({u_light_matrix_0:new r.ck(Y),u_light_matrix_1:new r.ck(Y),u_fade_range:new r.cj(Y),u_shadow_normal_offset:new r.ch(Y),u_shadow_intensity:new r.ci(Y),u_shadow_texel_size:new r.ci(Y),u_shadow_map_resolution:new r.ci(Y),u_shadow_direction:new r.ch(Y),u_shadow_bias:new r.ch(Y),u_shadowmap_0:new r.cg(Y),u_shadowmap_1:new r.cg(Y)}))(a)))}getAttributeLocation(a,h){let y=this.attributes[h];return y===void 0&&(y=this.attributes[h]=a.getAttribLocation(this.program,h)),y}setTerrainUniformValues(a,h){if(!this.terrainUniforms)return;const y=this.terrainUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const b in h)y[b]&&y[b].set(this.program,b,h[b])}}setGlobeUniformValues(a,h){if(!this.globeUniforms)return;const y=this.globeUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const b in h)y[b]&&y[b].set(this.program,b,h[b])}}setFogUniformValues(a,h){if(!this.fogUniforms)return;const y=this.fogUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const b in h)y[b].set(this.program,b,h[b])}}setCutoffUniformValues(a,h){if(!this.cutoffUniforms)return;const y=this.cutoffUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const b in h)y[b].set(this.program,b,h[b])}}setLightsUniformValues(a,h){if(!this.lightsUniforms)return;const y=this.lightsUniforms;if(!this.failedToCreate){a.program.set(this.program);for(const b in h)y[b].set(this.program,b,h[b])}}setShadowUniformValues(a,h){if(this.failedToCreate||!this.shadowUniforms)return;const y=this.shadowUniforms;a.program.set(this.program);for(const b in h)y[b].set(this.program,b,h[b])}_drawDebugWireframe(a,h,y,b,T,E,P,M,L,O){const H=a.options.wireframe;if(H.terrain===!1&&H.layers2D===!1&&H.layers3D===!1)return;const F=a.context;if(!(!(!H.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!H.layers2D||a._terrain&&a._terrain.renderingToTexture||!O1.includes(this.name))||!(!H.layers3D||!F1.includes(this.name))))return;const Z=F.gl,Y=a.wireframeDebugCache.getLinesFromTrianglesBuffer(a.frameCounter,T,F);if(!Y)return;const J=[...this.fixedDefines];
3704J.push("DEBUG_WIREFRAME");const se=a.getOrCreateProgram(this.name,{config:this.configuration,defines:J});F.program.set(se.program);const ne=(ue,Ce,me)=>{if(Ce[ue]&&me[ue])for(const Ie in Ce[ue])me[ue][Ie]&&me[ue][Ie].set(me.program,Ie,Ce[ue][Ie].current)};L&&L.setUniforms(se.program,F,se.binderUniforms,P,{zoom:M}),ne("fixedUniforms",this,se),ne("terrainUniforms",this,se),ne("globeUniforms",this,se),ne("fogUniforms",this,se),ne("lightsUniforms",this,se),ne("shadowUniforms",this,se),Y.bind(),F.setColorMode(new mn([Z.ONE,Z.ONE_MINUS_SRC_ALPHA,Z.ZERO,Z.ONE],r.ao.transparent,[!0,!0,!0,!1])),F.setDepthMode(new hi(h.func===Z.LESS?Z.LEQUAL:h.func,hi.ReadOnly,h.range)),F.setStencilMode(Yi.disabled);const ae=3*E.primitiveLength*2,fe=3*E.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const ue=O||1;for(let Ce=0;Ce<ue;++Ce)se.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Ce),Z.drawElements(Z.LINES,ae,Z.UNSIGNED_SHORT,fe)}else O&&O>1?Z.drawElementsInstanced(Z.LINES,ae,Z.UNSIGNED_SHORT,fe,O):Z.drawElements(Z.LINES,ae,Z.UNSIGNED_SHORT,fe);T.bind(),F.program.set(this.program),F.setDepthMode(h),F.setStencilMode(y),F.setColorMode(b)}checkUniforms(a,h,y){if(this.fixedDefines.includes(h)){for(const b of Object.keys(y))if(!y[b].initialized)throw new Error(`Program '${this.name}', from draw '${a}': uniform ${b} not set but required by ${h} being defined`)}}draw(a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se){const ne=a.context,ae=ne.gl;if(this.failedToCreate)return;ne.program.set(this.program),ne.setDepthMode(y),ne.setStencilMode(b),ne.setColorMode(T),ne.setCullFace(E);for(const Ce of Object.keys(this.fixedUniforms))this.fixedUniforms[Ce].set(this.program,Ce,P[Ce]);Y&&Y.setUniforms(this.program,ne,this.binderUniforms,F,{zoom:Z});const fe={[ae.POINTS]:1,[ae.LINES]:2,[ae.TRIANGLES]:3,[ae.LINE_STRIP]:1}[h];this.checkUniforms(M,"RENDER_SHADOWS",this.shadowUniforms);const ue=se&&se>0?1:void 0;for(const Ce of H.get()){const me=Ce.vaos||(Ce.vaos={});if((me[M]||(me[M]=new If)).bind(ne,this,L,Y?Y.getPaintVertexBuffers():[],O,Ce.vertexOffset,J||[],ue),this.forceManualRenderingForInstanceIDShaders){const Ie=se||1;for(let Se=0;Se<Ie;++Se)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Se),O?ae.drawElements(h,Ce.primitiveLength*fe,ae.UNSIGNED_SHORT,Ce.primitiveOffset*fe*2):ae.drawArrays(h,Ce.vertexOffset,Ce.vertexLength)}else se&&se>1?ae.drawElementsInstanced(h,Ce.primitiveLength*fe,ae.UNSIGNED_SHORT,Ce.primitiveOffset*fe*2,se):O?ae.drawElements(h,Ce.primitiveLength*fe,ae.UNSIGNED_SHORT,Ce.primitiveOffset*fe*2):ae.drawArrays(h,Ce.vertexOffset,Ce.vertexLength);h===ae.TRIANGLES&&O&&this._drawDebugWireframe(a,y,b,T,O,Ce,F,Z,Y,se)}}}function Ov(g,a,h=0){const y=Math.pow(2,a.tileID.overscaledZ),b=a.tileSize*Math.pow(2,g.transform.tileZoom)/y,T=b*(a.tileID.canonical.x+a.tileID.wrap*y),E=b*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture?a.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/r.ay(a,1,g.transform.tileZoom),u_pixel_coord_upper:[T>>16,E>>16],u_pixel_coord_lower:[65535&T,65535&E],u_pattern_transition:h}}const Df={terrain:0,flat:1},Fv=r.bB(),Bv=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne)=>{const ae=a.style.light,fe=ae.properties.get("position"),ue=[fe.x,fe.y,fe.z],Ce=r.dN();ae.properties.get("anchor")==="viewport"&&(r.dO(Ce,-a.transform.angle),r.dP(ue,ue,Ce));const me=ae.properties.get("color").toPremultipliedRenderColor(null),Ie=a.transform,Se={u_matrix:g,u_lightpos:ue,u_lightintensity:ae.properties.get("intensity"),u_lightcolor:[me.r,me.g,me.b],u_vertical_gradient:+h,u_opacity:y,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Fv,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Df[L],u_base_type:Df[O],u_ao:b,u_edge_radius:T,u_width_scale:E,u_flood_light_color:Y,u_vertical_scale:J,u_flood_light_intensity:se,u_ground_shadow_factor:ne};return Ie.projection.name==="globe"&&(Se.u_tile_id=[P.canonical.x,P.canonical.y,1<<P.canonical.z],Se.u_zoom_transition=H,Se.u_inv_rot_matrix=Z,Se.u_merc_center=F,Se.u_up_dir=Ie.projection.upVector(new r.cC(0,0,0),F[0]*r.al,F[1]*r.al),Se.u_height_lift=M),Se},n2=(g,a,h,y,b,T)=>({u_matrix:g,u_edge_radius:a,u_width_scale:h,u_vertical_scale:y,u_height_type:Df[b],u_base_type:Df[T]}),r2=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne)=>{const ae=Bv(g,a,h,y,b,T,E,P,L,O,H,F,Z,Y,J,se,1,[0,0,0]),fe={u_height_factor:-Math.pow(2,P.overscaledZ
vendor: 5,420 bytes, line 3704
3704)/M.tileSize/8};return Object.assign(ae,Ov(a,M,ne),fe)},Rf=(g,a,h,y,b,T,E,P,M,L,O)=>({u_matrix:a,u_opacity:h,u_ao_pass:y?1:0,u_meter_to_tile:b,u_ao:T,u_flood_light_intensity:E,u_flood_light_color:P,u_attenuation:M,u_edge_radius:L,u_fb:0,u_fb_size:O,u_dynamic_offset:1}),s2=(g,a,h)=>({u_matrix:g,u_emissive_strength:a,u_ground_shadow_factor:h}),o2=(g,a,h,y,b,T=0)=>Object.assign(s2(g,a,b),Ov(h,y,T)),uD=(g,a,h,y)=>({u_matrix:g,u_world:h,u_emissive_strength:a,u_ground_shadow_factor:y}),dD=(g,a,h,y,b,T,E=0)=>Object.assign(o2(g,a,h,y,T,E),{u_world:b}),hD=(g,a)=>({u_matrix:g,u_ground_shadow_factor:a}),Uv=(g,a,h,y,b)=>({u_matrix:g,u_camera_pos:[a[0],a[1],a[2]],u_depth_bias:h,u_height_scale:y,u_reset_depth:b}),B1=(g,a,h,y,b,T,E,P,M)=>({u_matrix:g,u_normal_matrix:a,u_opacity:h,u_faux_facade_ao_intensity:y,u_camera_pos:b,u_tile_to_meter:T,u_facade_emissive_chance:E,u_flood_light_color:P,u_flood_light_intensity:M}),U1=g=>({u_matrix:g}),a2=g=>({u_matrix:g}),jf=(g,a,h,y,b,T,E,P)=>{const M=r.al/T.tileSize;return{u_matrix:g,u_inv_rot_matrix:a,u_camera_to_center_distance:h.getCameraToCenterDistance(P),u_extrude_scale:[h.pixelsToGLUnits[0]/M,h.pixelsToGLUnits[1]/M],u_zoom_transition:y,u_tile_id:E,u_merc_center:b}},V1=(g,a,h=1)=>({u_matrix:g,u_color:a,u_overlay:0,u_overlay_scale:h}),l2=r.bB(),c2=(g,a,h,y,b,T,E)=>{const P=g.transform,M=P.projection.name==="globe",L=M?r.dQ(P.zoom,a.canonical)*P._pixelsPerMercatorPixel:r.ay(h,1,T),O={u_matrix:a.projMatrix,u_extrude_scale:L,u_intensity:E,u_inv_rot_matrix:l2,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(M){O.u_inv_rot_matrix=y,O.u_merc_center=b,O.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],O.u_zoom_transition=r.aj(P.zoom);const H=b[0]*r.al,F=b[1]*r.al;O.u_up_dir=P.projection.upVector(new r.cC(0,0,0),H,F)}return O};function Vv(g,[a,h,y,b],[T,E]){if(T===E)return[0,0,0,0];const P=255*(g-1)/(g*(E-T));return[a*P,h*P,y*P,b*P]}function Yu(g,a,[h,y]){return h===y?0:.5/g+(a-h)*(g-1)/(g*(y-h))}const xy=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae,fe,ue)=>({u_matrix:g,u_normalize_matrix:a,u_globe_matrix:h,u_merc_matrix:y,u_grid_matrix:b,u_tl_parent:T,u_scale_parent:L,u_fade_t:O.mix,u_opacity:O.opacity*H.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:H.paint.get("raster-brightness-min"),u_brightness_high:H.paint.get("raster-brightness-max"),u_saturation_factor:r.dS(H.paint.get("raster-saturation")),u_contrast_factor:r.dR(H.paint.get("raster-contrast")),u_spin_weights:$v(H.paint.get("raster-hue-rotate")),u_perspective_transform:F,u_raster_elevation:Z,u_zoom_transition:E,u_merc_center:P,u_cutoff_params:M,u_colorization_mix:Vv(r.dT,J,ne),u_colorization_offset:Yu(r.dT,se,ne),u_color_ramp:Y,u_texture_offset:[fe/(ae+2*fe),ae/(ae+2*fe)],u_texture_res:[ae+2*fe,ae+2*fe],u_emissive_strength:ue});function $v(g){g*=Math.PI/180;const a=Math.sin(g),h=Math.cos(g);return[(2*h+1)/3,(-Math.sqrt(3)*a-h+1)/3,(Math.sqrt(3)*a-h+1)/3]}const dp=.05,Jd=(g,a,h,y,b,T,E,P,M,L,O,H)=>({u_matrix:g,u_normalize_matrix:a,u_globe_matrix:h,u_merc_matrix:y,u_grid_matrix:b,u_tl_parent:T,u_scale_parent:L,u_fade_t:O.mix,u_opacity:O.opacity,u_image0:0,u_image1:1,u_raster_elevation:H,u_zoom_transition:E,u_merc_center:P,u_cutoff_params:M}),$1=(g,a,h,y,b,T,E,P,M,L)=>({u_particle_texture:g,u_particle_texture_side_len:a,u_tile_offset:h,u_velocity:y,u_color_ramp:T,u_velocity_res:b,u_max_speed:E,u_uv_offset:P,u_data_scale:[255*M[0],255*M[1]],u_data_offset:L,u_particle_pos_scale:1.1,u_particle_pos_offset:[dp,dp]}),qv=(g,a,h,y,b,T,E,P,M,L)=>({u_particle_texture:g,u_particle_texture_side_len:a,u_velocity:h,u_velocity_res:y,u_max_speed:b,u_speed_factor:T,u_reset_rate:E,u_rand_seed:Math.random(),u_uv_offset:P,u_data_scale:[255*M[0],255*M[1]],u_data_offset:L,u_particle_pos_scale:1.1,u_particle_pos_offset:[dp,dp]}),q1=r.bB(),H1=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae,fe,ue,Ce,me,Ie)=>{const Se=b.transform,ve={u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:Se.getCameraToCenterDistance(ae),u_rotate_symbol:+h,u_aspect_ratio:Se.width/Se.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_matrix:T,u_label_plane_matrix:E,u_coord_matrix:P,u_is_text:+L,u_elevation_from_sea:M?1:0,u_pitch_with_map:+y,u_texsize:O,u_texsize_icon:H,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:q1,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:q1,u_up_vector:[0,-1,0],u_color_adj_mat:Ce,u_icon_transition:me||0,u_gamma_scale:y?b.transform.getCameraToCenterDistance(ae)*Math.cos(b.terrain?0:b.transform._pitch):1,u_device_pixel_ratio:r.o.devicePixelRatio,u_is_halo:1,u_scale_factor:Ie||1,u_ground_shadow_factor:fe,u_inv_matrix:r.bk(r.bB(),E),u_normal_scale:ue,u_lutTexture:Ro.LUT};return ae.name==="globe"&&(ve.u_tile_id=[Z.canonical.x,Z.canonical.y,1<<Z.canonical.z],ve.u_zoom_transition=Y,ve.u_inv_rot_matrix=se,ve.u_merc_center=J,ve.u_camera_forward=Se._camera.forward(),ve.u_ecef_origin=r.dU(Se.globeMatrix,Z.toUnwrapped()),ve.u_tile_matrix=Float32Array.from(Se.globeMatrix),ve.u_up_vector=ne),ve},Hv=(g,a,h,y)=>({u_matrix:g,u_emissive_strength:a,u_opacity:h,u_color:y}),Gv=(g,a,h,y,b,T,E,P,M)=>Object.assign(function(L,O,H,F,Z,Y){const{width:J,height:se}=F.imageManager.getPixelSize(O),ne=Math.pow(2,Y.tileID.overscaledZ
3704),ae=Y.tileSize*Math.pow(2,F.transform.tileZoom)/ne,fe=ae*(Y.tileID.canonical.x+Y.tileID.wrap*ne),ue=ae*Y.tileID.canonical.y;return{u_image:0,u_pattern_tl:H.tl,u_pattern_br:H.br,u_texsize:[J,se],u_pattern_size:H.displaySize,u_pattern_units_to_pixels:Z?[F.transform.width,-1*F.transform.height]:[1/r.ay(Y,1,F.transform.tileZoom),1/r.ay(Y,1,F.transform.tileZoom)],u_pixel_coord_upper:[fe>>16,ue>>16],u_pixel_coord_lower:[65535&fe,65535&ue]}}(0,T,E,y,P,M),{u_matrix:g,u_emissive_strength:a,u_opacity:h}),G1=new Float32Array(r.bz([])),Wv=(g,a,h,y,b,T,E,P,M,L,O,H,F,Z=[0,0,0],Y,J,se)=>{const ne=b.style.light,ae=ne.properties.get("position"),fe=[-ae.x,-ae.y,ae.z],ue=r.dN();ne.properties.get("anchor")==="viewport"&&(r.dO(ue,-b.transform.angle),r.dP(fe,fe,ue));const Ce=O.alphaMode==="MASK",me=ne.properties.get("color").toNonPremultipliedRenderColor(null),Ie=F.paint.get("model-ambient-occlusion-intensity"),Se=F.paint.get("model-color").constantOr(r.ao.white).toNonPremultipliedRenderColor(null);return Se.a=F.paint.get("model-color-mix-intensity").constantOr(0),se&&(Se.r=se[0],Se.g=se[1],Se.b=se[2],Se.a=se[3]),J&&(Se.r=J.color.r,Se.g=J.color.g,Se.b=J.color.b,Se.a=J.colorMix,H=J.emissionStrength,T=J.opacity),{u_matrix:g,u_lighting_matrix:a,u_normal_matrix:h,u_node_matrix:y||G1,u_lightpos:fe,u_lightintensity:ne.properties.get("intensity"),u_lightcolor:[me.r,me.g,me.b],u_camera_pos:Z,u_opacity:T,u_baseTextureIsAlpha:0,u_alphaMask:+Ce,u_alphaCutoff:O.alphaCutoff,u_baseColorFactor:E.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:P.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:M,u_roughnessFactor:L,u_baseColorTexture:Ro.BaseColor,u_metallicRoughnessTexture:Ro.MetallicRoughness,u_normalTexture:Ro.Normal,u_occlusionTexture:Ro.Occlusion,u_emissionTexture:Ro.Emission,u_lutTexture:Ro.LUT,u_color_mix:Se.toArray01(),u_aoIntensity:Ie,u_emissive_strength:H,u_occlusionTextureTransform:Y||[0,0,0,0]}},zf=(g,a=G1,h=G1)=>({u_matrix:g,u_instance:a,u_node_matrix:h}),pD={fillExtrusion:g=>({u_matrix:new r.ck(g),u_lightpos:new r.ch(g),u_lightintensity:new r.ci(g),u_lightcolor:new r.ch(g),u_vertical_gradient:new r.ci(g),u_opacity:new r.ci(g),u_edge_radius:new r.ci(g),u_width_scale:new r.ci(g),u_ao:new r.cj(g),u_height_type:new r.cg(g),u_base_type:new r.cg(g),u_tile_id:new r.ch(g),u_zoom_transition:new r.ci(g),u_inv_rot_matrix:new r.ck(g),u_merc_center:new r.cj(g),u_up_dir:new r.ch(g),u_height_lift:new r.ci(g),u_flood_light_color:new r.ch(g),u_vertical_scale:new r.ci(g),u_flood_light_intensity:new r.ci(g),u_ground_shadow_factor:new r.ch(g)}),fillExtrusionDepth:g=>({u_matrix:new r.ck(g),u_edge_radius:new r.ci(g),u_width_scale:new r.ci(g),u_vertical_scale:new r.ci(g),u_height_type:new r.cg(g),u_base_type:new r.cg(g)}),fillExtrusionPattern:g=>({u_matrix:new r.ck(g),u_lightpos:new r.ch(g),u_lightintensity:new r.ci(g),u_lightcolor:new r.ch(g),u_vertical_gradient:new r.ci(g),u_height_factor:new r.ci(g),u_edge_radius:new r.ci(g),u_width_scale:new r.ci(g),u_ao:new r.cj(g),u_height_type:new r.cg(g),u_base_type:new r.cg(g),u_tile_id:new r.ch(g),u_zoom_transition:new r.ci(g),u_inv_rot_matrix:new r.ck(g),u_merc_center:new r.cj(g),u_up_dir:new r.ch(g),u_height_lift:new r.ci(g),u_image:new r.cg(g),u_texsize:new r.cj(g),u_pixel_coord_upper:new r.cj(g),u_pixel_coord_lower:new r.cj(g),u_tile_units_to_pixels:new r.ci(g),u_opacity:new r.ci(g),u_pattern_transition:new r.ci(g)}),fillExtrusionGroundEffect:g=>({u_matrix:new r.ck(g),u_opacity:new r.ci(g),u_ao_pass:new r.ci(g),u_meter_to_tile:new r.ci(g),u_ao:new r.cj(g),u_flood_light_intensity:new r.ci(g),u_flood_light_color:new r.ch(g),u_attenuation:new r.ci(g),u_edge_radius:new r.ci(g),u_fb:new r.cg(g),u_fb_size:new r.ci(g),u_dynamic_offset:new r.ci(g)}),fill:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_ground_shadow_factor:new r.ch(g)}),fillPattern:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_image:new r.cg(g),u_texsize:new r.cj(g),u_pixel_coord_upper:new r.cj(g),u_pixel_coord_lower:new r.cj(g),u_tile_units_to_pixels:new r.ci(g),u_ground_shadow_factor:new r.ch(g),u_pattern_transition:new r.ci(g)}),fillOutline:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_world:new r.cj(g),u_ground_shadow_factor:new r.ch(g)}),fillOutlinePattern:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_world:new r.cj(g),u_image:new r.cg(g),u_texsize:new r.cj(g),u_pixel_coord_upper:new r.cj(g),u_pixel_coord_lower:new r.cj(g),u_tile_units_to_pixels:new r.ci(g),u_ground_shadow_factor:new r.ch(g),u_pattern_transition:new r.ci(g)}),building:g=>({u_matrix:new r.ck(g),u_normal_matrix:new r.ck(g),u_opacity:new r.ci(g),u_faux_facade_ao_intensity:new r.ci(g),u_c
3704amera_pos:new r.ch(g),u_tile_to_meter:new r.ci(g),u_facade_emissive_chance:new r.ci(g),u_flood_light_color:new r.ch(g),u_flood_light_intensity:new r.ci(g)}),buildingBloom:g=>({u_matrix:new r.ck(g)}),buildingDepth:g=>({u_matrix:new r.ck(g)}),elevatedStructuresDepth:g=>({u_matrix:new r.ck(g),u_depth_bias:new r.ci(g)}),elevatedStructures:g=>({u_matrix:new r.ck(g),u_ground_shadow_factor:new r.ch(g)}),elevatedStructuresDepthReconstruct:g=>({u_matrix:new r.ck(g),u_camera_pos:new r.ch(g),u_depth_bias:new r.ci(g),u_height_scale:new r.ci(g),u_reset_depth:new r.ci(g)}),circle:r.dX,collisionBox:g=>({u_matrix:new r.ck(g),u_inv_rot_matrix:new r.ck(g),u_camera_to_center_distance:new r.ci(g),u_extrude_scale:new r.cj(g),u_zoom_transition:new r.ci(g),u_merc_center:new r.cj(g),u_tile_id:new r.ch(g)}),collisionCircle:g=>({u_matrix:new r.ck(g),u_inv_matrix:new r.ck(g),u_camera_to_center_distance:new r.ci(g),u_viewport_size:new r.cj(g)}),debug:g=>({u_color:new r.dA(g),u_matrix:new r.ck(g),u_overlay:new r.cg(g),u_overlay_scale:new r.ci(g)}),clippingMask:g=>({u_matrix:new r.ck(g)}),heatmap:g=>({u_extrude_scale:new r.ci(g),u_intensity:new r.ci(g),u_matrix:new r.ck(g),u_inv_rot_matrix:new r.ck(g),u_merc_center:new r.cj(g),u_tile_id:new r.ch(g),u_zoom_transition:new r.ci(g),u_up_dir:new r.ch(g)}),heatmapTexture:g=>({u_image:new r.cg(g),u_color_ramp:new r.cg(g),u_opacity:new r.ci(g)}),hillshade:g=>({u_matrix:new r.ck(g),u_image:new r.cg(g),u_latrange:new r.cj(g),u_light:new r.cj(g),u_shadow:new r.dA(g),u_highlight:new r.dA(g),u_emissive_strength:new r.ci(g),u_accent:new r.dA(g)}),hillshadePrepare:g=>({u_matrix:new r.ck(g),u_image:new r.cg(g),u_dimension:new r.cj(g),u_zoom:new r.ci(g)}),line:r.dW,linePattern:r.dV,raster:g=>({u_matrix:new r.ck(g),u_normalize_matrix:new r.ck(g),u_globe_matrix:new r.ck(g),u_merc_matrix:new r.ck(g),u_grid_matrix:new r.dB(g),u_tl_parent:new r.cj(g),u_scale_parent:new r.ci(g),u_fade_t:new r.ci(g),u_opacity:new r.ci(g),u_image0:new r.cg(g),u_image1:new r.cg(g),u_brightness_low:new r.ci(g),u_brightness_high:new r.ci(g),u_saturation_factor:new r.ci(g),u_contrast_factor:new r.ci(g),u_spin_weights:new r.ch(g),u_perspective_transform:new r.cj(g),u_raster_elevation:new r.ci(g),u_zoom_transition:new r.ci(g),u_merc_center:new r.cj(g),u_cutoff_params:new r.d2(g),u_colorization_mix:new r.d2(g),u_colorization_offset:new r.ci(g),u_color_ramp:new r.cg(g),u_texture_offset:new r.cj(g),u_texture_res:new r.cj(g),u_emissive_strength:new r.ci(g)}),rasterParticle:g=>({u_matrix:new r.ck(g),u_normalize_matrix:new r.ck(g),u_globe_matrix:new r.ck(g),u_merc_matrix:new r.ck(g),u_grid_matrix:new r.dB(g),u_tl_parent:new r.cj(g),u_scale_parent:new r.ci(g),u_fade_t:new r.ci(g),u_opacity:new r.ci(g),u_image0:new r.cg(g),u_image1:new r.cg(g),u_raster_elevation:new r.ci(g),u_zoom_transition:new r.ci(g),u_merc_center:new r.cj(g),u_cutoff_params:new r.d2(g)}),rasterParticleTexture:g=>({u_texture:new r.cg(g),u_opacity:new r.ci(g)}),rasterParticleDraw:g=>({u_particle_texture:new r.cg(g),u_particle_texture_side_len:new r.ci(g),u_tile_offset:new r.cj(g),u_velocity:new r.cg(g),u_color_ramp:new r.cg(g),u_velocity_res:new r.cj(g),u_max_speed:new r.ci(g),u_uv_offset:new r.cj(g),u_data_scale:new r.cj(g),u_data_offset:new r.ci(g),u_particle_pos_scale:new r.ci(g),u_particle_pos_offset:new r.cj(g)}),rasterParticleUpdate:g=>({u_particle_texture:new r.cg(g),u_particle_texture_side_len:new r.ci(g),u_velocity:new r.cg(g),u_velocity_res:new r.cj(g),u_max_speed:new r.ci(g),u_speed_factor:new r.ci(g),u_reset_rate:new r.ci(g),u_rand_seed:new r.ci(g),u_uv_offset:new r.cj(g),u_data_scale:new r.cj(g),u_data_offset:new r.ci(g),u_particle_pos_scale:new r.ci(g),u_particle_pos_offset:new r.cj(g)}),symbol:g=>({u_is_size_zoom_constant:new r.cg(g),u_is_size_feature_constant:new r.cg(g),u_size_t:new r.ci(g),u_size:new r.ci(g),u_camera_to_center_distance:new r.ci(g),u_rotate_symbol:new r.cg(g),u_aspect_ratio:new r.ci(g),u_fade_change:new r.ci(g),u_matrix:new r.ck(g),u_label_plane_matrix:new r.ck(g),u_coord_matrix:new r.ck(g),u_is_text:new r.cg(g),u_elevation_from_sea:new r.cg(g),u_pitch_with_map:new r.cg(g),u_texsize:new r.cj(g),u_texsize_icon:new r.cj(g),u_texture:new r.cg(g),u_texture_icon:new r.cg(g),u_gamma_scale:new r.ci(g),u_device_pixel_ratio:new r.ci(g),u_tile_id:new r.ch(g),u_zoom_transition:new r.ci(g),u_inv_rot_matrix:new r.ck(g),u_merc_center:new r.cj(g),u_c
vendor: 5,857 bytes, line 3704
3704amera_forward:new r.ch(g),u_tile_matrix:new r.ck(g),u_up_vector:new r.ch(g),u_ecef_origin:new r.ch(g),u_is_halo:new r.cg(g),u_icon_transition:new r.ci(g),u_color_adj_mat:new r.ck(g),u_scale_factor:new r.ci(g),u_ground_shadow_factor:new r.ch(g),u_inv_matrix:new r.ck(g),u_normal_scale:new r.ci(g),u_lutTexture:new r.cg(g)}),background:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_opacity:new r.ci(g),u_color:new r.dA(g)}),backgroundPattern:g=>({u_matrix:new r.ck(g),u_emissive_strength:new r.ci(g),u_opacity:new r.ci(g),u_image:new r.cg(g),u_pattern_tl:new r.cj(g),u_pattern_br:new r.cj(g),u_texsize:new r.cj(g),u_pattern_size:new r.cj(g),u_pixel_coord_upper:new r.cj(g),u_pixel_coord_lower:new r.cj(g),u_pattern_units_to_pixels:new r.cj(g)}),terrainRaster:g=>({u_matrix:new r.ck(g),u_image0:new r.cg(g),u_skirt_height:new r.ci(g),u_ground_shadow_factor:new r.ch(g)}),skybox:g=>({u_matrix:new r.ck(g),u_sun_direction:new r.ch(g),u_cubemap:new r.cg(g),u_opacity:new r.ci(g),u_temporal_offset:new r.ci(g)}),skyboxGradient:g=>({u_matrix:new r.ck(g),u_color_ramp:new r.cg(g),u_center_direction:new r.ch(g),u_radius:new r.ci(g),u_opacity:new r.ci(g),u_temporal_offset:new r.ci(g)}),skyboxCapture:g=>({u_matrix_3f:new r.dB(g),u_sun_direction:new r.ch(g),u_sun_intensity:new r.ci(g),u_color_tint_r:new r.d2(g),u_color_tint_m:new r.d2(g),u_luminance:new r.ci(g)}),globeRaster:g=>({u_proj_matrix:new r.ck(g),u_globe_matrix:new r.ck(g),u_normalize_matrix:new r.ck(g),u_merc_matrix:new r.ck(g),u_zoom_transition:new r.ci(g),u_merc_center:new r.cj(g),u_image0:new r.cg(g),u_grid_matrix:new r.dB(g),u_skirt_height:new r.ci(g),u_far_z_cutoff:new r.ci(g),u_frustum_tl:new r.ch(g),u_frustum_tr:new r.ch(g),u_frustum_br:new r.ch(g),u_frustum_bl:new r.ch(g),u_globe_pos:new r.ch(g),u_globe_radius:new r.ci(g),u_viewport:new r.cj(g)}),globeAtmosphere:g=>({u_frustum_tl:new r.ch(g),u_frustum_tr:new r.ch(g),u_frustum_br:new r.ch(g),u_frustum_bl:new r.ch(g),u_horizon:new r.ci(g),u_transition:new r.ci(g),u_fadeout_range:new r.ci(g),u_atmosphere_fog_color:new r.d2(g),u_high_color:new r.d2(g),u_space_color:new r.d2(g),u_temporal_offset:new r.ci(g),u_horizon_angle:new r.ci(g)}),model:g=>({u_matrix:new r.ck(g),u_lighting_matrix:new r.ck(g),u_normal_matrix:new r.ck(g),u_node_matrix:new r.ck(g),u_lightpos:new r.ch(g),u_lightintensity:new r.ci(g),u_lightcolor:new r.ch(g),u_camera_pos:new r.ch(g),u_opacity:new r.ci(g),u_baseColorFactor:new r.d2(g),u_emissiveFactor:new r.d2(g),u_metallicFactor:new r.ci(g),u_roughnessFactor:new r.ci(g),u_baseTextureIsAlpha:new r.cg(g),u_alphaMask:new r.cg(g),u_alphaCutoff:new r.ci(g),u_baseColorTexture:new r.cg(g),u_metallicRoughnessTexture:new r.cg(g),u_normalTexture:new r.cg(g),u_occlusionTexture:new r.cg(g),u_emissionTexture:new r.cg(g),u_lutTexture:new r.cg(g),u_color_mix:new r.d2(g),u_aoIntensity:new r.ci(g),u_emissive_strength:new r.ci(g),u_occlusionTextureTransform:new r.d2(g)}),modelDepth:g=>({u_matrix:new r.ck(g),u_instance:new r.ck(g),u_node_matrix:new r.ck(g)}),groundShadow:g=>({u_matrix:new r.ck(g),u_ground_shadow_factor:new r.ch(g)}),stars:g=>({u_matrix:new r.ck(g),u_up:new r.ch(g),u_right:new r.ch(g),u_intensity_multiplier:new r.ci(g)}),snowParticle:g=>({u_modelview:new r.ck(g),u_projection:new r.ck(g),u_time:new r.ci(g),u_cam_pos:new r.ch(g),u_velocityConeAperture:new r.ci(g),u_velocity:new r.ci(g),u_horizontalOscillationRadius:new r.ci(g),u_horizontalOscillationRate:new r.ci(g),u_boxSize:new r.ci(g),u_billboardSize:new r.ci(g),u_simpleShapeParameters:new r.cj(g),u_screenSize:new r.cj(g),u_thinningCenterPos:new r.cj(g),u_thinningShape:new r.ch(g),u_thinningAffectedRatio:new r.ci(g),u_thinningParticleOffset:new r.ci(g),u_particleColor:new r.d2(g),u_direction:new r.ch(g)}),rainParticle:g=>({u_modelview:new r.ck(g),u_projection:new r.ck(g),u_time:new r.ci(g),u_cam_pos:new r.ch(g),u_texScreen:new r.cg(g),u_velocityConeAperture:new r.ci(g),u_velocity:new r.ci(g),u_boxSize:new r.ci(g),u_rainDropletSize:new r.cj(g),u_distortionStrength:new r.ci(g),u_rainDirection:new r.ch(g),u_color:new r.d2(g),u_screenSize:new r.cj(g),u_thinningCenterPos:new r.cj(g),u_thinningShape:new r.ch(g),u_thinningAffectedRatio:new r.ci(g),u_thinningParticleOffset:new r.ci(g),u_shapeDirectionalPower:new r.ci(g),u_shapeNormalPower:new r.ci(g),u_mode:new r.ci(g)}),vignette:g=>({u_vignetteShape:new r.ch(g),u_vignetteColor:new r.d2(g)}),occlusion:g=>({u_matrix:new r.ck(g),u_anchorPos:new r.ch(g),u_screenSizePx:new r.cj(g),u_occluderSizePx:new r.cj(g),u_color:new r.d2(g)})};class eh{constructor(a,h,y,b){this.id=eh.uniqueIdxCounter,eh.uniqueIdxCounter++,this.context=a;const T=a.gl;this.buffer=T.createBuffer(),this.dynamicDraw=!!y,this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),T.bufferData(T.ELEMENT_ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?T.DYNAMIC_DRAW:T.STATIC_DRAW),this.dynamicDraw||b||h.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){this.id=eh.uniqueIdxCounter,eh.uniqueIdxCounter++;const h=this.context.gl;this.context.unbindVAO(),this.bind(),h.bufferSubData(h.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}eh.uniqueIdxCounter=0;const u2={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class fD{constructor(a,h,y,b,T,E){this.length=h.length,this.attributes=y,this.itemSize=h.bytesPerElement,this.dynamicDraw=b,this.instanceCount=E,this.context=a;const P=a.gl;this.buffer=P.createBuffer(),a.bindVertexBuffer.set(this.buffer),P.bufferData(P.ARRAY_BUFFER,h.arrayBuffer,this.dynamicDraw?P.DYNAMIC_DRAW:P.STATIC_DRAW),this.dynamicDraw||T||h.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){const h=this.context.gl;this.bind(),h.bufferSubData(h.ARRAY_BUFFER,0,a.arrayBuffer)}
3704enableAttributes(a,h){for(let y=0;y<this.attributes.length;y++){const b=h.getAttributeLocation(a,this.attributes[y].name);b!==-1&&a.enableVertexAttribArray(b)}}setVertexAttribPointers(a,h,y){for(let b=0;b<this.attributes.length;b++){const T=this.attributes[b],E=h.getAttributeLocation(a,T.name);E!==-1&&a.vertexAttribPointer(E,T.components,a[u2[T.type]],!1,this.itemSize,T.offset+this.itemSize*(y||0))}}setVertexAttribDivisor(a,h,y){for(let b=0;b<this.attributes.length;b++){const T=h.getAttributeLocation(a,this.attributes[b].name);T!==-1&&this.instanceCount&&this.instanceCount>0&&a.vertexAttribDivisor(T,y)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Kv{constructor(a,h,y,b,T){this.context=a,this.width=h,this.height=y;const E=this.framebuffer=a.gl.createFramebuffer();b&&(this.colorAttachment=new lD(a,E)),T&&(this.depthAttachmentType=T,this.depthAttachment=T==="renderbuffer"?new t2(a,E):new cD(a,E))}destroy(){const a=this.context.gl;if(this.colorAttachment){const h=this.colorAttachment.get();h&&a.deleteTexture(h)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const h=this.depthAttachment.get();h&&a.deleteRenderbuffer(h)}else{const h=this.depthAttachment.get();h&&a.deleteTexture(h)}a.deleteFramebuffer(this.framebuffer)}}class Zv{constructor(a,h){this.gl=a,this.clearColor=new WE(this),this.clearDepth=new I1(this),this.clearStencil=new iD(this),this.colorMask=new nD(this),this.depthMask=new rD(this),this.stencilMask=new sD(this),this.stencilFunc=new KE(this),this.stencilOp=new oD(this),this.stencilTest=new kv(this),this.depthRange=new aD(this),this.depthTest=new ZE(this),this.depthFunc=new k1(this),this.blend=new Pv(this),this.blendFunc=new P1(this),this.blendColor=new lp(this),this.blendEquation=new kf(this),this.cullFace=new fy(this),this.cullFaceSide=new Pf(this),this.frontFace=new XE(this),this.program=new N1(this),this.activeTexture=new YE(this),this.viewport=new Nf(this),this.bindFramebuffer=new Nv(this),this.bindRenderbuffer=new Mv(this),this.bindTexture=new M1(this),this.bindVertexBuffer=new Dv(this),this.bindElementBuffer=new my(this),this.bindVertexArrayOES=new QE(this),this.pixelStoreUnpack=new JE(this),this.pixelStoreUnpackPremultiplyAlpha=new e2(this),this.pixelStoreUnpackFlipY=new Mf(this),this.options=h?Object.assign({},h):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=a.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=a.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=a.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=a.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=h&&!!h.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=a.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=a.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=a.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE),this.maxPointSize=a.getParameter(a.ALIASED_POINT_SIZE_RANGE)[1]}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(a,h,y){return new eh(this,a,h,y)}createVertexBuffer(a,h,y,b,T){return new fD(this,a,h,y,b,T)}createRenderbuffer(a,h,y){const b=this.gl,T=b.createRenderbuffer();return this.bindRenderbuffer.set(T),b.renderbufferStorage(b.RENDERBUFFER,a,h,y),this.bindRenderbuffer.set(null),T}createFramebuffer(a,h,y,b){return new Kv(this,a,h,y,b)}clear({color:a,depth:h,stencil:y,colorMask:b}){const T=this.gl;let E=0;a&&(E|=T.COLOR_BUFFER_BIT,this.clearColor.set(a.toNonPremultipliedRenderColor(null)),this.colorMask.set(b||[!0,!0,!0,!0])),h!==void 0&&(E|=T.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(h),this.depthMask.set(!0)),y!==void 0&&(E|=T.STENCIL_BUFFER_BIT,this.clearStencil.set(y),this.stencilMask.set(255)),T.clear(E)}
vendor: 25,884 bytes, line 3704
3704setCullFace(a){a.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(a.mode),this.frontFace.set(a.frontFace))}setDepthMode(a){a.func!==this.gl.ALWAYS||a.mask?(this.depthTest.set(!0),this.depthFunc.set(a.func),this.depthMask.set(a.mask),this.depthRange.set(a.range)):this.depthTest.set(!1)}setStencilMode(a){a.test.func!==this.gl.ALWAYS||a.mask?(this.stencilTest.set(!0),this.stencilMask.set(a.mask),this.stencilOp.set([a.fail,a.depthFail,a.pass]),this.stencilFunc.set({func:a.test.func,ref:a.ref,mask:a.test.mask})):this.stencilTest.set(!1)}setColorMode(a){r.bx(a.blendFunction,mn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(a.blendFunction),this.blendColor.set(a.blendColor),a.blendEquation?this.blendEquation.set(a.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(a.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let _u;function by(g,a,h,y,b,T,E){const P=g.context,M=P.gl,L=g.transform,O=[r.aF(L.center.lng),r.aJ(L.center.lat)],H=h.layout.get("symbol-placement"),F=h.layout.get("text-variable-anchor"),Z=h.layout.get("icon-rotation-alignment")==="map",Y=h.layout.get("text-rotation-alignment")==="map",J=H!=="point",se=[];let ne=0,ae=0;for(let ve=0;ve<y.length;ve++){const ke=y[ve],Ke=a.getTile(ke),$e=Ke.getBucket(h);if(!$e)continue;const ct=$e.getProjection().createInversionMatrix(L,ke.canonical),it=[],gt=BE(ke,$e,L),jt=!E&&Z&&J,et=E&&Y&&J,Oe=F&&$e.hasTextData(),yt=$e.hasIconTextFit()&&Oe&&$e.hasIconData(),nt=jt||et||E&&Oe||yt,wt=$e.projection.name==="globe",Bt=wt?r.aj(L.zoom):0;wt&&(it.push("PROJECTION_GLOBE_VIEW"),nt&&it.push("PROJECTED_POS_ON_VIEWPORT"));const oi=g.getOrCreateProgram("collisionBox",{defines:it});let Mt=gt;b[0]===0&&b[1]===0||(Mt=g.translatePosMatrix(gt,Ke,b,T));const Lt=E?$e.textCollisionBox:$e.iconCollisionBox,li=$e.collisionCircleArray;if(li.length>0){const Yt=r.bB(),ii=Mt;r.cO(Yt,$e.placementInvProjMatrix,L.glCoordMatrix),r.cO(Yt,Yt,$e.placementViewportMatrix),se.push({circleArray:li,circleOffset:ae,transform:ii,invTransform:Yt,projection:$e.getProjection()}),ne+=li.length/4,ae=ne}if(!Lt)continue;g.terrain&&g.terrain.setupElevationDraw(Ke,oi);const ti=wt?[ke.canonical.x,ke.canonical.y,1<<ke.canonical.z]:[0,0,0];oi.draw(g,M.LINES,hi.disabled,Yi.disabled,g.colorModeForRenderPass(),$i.disabled,jf(Mt,ct,L,Bt,O,Ke,ti,$e.getProjection()),h.id,Lt.layoutVertexBuffer,Lt.indexBuffer,Lt.segments,null,L.zoom,null,[Lt.collisionVertexBuffer,Lt.collisionVertexBufferExt])}if(!E||!se.length)return;const fe=g.getOrCreateProgram("collisionCircle"),ue=new r.dY;ue.resize(4*ne),ue._trim();let Ce=0;for(const ve of se)for(let ke=0;ke<ve.circleArray.length/4;ke++){const Ke=4*ke,$e=ve.circleArray[Ke+0],ct=ve.circleArray[Ke+1],it=ve.circleArray[Ke+2],gt=ve.circleArray[Ke+3];ue.emplace(Ce++,$e,ct,it,gt,0),ue.emplace(Ce++,$e,ct,it,gt,1),ue.emplace(Ce++,$e,ct,it,gt,2),ue.emplace(Ce++,$e,ct,it,gt,3)}(!_u||_u.length<2*ne)&&(_u=function(ve){const ke=2*ve,Ke=new r.b0;Ke.resize(ke),Ke._trim();for(let $e=0;$e<ke;$e++){const ct=6*$e;Ke.uint16[ct+0]=4*$e+0,Ke.uint16[ct+1]=4*$e+1,Ke.uint16[ct+2]=4*$e+2,Ke.uint16[ct+3]=4*$e+2,Ke.uint16[ct+4]=4*$e+3,Ke.uint16[ct+5]=4*$e+0}return Ke}(ne));const me=P.createIndexBuffer(_u,!0),Ie=P.createVertexBuffer(ue,r.dZ.members,!0);for(const ve of se){const ke={u_matrix:ve.transform,u_inv_matrix:ve.invTransform,u_camera_to_center_distance:(Se=L).getCameraToCenterDistance(ve.projection),u_viewport_size:[Se.width,Se.height]};fe.draw(g,M.TRIANGLES,hi.disabled,Yi.disabled,g.colorModeForRenderPass(),$i.disabled,ke,h.id,Ie,me,r.bf.simpleSegment(0,2*ve.circleOffset,ve.circleArray.length,ve.circleArray.length/2),null,L.zoom)}var Se;Ie.destroy(),me.destroy()}const th=r.bB();function W1(g){const a=g._camera.getWorldToCamera(g.worldSize,1),h=r.aB([],a,g.globeMatrix);r.bk(h,h);const y=[0,0,0],b=[0,1,0,0];return r.aC(b,b,h),y[0]=b[0],y[1]=b[1],y[2]=b[2],r.aw(y,y),y}function Xv({width:g,height:a,anchor:h,textOffset:y,textScale:b},T){const{horizontalAlign:E,verticalAlign:P}=r.c0(h),M=-(E-.5)*g,L=-(P-.5)*a,O=r.c1(h,y);return new r.P((M/b+O[0])*T,(L/b+O[1])*T)}function Yv(g,a,h,y,b,T,E,P,M,L){const O=g.text.placedSymbolArray,H=g.text.dynamicLayoutVertexArray,F=g.icon.dynamicLayoutVertexArray,Z={},Y=g.getProjection(),J=yv(E,Y,b),se=b.elevation,ne=Y.upVectorScale(E.canonical,b.center.lat,b.worldSize).metersToTile;H.clear();for(let ae=0;ae<O.length;ae++){const fe=O.get(ae),{tileAnchorX:ue,tileAnchorY:Ce,numGlyphs:me}=fe,Ie=fe.hidden||!fe.crossTileID||g.allowVerticalPlacement&&!fe.placedOrientation?null:y[fe.crossTileID];if(Ie){let Se=0,ve=0,ke=0;const Ke=g.elevationType==="road";if(se||Ke){const nt=Ke?g.getElevationFeatureForText(ae):null,wt=r.bU.getAtTileOffset(E,new r.P(ue,Ce),se,nt),[Bt,oi,Mt]=Y.upVector(E.canonical,ue,Ce);Se=wt*Bt*ne,ve=wt*oi*ne,ke=wt*Mt*ne}let[$e,ct,it,gt]=no(fe.projectedAnchorX+Se,fe.projectedAnchorY+ve,fe.projectedAnchorZ+ke,h?J:T);const jt=m1(b.getCameraToCenterDistance(Y),gt);let et=r.bL(g.textSizeData,M,fe)*jt/r.bX;h&&(et*=g.tilePixelRatio/P);const Oe=Xv(Ie,et);h?({x:$e,y:ct,z:it}=Y.projectTilePoint(ue+Oe.x,Ce+Oe.y,E.canonical),[$e,ct,it]=no($e+Se,ct+ve,it+ke,T)):(a&&Oe._rotate(-b.angle),$e+=Oe.x,ct+=Oe.y,it=0);const yt=g.allowVerticalPlacement&&fe.placedOrientation===r.bK.vertical?Math.PI/2:0;for(let nt=0;nt<me;nt++)r.bN(H,$e,ct,it,yt);L&&fe.associatedIconIndex>=0&&(Z[fe.associatedIconIndex]={x:$e,y:ct,z:it,angle:yt})}else Wu(me,H)}if(L){F.clear();const ae=g.icon.placedSymbolArray;for(let fe=0;fe<ae.length;fe++){const ue=ae.get(fe),{numGlyphs:Ce}=ue,me=Z[fe];if(ue.hidden||!me)Wu(Ce,F);else{const{x:Ie,y:Se,z:ve,angle:ke}=me;for(let Ke=0;Ke<Ce;Ke++)r.bN(F,Ie,Se,ve,ke)}}g.icon.dynamicLayoutVertexBuffer.updateData(F)}g.text.dynamicLayoutVertexBuffer.updateData(H)}function wy(g,a,h,y,b,T,E={}){const P=h.paint.get("icon-translate"),M=h.paint.get("text-translate"),L=h.paint.get("icon-translate-anchor"),O=h.paint.get("text-translate-anchor"),H=h.layout.get("icon-rotation-alignment"),F=h.layout.get("text-rotation-alignment"),Z=h.layout.get("icon-pitch-alignment"),Y=h.layout.get("text-pitch-alignment"),J=h.layout.get("icon-keep-upright"),se=h.layout.get("text-keep-upright"),ne=h.paint.get("icon-color-saturation"),ae=h.paint.get("icon-color-contrast"),fe=h.paint.get("icon-color-brightness-min"),ue=h.paint.get("icon-color-brightness-max"),Ce=h.layout.get("symbol-elevation-reference")==="sea",me=h.layout.get("icon-image-use-theme")==="none",Ie=g.context,Se=Ie.gl,ve=g.transform,ke=H==="map",Ke=F==="map",$e=Z==="map",ct=Y==="map",it=h.layout.get("symbol-sort-key").constantOr(1)!==void 0;let gt=!1;const jt=g.depthModeForSublayer(0,hi.ReadOnly),et=new hi(g.context.gl.LEQUAL,hi.ReadOnly,g.depthRangeFor3D),Oe=[r.aF(ve.center.lng),r.aJ(ve.center.lat)],yt=h.layout.get("text-variable-anchor"),nt=ve.projection.name==="globe",wt=[],Bt=[0,-1,0];for(const oi of y){const Mt=a.getTile(oi),Lt=Mt.getBucket(h);if(!Lt||Lt.projection.name==="mercator"&&nt||Lt.fullyClipped)continue;const li=Lt.projection.name==="globe",ti=li?r.aj(ve.zoom):0,Yt=yv(oi,Lt.getProjection(),ve),ii=ve.calculatePixelsToTileUnitsMatrix(Mt),ji=yt&&Lt.hasTextData(),Sn=Lt.hasIconTextFit()&&ji&&Lt.hasIconData(),zn=Lt.getProjection().createInversionMatrix(ve,oi.canonical),vr=(1<<Mt.tileID.canonical.z)*r.al/g.transform.worldSize,qi=or=>{let Ki=[0,0,0];if(or){const Bn=g.style.directionalLight,ts=g.style.ambientLight;Bn&&ts&&(Ki=vc(g.style,Bn,ts))}return Ki},Dn=or=>{ve.depthOcclusionForSymbolsAndCircles&&(h.hasOcclusionOpacityProperties||g.terrain)&&(or.push("DEPTH_D24"),or.push("DEPTH_OCCLUSION"))},dn=or=>{h.lut&&!me&&(h.lut.texture||(h.lut.texture=new r.d_(g.context,h.lut.image,[h.lut.image.height,h.lut.image.height,h.lut.image.height],Ie.gl.RGBA8)),Ie.activeTexture.set(Ie.gl.TEXTURE0+Ro.LUT),h.lut.texture&&h.lut.texture.bind(Ie.gl.LINEAR,Ie.gl.CLAMP_TO_EDGE),or.push("APPLY_LUT_ON_GPU"))},hr=()=>{const or=ke&&h.layout.get("symbol-placement")!=="point",Ki=[];Dn(Ki),dn(Ki);const Bn=or||Sn,ts=Lt.elevationType==="road",Ps=g.shadowRenderer,cs=ts&&$e&&!!Ps&&Ps.enabled,ws=qi(cs),el=ts&&$e&&!g.terrain?et:jt,Ma=h.paint.get("icon-image-cross-fade");g.terrainRenderModeElevated()&&$e&&Ki.push("PITCH_WITH_MAP_TERRAIN"),li&&(Ki.push("PROJECTION_GLOBE_VIEW"),Bn&&Ki.push("PROJECTED_POS_ON_VIEWPORT")),Ma>0&&Lt.hasAnySecondaryIcon&&Ki.push("ICON_TRANSITION"),!Lt.icon.zOffsetVertexBuffer||ts&&g.terrain||Ki.push("Z_OFFSET"),ne===0&&ae===0&&fe===0&&ue===1||Ki.push("COLOR_ADJUSTMENT"),Lt.sdfIcons&&Ki.push("RENDER_SDF"),cs&&Ki.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ts&&$e&&!g.terrain&&Lt.icon.orientationVertexBuffer&&Ki.push("ELEVATED_ROADS");const Ho=Lt.icon.programConfigurations.get(h.id),sa=g.getOrCreateProgram("symbol",{config:Ho,defines:Ki}),Ol=Mt.imageAtlasTexture?Mt.imageAtlasTexture.size:[0,0],Go=Lt.iconSizeData,Fl=r.bJ(Go,ve.zoom),Cc=$e||!ve.isOrthographic,vo=_f(Yt,Mt.tileID.canonical,$e,ke,ve,Lt.getProjection(),ii),ms=Gu(Yt,Mt.tileID.canonical,$e,ke,ve,Lt.getProjection(),ii),Ns=g.translatePosMatrix(ms,Mt,P,L,!0),Ar=g.translatePosMatrix(Yt,Mt,P,L),Rs=Bn?th:vo,xo=ke&&!$e&&!or;let gs=Bt;!nt&&!ve.mercatorFromTransition||ke||(gs=W1(ve));const Bl=li?gs:Bt,Yf=h.getColorAdjustmentMatrix(ne,ae,fe,ue),nd=H1(Go.kind,Fl,xo,$e,g,Ar,Rs,Ns,Ce,!1,Ol,[0,0],0,oi,ti,Oe,zn,Bl,Lt.getProjection(),ws,vr,Yf,Ma,null),Qf=Mt.imageAtlasTexture?Mt.imageAtlasTexture:null,Jf=h.layout.get("icon-size").constantOr(0)!==1||Lt.iconsNeedLinear,Ul=Lt.sdfIcons||g.options.rotating||g.options.zooming||Jf||Cc?Se.LINEAR:Se.NEAREST,xu=Lt.sdfIcons&&h.paint.get("icon-halo-width").constantOr(1)!==0,po=g.terrain&&$e&&or?r.bk(r.bB(),vo):th;if(or&&Lt.icon){const Vl=r.bU.getAtTileOffsetFunc(oi,ve.center.lat,ve.worldSize,Lt.getProjection()),_p=ty(Yt,Mt.tileID.canonical,$e,ke,ve,Lt.getProjection(),ii),R2=h.layout.get("icon-size-scale-range"),_x=r.aA(g.scaleFactor,R2[0],R2[1]);y1(Lt,Yt,g,!1,_p,ms,$e,J,Vl,oi,_x)}return{program:sa,buffers:Lt.icon,uniformValues:nd,atlasTexture:Qf,atlasTextureIcon:null,atlasInterpolation:Ul,atlasInterpolationIcon:null,isSDF:Lt.sdfIcons,hasHalo:xu,depthMode:el,tile:Mt,renderWithShadows:cs,labelPlaneMatrixInv:po}},Ln=()=>{const or=Ke&&h.layout.get("symbol-placement")!=="point",Ki=[],Bn=or||yt||Sn,ts=Lt.elevationType==="road",Ps=g.shadowRenderer,cs=ts&&ct&&!!Ps&&Ps.enabled,ws=qi(cs),el=ts&&ct&&!g.terrain?et:jt;g.terrainRenderModeElevated()&&ct&&Ki.push("PITCH_WITH_MAP_TERRAIN"),li&&(Ki.push("PROJECTION_GLOBE_VIEW"),Bn&&Ki.push("PROJECTED_POS_ON_VIEWPORT")),!Lt.text.zOffsetVertexBuffer||ts&&g.terrain||Ki.push("Z_OFFSET"),Lt.iconsInText&&Ki.push("RENDER_TEXT_AND_SYMBOL"),Ki.push("RENDER_SDF"),cs&&Ki.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ts&&ct&&!g.terrain&&Lt.text.orientationVertexBuffer&&Ki.push("ELEVATED_ROADS"),Dn(Ki);const Ma=Lt.text.programConfigurations.get(h.id),Ho=g.getOrCreateProgram("symbol",{config:Ma,defines:Ki});let sa,Ol=[0,0],Go=null;const Fl=Lt.textSizeData;Lt.iconsInText&&(Ol=Mt.imageAtlasTexture?Mt.imageAtlasTexture.size:[0,0],Go=Mt.imageAtlasTexture?Mt.imageAtlasTexture:null,sa=ct||!ve.isOrthographic||g.options.rotating||g.options.zooming||Fl.kind==="composite"||Fl.kind==="camera"?Se.LINEAR:Se.NEAREST);const Cc=Mt.glyphAtlasTexture?Mt.glyphAtlasTexture.size:[0,0],vo=h.layout.get("text-size-scale-range"),ms=r.aA(g.scaleFactor,vo[0],vo[1]),Ns=r.bJ(Fl,ve.zoom,ms),Ar=_f(Yt,Mt.tileID.canonical,ct,Ke,ve,Lt.getProjection(),ii),Rs=Gu(Yt,Mt.tileID.canonical,ct,Ke,ve,Lt.getProjection(),ii),xo=g.translatePosMatrix(Rs,Mt,M,O,!0),gs=g.translatePosMatrix(Yt,Mt,M,O),Bl=Bn?th:Ar,Yf=Ke&&!ct&&!or;let nd=Bt;!nt&&!ve.mercatorFromTransition||Ke||(nd=W1(ve));const Qf=H1(Fl.kind,Ns,Yf,ct,g,gs,Bl,xo,Ce,!0,Cc,Ol,0,oi,ti,Oe,zn,li?nd:Bt,Lt.getProjection(),ws,vr,null,null,ms),Jf=Mt.glyphAtlasTexture?Mt.glyphAtlasTexture:null,Ul=Se.LINEAR,xu=h.paint.get("text-halo-width").constantOr(1)!==0,po=g.terrain&&ct&&or?r.bk(r.bB(),Ar):th;if(or&&Lt.text){const Vl=r.bU.getAtTileOffsetFunc(oi,ve.center.lat,ve.worldSize,Lt.getProjection()),_p=ty(Yt,Mt.tileID.canonical,ct,Ke,ve,Lt.getProjection(),ii);y1(Lt,Yt,g,!0,_p,Rs,ct,se,Vl,oi,ms)}return{program:Ho,buffers:Lt.text,uniformValues:Qf,atlasTexture:Jf,atlasTextureIcon:Go,atlasInterpolation:Ul,atlasInterpolationIcon:sa,isSDF:!0,hasHalo:xu,depthMode:el,tile:Mt,renderWithShadows:cs,labelPlaneMatrixInv:po}},Ir=Lt.icon.segments.get().length,Wn=Lt.text.segments.get().length,hn=Ir&&!E.onlyText?hr():null,nr=Wn&&!E.onlyIcons?Ln():null,gn=h.paint.get("icon-opacity").constantOr(1),Or=h.paint.get("text-opacity").constantOr(1);if(it&&Lt.canOverlap){gt=!0;const or=gn&&!E.onlyText?Lt.icon.segments.get():[],Ki=Or&&!E.onlyIcons?Lt.text.segments.get():[];for(const Bn of or)wt.push({segments:new r.bf([Bn]),sortKey:Bn.sortKey,state:hn});for(const Bn of Ki)wt.push({segments:new r.bf([Bn]),sortKey:Bn.sortKey,state:nr})}else E.onlyText||wt.push({segments:gn?Lt.icon.segments:new r.bf([]),sortKey:0,state:hn}),E.onlyIcons||wt.push({segments:Or?Lt.text.segments:new r.bf([]),sortKey:0,state:nr})}gt&&wt.sort((oi,Mt)=>oi.sortKey-Mt.sortKey);for(const oi of wt){const Mt=oi.state;if(Mt)if(g.terrain?g.terrain.setupElevationDraw(Mt.tile,Mt.program,{useDepthForOcclusion:ve.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Mt.labelPlaneMatrixInv}):g.setupDepthForOcclusion(ve.depthOcclusionForSymbolsAndCircles,Mt.program),Ie.activeTexture.set(Se.TEXTURE0),Mt.atlasTexture&&Mt.atlasTexture.bind(Mt.atlasInterpolation,Se.CLAMP_TO_EDGE,!0),Mt.atlasTextureIcon&&(Ie.activeTexture.set(Se.TEXTURE1),Mt.atlasTextureIcon&&Mt.atlasTextureIcon.bind(Mt.atlasInterpolationIcon,Se.CLAMP_TO_EDGE,!0)),Mt.renderWithShadows&&g.shadowRenderer.setupShadows(Mt.tile.tileID.toUnwrapped(),Mt.program,"vector-tile"),g.uploadCommonLightUniforms(g.context,Mt.program),Mt.hasHalo){const Lt=Mt.uniformValues;Lt.u_is_halo=1,Qv(Mt.buffers,oi.segments,h,g,Mt.program,Mt.depthMode,b,T,Lt,2),Lt.u_is_halo=0}else{if(Mt.isSDF){const Lt=Mt.uniformValues;Mt.hasHalo&&(Lt.u_is_halo=1,Qv(Mt.buffers,oi.segments,h,g,Mt.program,Mt.depthMode,b,T,Lt,1)),Lt.u_is_halo=0}Qv(Mt.buffers,oi.segments,h,g,Mt.program,Mt.depthMode,b,T,Mt.uniformValues,1)}}}function Qv(g,a,h,y,b,T,E,P,M,L){const O=[g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer,g.iconTransitioningVertexBuffer,g.globeExtVertexBuffer,g.zOffsetVertexBuffer,g.orientationVertexBuffer];b.draw(y,y.context.gl.TRIANGLES,T,E,P,$i.disabled,M,h.id,g.layoutVertexBuffer,g.indexBuffer,a,h.paint,y.transform.zoom,g.programConfigurations.get(h.id),O,L)}function d2(g,a){const h=1<<g.canonical.z,y=(a.x*h-g.canonical.x-g.wrap*h)*r.al,b=(a.y*h-g.canonical.y)*r.al,T=r.e7(a.z,a.y);return r.d4(y,b,T)}function hp(g,a,h,y,b){if(!h.layout||h.layout.get("fill-elevation-reference")==="none"||h.paint.get("fill-opacity").constantOr(1)===0)return;const T=g.context.gl,E=new hi(g.context.gl.LEQUAL,hi.ReadWrite,g.depthRangeFor3D),P=new hi(g.context.gl.GREATER,hi.ReadWrite,g.depthRangeFor3D),M=function(Z){let Y=.01;return Z.isOrthographic&&(Y=r.ak(1e-4,Y,r.c$(Z.pitch>=op?1:Z.pitch/op))),2*Y}(g.transform),L=g.transform.getFreeCameraOptions().position,O="elevatedStructuresDepthReconstruct",H=g.getOrCreateProgram(O,{defines:["DEPTH_RECONSTRUCTION"]}),F=g.getOrCreateProgram(O);for(const Z of y){const Y=a.getTile(Z),J=Y.getBucket(h);if(!J)continue;const se=J.elevatedStructures;if(!se)continue;const ne=J.elevationBufferData.heightRange,ae=d2(Z.toUnwrapped(),L),fe=g.translatePosMatrix(Z.projMatrix,Y,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));let ue,Ce,me,Ie;if(b==="initialize"){if(!ne||ne.min>=1||se.depthSegments.segments[0].primitiveLength===0)continue;ue=Uv(fe,ae,M,1,0),Ce=E,me=se.depthSegments,Ie=H}else if(b==="reset"){if(!ne||ne.min>=0||se.maskSegments.segments[0].primitiveLength===0)continue;ue=Uv(fe,ae,0,0,1),Ce=P,me=se.maskSegments,Ie=H}else if(b==="geometry"){if(se.depthSegments.segments[0].primitiveLength===0)continue;ue=Uv(fe,ae,M,1,0),Ce=E,me=se.depthSegments,Ie=F}Ie.draw(g,T.TRIANGLES,Ce,Yi.disabled,mn.disabled,$i.disabled,ue,h.id,se.vertexBuffer,se.indexBuffer,me,h.paint,g.transform.zoom)}}function Lf(g,a,h){const{painter:y,sourceCache:b,layer:T,coords:E,colorMode:P,elevationType:M,terrainEnabled:L,pass:O}=g,H=y.context.gl,F=T.paint.get("fill-pattern"),Z=T.paint.get("fill-pattern-cross-fade"),Y=F.constantOr(null);let J=M;M!=="road"||a&&!L||(J="none");const se=J==="road",ne=g.painter.shadowRenderer,ae=se&&!!ne&&ne.enabled,fe=new hi(y.context.gl.LEQUAL,hi.ReadOnly,y.depthRangeFor3D);let ue=[0,0,0];if(ae){const Ie=y.style.directionalLight,Se=y.style.ambientLight;Ie&&Se&&(ue=vc(y.style,Ie,Se))}const Ce=F&&F.constantOr(1),me=(Ie,Se)=>{let ve,ke,Ke,$e,ct;Se?(ve=Ce&&!T.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ke=H.LINES):(ve=Ce?"fillPattern":"fill",Ke=H.TRIANGLES);for(const it of E){const gt=b.getTile(it);if(Ce&&!gt.patternsLoaded())continue;const jt=gt.getBucket(T);if(!jt)continue;const et=a?jt.elevationBufferData:jt.bufferData;if(et.isEmpty())continue;y.prepareDrawTile();const Oe=et.programConfigurations.get(T.id),yt=y.isTileAffectedByFog(it),nt=[],wt=[];se&&(nt.push("ELEVATED_ROADS"),wt.push(et.elevatedLayoutVertexBuffer)),ae&&nt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Ce&&(y.context.activeTexture.set(H.TEXTURE0),gt.imageAtlasTexture&>.imageAtlasTexture.bind(H.LINEAR,H.CLAMP_TO_EDGE),Oe.updatePaintBuffers());let Bt=!1;if(Y&>.imageAtlas){const ti=gt.imageAtlas,Yt=r.e2.from(Y),ii=Yt.getPrimary().scaleSelf(r.o.devicePixelRatio).toString(),ji=Yt.getSecondary(),Sn=ti.patternPositions.get(ii),zn=ji?ti.patternPositions.get(ji.scaleSelf(r.o.devicePixelRatio).toString()):null;Bt=!!Sn&&!!zn,Sn&&Oe.setConstantPatternPositions(Sn,zn)}Z>0&&(Bt||Oe.getPatternTransitionVertexBuffer("fill-pattern"))&&nt.push("FILL_PATTERN_TRANSITION");const oi=y.getOrCreateProgram(ve,{config:Oe,overrideFog:yt,defines:nt}),Mt=y.translatePosMatrix(it.projMatrix,gt,T.paint.get("fill-translate"),T.paint.get("fill-translate-anchor"));ae&&ne.setupShadows(gt.tileID.toUnwrapped(),oi,"vector-tile");const Lt=T.paint.get("fill-emissive-strength");if(Se){$e=et.lineIndexBuffer,ct=et.lineSegments;const ti=y.terrain&&y.terrain.renderingToTexture?y.terrain.drapeBufferSize:[H.drawingBufferWidth,H.drawingBufferHeight];ke=ve==="fillOutlinePattern"&&Ce?dD(Mt,Lt,y,gt,ti,ue,Z):uD(Mt,Lt,ti,ue)}else $e=et.indexBuffer,ct=et.triangleSegments,ke=Ce?o2(Mt,Lt,y,gt,ue,Z):s2(Mt,Lt,ue);y.uploadCommonUniforms(y.context,oi,it.toUnwrapped());let li=Ie;(M==="road"&&!L||M==="offset")&&(li=fe),oi.draw(y,Ke,li,h||y.stencilModeForClipping(it),P,$i.disabled,ke,T.id,et.layoutVertexBuffer,$e,ct,T.paint,y.transform.zoom,Oe,wt)}};y.renderPass===O&&me(y.depthModeForSublayer(1,y.renderPass==="opaque"?hi.ReadWrite:hi.ReadOnly),!1),J==="none"&&y.renderPass==="translucent"&&T.paint.get("fill-antialias")&&me(y.depthModeForSublayer(T.getPaintProperty("fill-outline-color")?2:0,hi.ReadOnly),!0)}function ri(g,a,h,y,b,T,E,P){h.resetLayerRenderingStats(g);const M=g.context,L=M.gl,O=g.transform,H=h.paint.get("fill-extrusion-pattern"),F=h.paint.get("fill-extrusion-pattern-cross-fade"),Z=H.constantOr(null),Y=H.constantOr(1),J=h.paint.get("fill-extrusion-opacity"),se=g.style.enable3dLights(),ne=h.paint.get(se&&!Y?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),ae=[h.paint.get("fill-extrusion-ambient-occlusion-intensity"),ne],fe=h.layout.get("fill-extrusion-edge-radius"),ue=fe>0&&!h.paint.get("fill-extrusion-rounded-roof"),Ce=ue?0:fe,me=O.projection.name==="globe"?r.ea():0,Ie=O.projection.name==="globe",Se=Ie?r.aj(O.zoom):0,ve=[r.aF(O.center.lng),r.aJ(O.center.lat)],ke=h.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ke=h.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ke?null:h.lut).toArray01().slice(0,3),$e=h.paint.get("fill-extrusion-flood-light-intensity"),ct=h.paint.get("fill-extrusion-vertical-scale"),it=h.paint.get("fill-extrusion-line-width").constantOr(1)!==0,gt=h.paint.get("fill-extrusion-height-alignment"),jt=h.paint.get("fill-extrusion-base-alignment"),et=Xu(g,h.paint.get("fill-extrusion-cutoff-fade-range")),Oe=[];let yt;Ie&&Oe.push("PROJECTION_GLOBE_VIEW"),ae[0]>0&&Oe.push("FAUX_AO"),ue&&Oe.push("ZERO_ROOF_RADIUS"),P&&Oe.push("HAS_CENTROID"),$e>0&&Oe.push("FLOOD_LIGHT"),et.shouldRenderCutoff&&Oe.push("RENDER_CUTOFF"),it&&Oe.push("RENDER_WALL_MODE");const nt=g.renderPass==="shadow",wt=g.shadowRenderer,Bt=nt&&!!wt,oi=nt?$i.disabled:$i.backCCW;g.shadowRenderer&&(g.shadowRenderer.useNormalOffset=!0);let Mt=[0,0,0];if(wt){const ti=g.style.directionalLight,Yt=g.style.ambientLight;ti&&Yt&&(Mt=vc(g.style,ti,Yt)),nt||(Oe.push("RENDER_SHADOWS","DEPTH_TEXTURE"),wt.useNormalOffset&&Oe.push("NORMAL_OFFSET")),yt=Oe.concat(["SHADOWS_SINGLE_CASCADE"])}const Lt=Bt?"fillExtrusionDepth":Y?"fillExtrusionPattern":"fillExtrusion",li=h.getLayerRenderingStats();for(const ti of y){const Yt=a.getTile(ti),ii=Yt.getBucket(h);if(!ii||ii.projection.name!==O.projection.name)continue;let ji=!1;wt&&(ji=wt.getMaxCascadeForTile(ti.toUnwrapped())===0);const Sn=g.isTileAffectedByFog(ti),zn=ii.programConfigurations.get(h.id);let vr=!1;if(Z&&Yt.imageAtlas){const Wn=Yt.imageAtlas,hn=r.e2.from(Z),nr=hn.getPrimary().scaleSelf(r.o.devicePixelRatio).toString(),gn=hn.getSecondary(),Or=Wn.patternPositions.get(nr),or=gn?Wn.patternPositions.get(gn.scaleSelf(r.o.devicePixelRatio).toString()):null;vr=!!Or&&!!or,Or&&zn.setConstantPatternPositions(Or,or)}F>0&&(vr||zn.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Oe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const qi=g.getOrCreateProgram(Lt,{config:zn,defines:ji?yt:Oe,overrideFog:Sn});if(g.terrain&&g.terrain.setupElevationDraw(Yt,qi,{useMeterToDem:!0}),!ii.centroidVertexBuffer){const Wn=qi.getAttributeLocation(L,"a_centroid_pos");Wn!==-1&&L.vertexAttrib2f(Wn,0,0)}!nt&&wt&&wt.setupShadows(Yt.tileID.toUnwrapped(),qi,"vector-tile"),Y&&(g.context.activeTexture.set(L.TEXTURE0),Yt.imageAtlasTexture&&Yt.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),zn.updatePaintBuffers());const Dn=h.paint.get("fill-extrusion-vertical-gradient"),dn=1/ii.tileToMeter;let hr;if(nt&&wt){if(h2(Yt.tileID,ii.maxHeight,g))continue;const Wn=wt.calculateShadowPassMatrixFromTile(Yt.tileID.toUnwrapped());hr=n2(Wn,Ce,dn,ct,gt,jt)}else{const Wn=g.translatePosMatrix(ti.expandedProjMatrix,Yt,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),hn=O.projection.createInversionMatrix(O,ti.canonical);hr=Y?r2(Wn,g,Dn,J,ae,Ce,dn,ti,Yt,me,gt,jt,Se,ve,hn,Ke,ct,F):Bv(Wn,g,Dn,J,ae,Ce,dn,ti,me,gt,jt,Se,ve,hn,Ke,ct,$e,Mt)}g.uploadCommonUniforms(M,qi,ti.toUnwrapped(),null,et);let Ln=ii.segments;if(O.projection.name==="mercator"&&!nt&&(Ln=ii.getVisibleSegments(Yt.tileID,g.terrain,g.transform.getFrustum(0)),!Ln.get().length))continue;if(li)if(nt)for(const Wn of Ln.get())li.numRenderedVerticesInShadowPass+=Wn.primitiveLength;else for(const Wn of Ln.get())li.numRenderedVerticesInTransparentPass+=Wn.primitiveLength;const Ir=[];(g.terrain||P)&&Ir.push(ii.centroidVertexBuffer),Ie&&Ir.push(ii.layoutVertexExtBuffer),it&&Ir.push(ii.wallVertexBuffer),qi.draw(g,M.gl.TRIANGLES,b,T,E,oi,hr,h.id,ii.layoutVertexBuffer,ii.indexBuffer,Ln,h.paint,g.transform.zoom,zn,Ir)}g.shadowRenderer&&(g.shadowRenderer.useNormalOffset=!1)}class K1{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Qu(g,a,h,y,b,T,E,P,M,L,O,H,F,Z,Y,J,se,ne,ae,fe){const ue=a.context,Ce=ue.gl,me=a.transform,Ie=a.transform.zoom,Se=[],ve=g.translate,ke=g.translateAnchor,Ke=g.edgeRadius,$e=Xu(a,g.cutoffFadeRange);O==="clear"?(Se.push("CLEAR_SUBPASS"),fe&&(Se.push("CLEAR_FROM_TEXTURE"),ue.activeTexture.set(Ce.TEXTURE0),fe.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE))):O==="sdf"&&Se.push("SDF_SUBPASS"),ne&&Se.push("HAS_CENTROID"),$e.shouldRenderCutoff&&Se.push("RENDER_CUTOFF");const ct=(it,gt,jt,et,Oe)=>{let yt=Se;gt.groundRadiusBuffer!=null&&(yt=Se.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const nt=gt.programConfigurations.get(y.id),wt=a.isTileAffectedByFog(it),Bt=a.getOrCreateProgram("fillExtrusionGroundEffect",{config:nt,defines:yt,overrideFog:wt}),oi=Rf(a,et,H,L,Oe,[F,Z*Oe],Y,J,se,Ie>=17?0:Ke*Oe,fe?fe.size[0]:0),Mt=[];ne&&Mt.push(gt.hiddenByLandmarkVertexBuffer),gt.groundRadiusBuffer!=null&&Mt.push(gt.groundRadiusBuffer),a.uploadCommonUniforms(ue,Bt,it.toUnwrapped(),null,$e),Bt.draw(a,ue.gl.TRIANGLES,T,E,P,M,oi,y.id,gt.vertexBuffer,gt.indexBuffer,jt,y.paint,Ie,nt,Mt)};for(const it of b){const gt=h.getTile(it),jt=gt.getBucket(y);if(!jt||jt.projection.name!==me.projection.name||!jt.groundEffect||jt.groundEffect&&!jt.groundEffect.hasData())continue;const et=jt.groundEffect,Oe=1/jt.tileToMeter;{const yt=a.translatePosMatrix(it.projMatrix,gt,ve,ke),nt=et.getDefaultSegment();ct(it,et,nt,yt,Oe)}if(ae)for(let yt=0;yt<4;yt++){const nt=r.e8[yt](it),wt=h.getTile(nt);if(!wt)continue;const Bt=wt.getBucket(y);if(!Bt||Bt.projection.name!==me.projection.name||!Bt.groundEffect||Bt.groundEffect&&!Bt.groundEffect.hasData())continue;const oi=Bt.groundEffect;let Mt,Lt;yt===0?(Mt=[-r.al,0,0],Lt=1):yt===1?(Mt=[r.al,0,0],Lt=0):yt===2?(Mt=[0,-r.al,0],Lt=3):(Mt=[0,r.al,0],Lt=2);const li=oi.regionSegments[Lt];if(!li)continue;const ti=new Float32Array(16);r.bq(ti,it.projMatrix,Mt),ct(it,oi,li,a.translatePosMatrix(ti,gt,ve,ke),Oe)}}}function ih(g,a,h,y,b,T,E){y.centroidVertexArray.length===0&&y.createCentroidsBuffer();const P=T?T.findDEMTileFor(h):null;if(!(P&&P.dem||E))return;T&&P&&P.dem&&y.selfDEMTileTimestamp!==P.dem._timestamp&&(y.borderDoneWithNeighborZ=[-1,-1,-1,-1],y.selfDEMTileTimestamp=P.dem._timestamp);const M=ne=>new r.P(Math.ceil((ne+r.ec)*r.ed),0),L=ne=>{const ae=a.getSource().minzoom,fe=Ce=>{const me=a.getTileByID(Ce);if(me&&me.hasData())return me.getBucket(b)},ue=[0,-1,1];for(const Ce of ue){if(ne.overscaledZ+Ce<ae)continue;const me=fe(ne.calculateScaledKey(ne.overscaledZ+Ce));if(me)return me}},O=[0,0,0],H=(ne,ae)=>
3704(O[0]=Math.min(ne.min.y,ae.min.y),O[1]=Math.max(ne.max.y,ae.max.y),O[2]=r.al-ae.min.x>ne.max.x?ae.min.x-r.al:ne.max.x,O),F=(ne,ae)=>(O[0]=Math.min(ne.min.x,ae.min.x),O[1]=Math.max(ne.max.x,ae.max.x),O[2]=r.al-ae.min.y>ne.max.y?ae.min.y-r.al:ne.max.y,O),Z=[(ne,ae)=>H(ne,ae),(ne,ae)=>H(ae,ne),(ne,ae)=>F(ne,ae),(ne,ae)=>F(ae,ne)],Y=(ne,ae,fe,ue,Ce,me,Ie)=>{if(!T)return 0;const Se=[[me?fe:ne,me?ne:fe,0],[me?fe:ae,me?ae:fe,0]],ve=Ie<0?r.al+Ie:Ie,ke=[me?ve:(ne+ae)/2,me?(ne+ae)/2:ve,0];return fe===0&&Ie<0||fe!==0&&Ie>0?T.getForTilePoints(Ce,[ke],!0,ue):Se.push(ke),T.getForTilePoints(h,Se,!0,P),Math.max(Se[0][2],Se[1][2],ke[2])/T.exaggeration()};for(let ne=0;ne<4;ne++){const ae=y.borderFeatureIndices[ne];if(ae.length===0)continue;const fe=r.e8[ne](h),ue=L(fe);if(!(ue&&ue instanceof r.e9))continue;const Ce=T?T.findDEMTileFor(fe):null;if(!(Ce&&Ce.dem||E)||(T&&Ce&&Ce.dem&&y.borderDEMTileTimestamp[ne]!==Ce.dem._timestamp&&(y.borderDoneWithNeighborZ[ne]=-1,y.borderDEMTileTimestamp[ne]=Ce.dem._timestamp),y.borderDoneWithNeighborZ[ne]===ue.canonical.z))continue;ue.centroidVertexArray.length===0&&ue.createCentroidsBuffer();const me=(ne<2?1:5)-ne,Ie=ue.borderDoneWithNeighborZ[me]!==y.canonical.z,Se=ue.borderFeatureIndices[me];let ve=0;if(y.canonical.z!==ue.canonical.z){for(const ke of ae)y.showCentroid(y.featuresOnBorder[ke]);if(Ie)for(const ke of Se)ue.showCentroid(ue.featuresOnBorder[ke]);y.borderDoneWithNeighborZ[ne]=ue.canonical.z,ue.borderDoneWithNeighborZ[me]=y.canonical.z}for(const ke of ae){const Ke=y.featuresOnBorder[ke],$e=y.centroidData[Ke.centroidDataIndex],ct=Ke.borders[ne];let it;for(;ve<Se.length;){it=ue.featuresOnBorder[Se[ve]];const gt=it.borders[me];if(gt[1]>ct[0]+3||gt[0]>ct[0]-3)break;ue.showCentroid(it),ve++}if(it&&ve<Se.length){const gt=ve;let jt=0;for(;!(it.borders[me][0]>ct[1]-3)&&(jt++,++ve!==Se.length);)it=ue.featuresOnBorder[Se[ve]];it=ue.featuresOnBorder[Se[gt]];let et=!1;if(jt>=1){const nt=it.borders[me];Math.abs(ct[0]-nt[0])<3&&Math.abs(ct[1]-nt[1])<3&&(jt=1,et=!0,ve=gt+1)}else if(jt===0){y.showCentroid(Ke);continue}const Oe=ue.centroidData[it.centroidDataIndex];E&&et&&(((J=$e).flags|(se=Oe).flags)&r.eb?(J.flags|=r.eb,se.flags|=r.eb):(J.flags&=~r.eb,se.flags&=~r.eb));const yt=Ke.intersectsCount()>1||it.intersectsCount()>1;if(jt>1)ve=gt,$e.centroidXY=Oe.centroidXY=new r.P(0,0);else if(Ce&&Ce.dem&&!yt){const nt=Z[ne]($e,Oe),wt=ne%2?r.al-1:0,Bt=Y(nt[0],Math.min(r.al-1,nt[1]),wt,Ce,fe,ne<2,nt[2]);$e.centroidXY=Oe.centroidXY=M(Bt)}else yt?$e.centroidXY=Oe.centroidXY=new r.P(0,0):($e.centroidXY=y.encodeBorderCentroid(Ke),Oe.centroidXY=ue.encodeBorderCentroid(it));y.writeCentroidToBuffer($e),ue.writeCentroidToBuffer(Oe)}else y.showCentroid(Ke)}y.borderDoneWithNeighborZ[ne]=ue.canonical.z,ue.borderDoneWithNeighborZ[me]=y.canonical.z}var J,se;(y.needsCentroidUpdate||!y.centroidVertexBuffer&&y.centroidVertexArray.length!==0)&&y.uploadCentroid(g)}const nh=[1,0,0],Ri=[0,1,0],Z1=[0,0,1];function h2(g,a,h){const y=h.transform,b=h.shadowRenderer;if(!b)return!0;const T=g.toUnwrapped(),E=y.tileSize*b._cascades[h.currentShadowCascade].scale;let P=a;if(y.elevation){const J=y.elevation.getMinMaxForTile(g);J&&(P+=J.max)}const M=[...b.shadowDirection];M[2]=-M[2];const L=b.computeSimplifiedTileShadowVolume(T,P,E,M);if(!L)return!1;const O=[nh,Ri,Z1,M,[M[0],0,M[2]],[0,M[1],M[2]]],H=y.projection.name==="globe",F=y.scaleZoom(E),Z=r.cA.fromInvProjectionMatrix(y.invProjMatrix,y.worldSize,F,!H),Y=b.getCurrentCascadeFrustum();return Z.intersectsPrecise(L.vertices,L.planes,O)===0||Y.intersectsPrecise(L.vertices,L.planes,O)===0}function Jv(g){const{painter:a,source:h,layer:y,coords:b}=g;let T=g.defines;const E=a.context,P=a.renderPass==="shadow",M=a.renderPass==="light-beam",L=a.shadowRenderer,O=r.ee(a.transform.center.lat,a.transform.zoom),H=Xu(a,y.paint.get("building-cutoff-fade-range"));H.shouldRenderCutoff&&(T=T.concat("RENDER_CUTOFF")),g.floodLightIntensity>0&&(T=T.concat("FLOOD_LIGHT"));for(const F of b){const Z=h.getTile(F),Y=Z.getBucket(y);if(!Y)continue;L&&L.getMaxCascadeForTile(F.toUnwrapped())===0&&(T=T.concat("SHADOWS_SINGLE_CASCADE"));const J=Y.programConfigurations.get(y.id);let se,ne,ae,fe=a.translatePosMatrix(F.expandedProjMatrix,Z,[0,0],"map");if(fe=r.cR(r.bB(),fe,[1,1,g.verticalScale]),P&&L){if(h2(Z.tileID,Y.maxHeight*O,a))continue;let Ce=L.calculateShadowPassMatrixFromTile(Z.tileID.toUnwrapped());Ce=r.cR(r.bB(),Ce,[1,1,g.verticalScale]),ae=a2(Ce),se=ne=a.getOrCreateProgram("buildingDepth",{config:J,defines:T,overrideFog:!1})}else if(M)se=ne=a.getOrCreateProgram("buildingBloom",{config:J,defines:T,overrideFog:!1}),ae=U1(fe);else{const Ce=a.transform.calculatePosMatrix(F.toUnwrapped(),a.transform.worldSize);r.cR(Ce,Ce,[1,1,g.verticalScale]);const me=r.bB();r.cR(me,Ce,[1,-1,1/O]),r.bk(me,me),r.ef(me,me);const Ie=a.transform.getFreeCameraOptions().position,Se=1<<F.canonical.z;if(ae=B1(fe,me,g.opacity,g.facadeAOIntensity,[((Ie.x-F.wrap)*Se-F.canonical.x)*r.al,(Ie.y*Se-F.canonical.y)*r.al,Ie.z*Se*r.al],Y.tileToMeter,g.facadeEmissiveChance,g.floodLightColor,g.floodLightIntensity),ne=a.getOrCreateProgram("building",{config:J,defines:T,overrideFog:!1}),g.depthOnly===!0)se=ne;else{const ve=T.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);se=a.getOrCreateProgram("building",{config:J,defines:ve,overrideFog:!1})}
vendor: 17,775 bytes, line 3704
3704L&&(L.setupShadowsFromMatrix(Ce,ne,!0),se!==ne&&L.setupShadowsFromMatrix(Ce,se,!0))}const ue=(Ce,me)=>{if(M){const Ie=Ce.entranceBloom;me.draw(a,E.gl.TRIANGLES,g.depthMode,Yi.disabled,g.blendMode,$i.disabled,ae,y.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segmentsBucket,y.paint,a.transform.zoom,J,[Ie.layoutAttenuationBuffer,Ie.layoutColorBuffer])}else{const Ie=Ce.segmentsBucket;let Se=[Ce.layoutNormalBuffer,Ce.layoutCentroidBuffer,Ce.layoutColorBuffer,Ce.layoutFloodLightDataBuffer];Ce.layoutFacadePaintBuffer&&(Se=Se.concat([Ce.layoutFacadeDataBuffer,Ce.layoutFacadeVerticalRangeBuffer,Ce.layoutFacadePaintBuffer])),me.draw(a,E.gl.TRIANGLES,g.depthMode,Yi.disabled,g.blendMode,P?$i.disabled:$i.backCW,ae,y.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ie,y.paint,a.transform.zoom,J,Se)}};a.uploadCommonUniforms(E,ne,F.toUnwrapped(),null,H),Y.buildingWithoutFacade&&ue(Y.buildingWithoutFacade,ne),Y.buildingWithFacade&&(se!==ne&&a.uploadCommonUniforms(E,se,F.toUnwrapped(),null,H),ue(Y.buildingWithFacade,se))}}function ex(g,a,h,y,b,T,E,P,M,L,O,H,F){const Z=g.context.gl,Y=g.depthModeForSublayer(1,hi.ReadOnly,Z.LEQUAL,!0),J=.1*(1-(se=O))+3*se;var se;const ne=g._showOverdrawInspector,ae=H,fe=new K1;ne||Qu(fe,g,a,h,y,Y,new Yi({func:Z.ALWAYS,mask:255},255,255,Z.KEEP,Z.KEEP,Z.REPLACE),new mn([Z.ONE,Z.ONE,Z.ONE,Z.ONE],r.ao.transparent,[!1,!1,!1,!0],Z.MIN),$i.disabled,b,"sdf",T,E,P,M,L,J,ae,!1);{const ue=ne?Yi.disabled:new Yi({func:Z.EQUAL,mask:255},255,255,Z.KEEP,Z.DECR,Z.DECR),Ce=ne?g.colorModeForRenderPass():new mn([Z.ONE_MINUS_DST_ALPHA,Z.DST_ALPHA,Z.ONE,Z.ONE],r.ao.transparent,[!0,!0,!0,!0]);Qu(fe,g,a,h,y,Y,ue,Ce,$i.disabled,b,"color",T,E,P,M,L,J,ae,!1)}}function X1(g){return[g[0]*r.eg,g[1]*r.eg,g[2]*r.eg,0]}function Y1(g,a,h,y,b,T,E,P,M){const L=y.getSource(),O=h.globeSharedBuffers;if(!O)return;let H,F,Z;if(a&&(H=y.getTile(a)),L instanceof r.aT?(F=L.texture,Z=r.dJ(0,0,h.transform)):H&&a&&(F=H.texture,Z=r.dJ(a.canonical.z,a.canonical.x,h.transform)),!F||!Z)return;g||(Z=r.cR(r.bB(),Z,[1,-1,1]));const Y=h.context,J=Y.gl,se=b.paint.get("raster-resampling")==="nearest"?J.NEAREST:J.LINEAR,ne=h.colorModeForDrapableLayerRenderPass(T),ae=E.defines;ae.push("GLOBE_POLES");const fe=new hi(J.LEQUAL,hi.ReadWrite,h.depthRangeFor3D),ue=Float32Array.from(h.transform.expandedFarZProjMatrix),Ce=Float32Array.from(r.bj(r.dI(new r.cC(0,0,0))));h.terrain&&h.terrain.prepareDrawTile(),Y.activeTexture.set(J.TEXTURE0),F.bind(se,J.CLAMP_TO_EDGE),Y.activeTexture.set(J.TEXTURE1),F.bind(se,J.CLAMP_TO_EDGE),"useMipmap"in F&&Y.extTextureFilterAnisotropic&&h.transform.pitch>20&&J.texParameterf(J.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const[me,Ie,Se,ve]=a?O.getPoleBuffers(a.canonical.z,!1):O.getPoleBuffers(0,!0),ke=b.paint.get("raster-elevation");let Ke;g?(Ke=me,h.renderDefaultNorthPole=ke!==0):(Ke=Ie,h.renderDefaultSouthPole=ke!==0);const $e=X1(E.mix),ct=((gt,jt,et,Oe,yt,nt,wt,Bt,oi,Mt,Lt,li,ti)=>xy(gt,jt,et,new Float32Array(16),new Float32Array(9),[0,0],Oe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},nt,[0,0],Bt,2,Mt,Lt,li,1,0,ti))(ue,Ce,Z,r.aj(h.transform.zoom),0,b,0,ke,0,$e,E.offset,E.range,T),it=h.getOrCreateProgram("raster",{defines:ae});h.uploadCommonUniforms(Y,it,null),it.draw(h,J.TRIANGLES,fe,M,ne,P,ct,b.id,Ke,Se,ve)}function p2(g){const a=g._nearZ,h=g.projection.farthestPixelDistance(g),y=h-a,b=.2*g.height,T=a+b;return[a,h,(T-b-a)/y,(T-a)/y]}function mD(g,a,h,y){if(g)return a instanceof uo&&g instanceof Zd?a.getTextureDescriptor(g,h,!0):{texture:g.texture,mix:X1(y.mix),offset:y.offset,buffer:0,tileSize:1}}var gD=r.eh([{name:"a_index",type:"Int16",components:1}]);class ml{constructor(a,h,y,b){const T={width:y[0],height:y[1],data:null},E=a.gl;this.targetColorTexture=new r.T(a,T,E.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new r.T(a,T,E.RGBA8,{useMipmap:!1}),this.context=a,this.updateParticleTexture(h,b),this.lastInvalidatedAt=0}updateParticleTexture(a,h){if(this.particleTextureDimension===h.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const y=this.context.gl,b=h.width*h.height;this.particleTexture0=new r.T(this.context,h,y.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new r.T(this.context,h,y.RGBA8,{premultiply:!1,useMipmap:!1});const T=new r.ei;T.reserve(b);for(let E=0;E<b;E++)T.emplaceBack(E);this.particleIndexBuffer=this.context.createVertexBuffer(T,gD.members,!0),this.particleSegment=r.bf.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=h.width}update(a){return!(this.lastInvalidatedAt<a&&(this.lastInvalidatedAt=r.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Q1(g,a,h){if(!g)return null;const y=a.getTextureDescriptor(g,h,!0);if(!y)return null;let{texture:b,mix:T,offset:E,tileSize:P,buffer:M,format:L}=y;if(!b||!L)return null;let O=!1;return L==="uint32"&&(O=!0,T[3]=0,T=Vv(r.ej,T,[0,h.paint.get("raster-particle-max-speed")]),E=Yu(r.ej,E,[0,h.paint.get("raster-particle-max-speed")])),{texture:b,textureOffset:[M/(P+2*M),P/(P+2*M)],tileSize:P,scalarData:O,scale:T,offset:E,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[L]]}}function Na(g){const a=g._nearZ,h=g.projection.farthestPixelDistance(g),y=h-a,b=.2*g.height,T=a+b;return[a,h,(T-b-a)/y,(T-a)/y]}const rh=new r.ao(1,0,0,1),f2=new r.ao(0,1,0,1),J1=new r.ao(0,0,1,1),ew=new r.ao(1,0,1,1),tw=new r.ao(0,1,1,1);function iw(g,a,h,y,b,T){for(let E=0;E<h.length;E++)if(b){const L=new r.ao(y.r*.8,y.g*.8,y.b*.8,1);gl(g,a,h[E],y,-1,-1,T),gl(g,a,h[E],y,-1,1,T),gl(g,a,h[E],y,1,1,T),gl(g,a,h[E],y,1,-1,T),gl(g,a,h[E],L,0,0,T)}else gl(g,a,h[E],y,0,0,T)}function gl(g,a,h,y,b,T,E){const P=g.context,M=g.transform,L=P.gl,O=M.projection.name==="globe",H=O?["PROJECTION_GLOBE_VIEW"]:[];let F=r.by(h.projMatrix);if(O&&r.aj(M.zoom)>0){const $e=r.bi(h.canonical,M),ct=r.ek($e);F=r.aB(new Float32Array(16),M.globeMatrix,ct),r.aB(F,M.projMatrix,F)}const Z=r.bB();Z[12]+=2*b/(r.o.devicePixelRatio*M.width),Z[13]+=2*T/(r.o.devicePixelRatio*M.height),r.aB(F,Z,F);const Y=g.getOrCreateProgram("debug",{defines:H}),J=a.getTileByID(h.key);g.terrain&&g.terrain.setupElevationDraw(J,Y);const se=hi.disabled,ne=Yi.disabled,ae=g.colorModeForRenderPass(),fe="$debug";P.activeTexture.set(L.TEXTURE0),g.emptyTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),O?J._makeGlobeTileDebugBuffers(g.context,M):J._makeDebugTileBoundsBuffers(g.context,M.projection);const ue=J._tileDebugBuffer||g.debugBuffer,Ce=J._tileDebugIndexBuffer||g.debugIndexBuffer,me=J._tileDebugSegments||g.debugSegments;if(Y.draw(g,L.LINE_STRIP,se,ne,ae,$i.disabled,V1(F,y.toPremultipliedRenderColor(null)),fe,ue,Ce,me,null,null,null,[J._globeTileDebugBorderBuffer]),E){const $e=J.latestRawTileData,ct=Math.floor(($e&&$e.byteLength||0)/1024);let it=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(it+=` => ${h.overscaledZ}`),it+=` ${J.state}`,it+=` ${ct}kb`,function(gt,jt){gt.initDebugOverlayCanvas();const et=gt.debugOverlayCanvas,Oe=gt.context.gl,yt=gt.debugOverlayCanvas.getContext("2d");yt.clearRect(0,0,et.width,et.height),yt.shadowColor="white",yt.shadowBlur=2,yt.lineWidth=1.5,yt.strokeStyle="white",yt.textBaseline="top",yt.font="bold 36px Open Sans, sans-serif",yt.fillText(jt,5,5),yt.strokeText(jt,5,5),gt.debugOverlayTexture.update(et),gt.debugOverlayTexture.bind(Oe.LINEAR,Oe.CLAMP_TO_EDGE)}(g,it)}const Ie=a.getTile(h).tileSize,Se=512/Math.min(Ie,512)*(h.overscaledZ/M.zoom)*.5,ve=J._tileDebugTextBuffer||g.debugBuffer,ke=J._tileDebugTextIndexBuffer||g.quadTriangleIndexBuffer,Ke=J._tileDebugTextSegments||g.debugSegments;Y.draw(g,L.TRIANGLES,se,ne,mn.alphaBlended,$i.disabled,V1(F,r.ao.transparent.toPremultipliedRenderColor(null),Se),fe,ve,ke,Ke,null,null,null,[J._globeTileDebugTextBuffer])}function Rr(g,a,h,y){Of(g,0,a+h/2,g.transform.width,h,y)}function Sy(g,a,h,y){Of(g,a-h/2,0,h,g.transform.height,y)}function Of(g,a,h,y,b,T){const E=g.context,P=E.gl;P.enable(P.SCISSOR_TEST),P.scissor(a*r.o.devicePixelRatio,h*r.o.devicePixelRatio,y*r.o.devicePixelRatio,b*r.o.devicePixelRatio),E.clear({color:T}),P.disable(P.SCISSOR_TEST)}const m2=r.eh([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:g2}=m2;function Ju(g,a,h,y){g.emplaceBack(a,h,y)}class nw{constructor(a){this.vertexArray=new r.el,this.indices=new r.b0,Ju(this.vertexArray,-1,-1,1),Ju(this.vertexArray,1,-1,1),Ju(this.vertexArray,-1,1,1),Ju(this.vertexArray,1,1,1),Ju(this.vertexArray,-1,-1,-1),Ju(this.vertexArray,1,-1,-1),Ju(this.vertexArray,-1,1,-1),Ju(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=a.createVertexBuffer(this.vertexArray,g2),this.indexBuffer=a.createIndexBuffer(this.indices),this.segment=r.bf.simpleSegment(0,0,36,12)}}function wc(g,a,h,y,b,T){const E=g.context.gl,P=a.paint.get("sky-atmosphere-color"),M=a.paint.get("sky-atmosphere-halo-color"),L=a.paint.get("sky-atmosphere-sun-intensity"),O=((H,F,Z,Y,J)=>({u_matrix_3f:H,u_sun_direction:F,u_sun_intensity:Z,u_color_tint_r:[Y.r,Y.g,Y.b,Y.a],u_color_tint_m:[J.r,J.g,J.b,J.a],u_luminance:5e-5}))(r.en(r.dN(),y),b,L,P.toPremultipliedRenderColor(null),M.toPremultipliedRenderColor(null));E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_CUBE_MAP_POSITIVE_X+T,a.skyboxTexture,0),h.draw(g,E.TRIANGLES,hi.disabled,Yi.disabled,mn.unblended,$i.frontCW,O,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}const pp=r.eh([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Nt{constructor(a){const h=new r.eo;h.emplaceBack(-1,1,1,0,0),h.emplaceBack(1,1,1,1,0),h.emplaceBack(1,-1,1,1,1),h.emplaceBack(-1,-1,1,0,1);const y=new r.b0;y.emplaceBack(0,1,2),y.emplaceBack(2,3,0),this.vertexBuffer=a.createVertexBuffer(h,pp.members),this.indexBuffer=a.createIndexBuffer(y),this.segments=r.bf.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Zt=r.eh([{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 Ff{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class bs{constructor(a){this.colorModeAlphaBlendedWriteRGB=new mn([1,Ds,1,Ds],r.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new mn([1,0,1,0],r.ao.transparent,[!1,!1,!1,!0]),this.params=new Ff,this.updateNeeded=!0,a.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),a.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),a.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),a.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(a){const h=a.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Nt(h);const y=this.params.sizeRange,b=this.params.intensityRange,T=function(O){const H=r.eq(30),F=[];for(let Z=0;Z<O;++Z){const Y=2*Math.PI*H(),J=Math.acos(1-2*H())-.5*Math.PI;F.push(r.d4(Math.cos(J)*Math.cos(Y),Math.cos(J)*Math.sin(Y),Math.sin(J)))}return F}(this.params.starsCount),E=r.eq(300),P=new r.ep,M=new r.b0;let L=0;for(let O=0;O<T.length;++O){const H=r.c4([],T[O],200),F=Math.max(0,1+.01*y*(1*E()-.5)),Z=Math.max(0,1+.01*b*(1*E()-.5));P.emplaceBack(H[0],H[1],H[2],-1,-1,F,Z),P.emplaceBack(H[0],H[1],H[2],1,-1,F,Z),P.emplaceBack(H[0],H[1],H[2],1,1,F,Z),P.emplaceBack(H[0],H[1],H[2],-1,1,F,Z),M.emplaceBack(L+0,L+1,L+2),M.emplaceBack(L+0,L+2,L+3),L+=4}this.starsVx=h.createVertexBuffer(P,Zt.members),this.starsIdx=h.createIndexBuffer(M),this.starsSegments=r.bf.simpleSegment(0,0,P.length,M.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(a,h){const y=a.context,b=y.gl,T=a.transform,E=new hi(b.LEQUAL,hi.ReadOnly,[0,1]),P=r.aj(T.zoom),M=a.style.getLut(h.scope),L=h.properties.get("color-use-theme")==="none",O=h.properties.get("color").toNonPremultipliedRenderColor(L?null:M),H=h.properties.get("high-color-use-theme")==="none",F=h.properties.get("high-color").toNonPremultipliedRenderColor(H?null:M),Z=h.properties.get("space-color-use-theme")==="none",Y=h.properties.get("space-color").toNonPremultipliedRenderColor(Z?null:M),J=5e-4,se=r.er(h.properties.get("horizon-blend"),0,1,J,.25),ne=r.dD(a,y,T)&&se===J?T.worldSize/(2*Math.PI*1.025)-1:T.globeRadius,ae=a.frameCounter/1e3%1,fe=r.ag(T.globeCenterInViewSpace),ue=Math.sqrt(Math.pow(fe,2)-Math.pow(ne,2)),Ce=Math.acos(ue/fe),me=Ie=>{const Se=T.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Ie&&Se.push("ALPHA_PASS");const ve=a.getOrCreateProgram("globeAtmosphere",{defines:Se}),ke=(($e,ct,it,gt,jt,et,Oe,yt,nt,wt,Bt,oi)=>({u_frustum_tl:$e,u_frustum_tr:ct,u_frustum_br:it,u_frustum_bl:gt,u_horizon:jt,u_transition:et,u_fadeout_range:Oe,u_atmosphere_fog_color:yt.toArray01(),u_high_color:nt.toArray01(),u_space_color:wt.toArray01(),u_temporal_offset:Bt,u_horizon_angle:oi}))(T.frustumCorners.TL,T.frustumCorners.TR,T.frustumCorners.BR,T.frustumCorners.BL,T.frustumCorners.horizon,P,se,O,F,Y,ae,Ce);a.uploadCommonUniforms(y,ve);const Ke=this.atmosphereBuffer;Ke&&ve.draw(a,b.TRIANGLES,E,Yi.disabled,Ie?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,$i.backCW,ke,Ie?"atmosphere_glow_alpha":"atmosphere_glow",Ke.vertexBuffer,Ke.indexBuffer,Ke.segments)};me(!1),me(!0)}drawStars(a,h){const y=r.aA(h.properties.get("star-intensity"),0,1);if(y===0)return;const b=a.context,T=b.gl,E=a.transform,P=a.getOrCreateProgram("stars"),M=r.c6([]);r.c8(M,M,-E._pitch),r.c7(M,M,-E.angle),r.c8(M,M,r.an(E._center.lat)),r.es(M,M,-r.an(E._center.lng));const L=r.cb(new Float32Array(16),M),O=r.aB([],E.starsProjMatrix,L),H=r.en([],L),F=r.et([],H),Z=[0,1,0];r.dP(Z,Z,F),r.c4(Z,Z,this.params.sizeMultiplier);const Y=[1,0,0];r.dP(Y,Y,F),r.c4(Y,Y,this.params.sizeMultiplier);const J=(se=Z,ne=Y,ae=y,{u_matrix:Float32Array.from(O),u_up:se,u_right:ne,u_intensity_multiplier:ae});var se,ne,ae;a.uploadCommonUniforms(b,P),this.starsVx&&this.starsIdx&&P.draw(a,T.TRIANGLES,hi.disabled,Yi.disabled,this.colorModeAlphaBlendedWriteRGB,$i.disabled,J,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Ze{constructor(){this.visibleTiles=[]}updateBorders(a,h){const y=[],b=[],T=a._getRenderableCoordinates(!1,!0);for(const M of T){const L=a.getTile(M);if(!L.hasData())continue;const O=L.getBucket(h);O&&(O.isEmpty()||(y.push(M.key),b.push({bucket:O,tileID:M.canonical})))}let E=y.length!==this.visibleTiles.length;if(!E){y.sort();for(let M=0;M<y.length;M++)if(y[M]!==this.visibleTiles[M]){E=!0;break}}if(!E)return;const P=new Set;this.visibleTiles=y,b.sort((M,L)=>M.tileID.z-L.tileID.z||M.tileID.x-L.tileID.x||M.tileID.y-L.tileID.y);for(const M of b){const L=new Array,O=new Array,H=M.bucket;for(const F of H.featuresOnBorder)P.has(F.featureId)?O.push(F.footprintIndex):(P.add(F.featureId),L.push(F.footprintIndex));H.updateFootprintHiddenFlags(L,r.eu,!1),H.updateFootprintHiddenFlags(O,r.eu,!0)}}}function rw(g,a){const h=[...g],y=a.cameraWorldSizeForFog/a.worldSize,b=r.bz([]);return r.cR(b,b,[y,y,1]),r.aB(h,b,h),r.aB(h,a.worldToFogMatrix,h),h}function Bf(g,a,h,y,b){const T=h.material,E=y.context,{baseColorTexture:P,metallicRoughnessTexture:M}=T.pbrMetallicRoughness,{normalTexture:L,occlusionTexture:O,emissionTexture:H}=T;function F(Y,J,se){if(Y&&(g.push(J),E.activeTexture.set(E.gl.TEXTURE0+se),Y.gfxTexture)){const{minFilter:ne,magFilter:ae,wrapS:fe,wrapT:ue}=Y.sampler;Y.gfxTexture.bindExtraParam(ne,ae,fe,ue)}}F(P,"HAS_TEXTURE_u_baseColorTexture",Ro.BaseColor),F(M,"HAS_TEXTURE_u_metallicRoughnessTexture",Ro.MetallicRoughness),F(L,"HAS_TEXTURE_u_normalTexture",Ro.Normal),F(O,"HAS_TEXTURE_u_occlusionTexture",Ro.Occlusion),F(H,"HAS_TEXTURE_u_emissionTexture",Ro.Emission),b&&(b.texture||(b.texture=new r.d_(y.context,b.image,[b.image.height,b.image.height,b.image.height],E.gl.RGBA8)),E.activeTexture.set(E.gl.TEXTURE0+Ro.LUT),b.texture&&b.texture.bind(E.gl.LINEAR,E.gl.CLAMP_TO_EDGE),g.push("APPLY_LUT_ON_GPU")),h.texcoordBuffer&&(g.push("HAS_ATTRIBUTE_a_uv_2f"),a.push(h.texcoordBuffer)),h.colorBuffer&&(g.push(h.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),a.push(h.colorBuffer)),h.normalBuffer&&(g.push("HAS_ATTRIBUTE_a_normal_3f"),a.push(h.normalBuffer)),h.pbrBuffer&&(g.push("HAS_ATTRIBUTE_a_pbr"),g.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),a.push(h.pbrBuffer)),T.alphaMode!=="OPAQUE"&&T.alphaMode!=="MASK"||g.push("UNPREMULT_TEXTURE_IN_SHADER"),T.defined||g.push("DIFFUSE_SHADED");const Z=y.shadowRenderer;Z&&(g.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Z.useNormalOffset&&g.push("NORMAL_OFFSET"))}function Uf(g,a,h,y,b,T){const E=h.paint.get("model-opacity").constantOr(1),P=a.context,M=new hi(a.context.gl.LEQUAL,g.isLightMesh?hi.ReadOnly:hi.ReadWrite,a.depthRangeFor3D),L=a.transform,O=g.mesh,H=O.material,F=
3704H.pbrMetallicRoughness,Z=a.style.fog;let Y;Y=a.transform.projection.zAxisUnit==="pixels"?[...g.nodeModelMatrix]:r.aB([],y.zScaleMatrix,g.nodeModelMatrix),r.aB(Y,y.negCameraPosMatrix,Y);const J=r.bk([],Y);r.ef(J,J);const se=h.paint.get("model-color-use-theme").constantOr("default")==="none",ne=h.paint.get("model-emissive-strength").constantOr(0),ae=Wv(new Float32Array(g.worldViewProjection),new Float32Array(Y),new Float32Array(J),null,a,E,F.baseColorFactor,H.emissiveFactor,F.metallicFactor,F.roughnessFactor,H,ne,h,void 0,void 0,g.materialOverride,g.modelColor),fe={defines:[]},ue=[],Ce=a.shadowRenderer;Ce&&(Ce.useNormalOffset=!1),Bf(fe.defines,ue,O,a,se?null:h.lut);let me=null;if(Z){const ve=rw(g.nodeModelMatrix,a.transform);if(me=new Float32Array(ve),L.projection.name!=="globe"){const ke=O.aabb.min,Ke=O.aabb.max,[$e,ct]=Z.getOpacityForBounds(ve,ke[0],ke[1],Ke[0],Ke[1]);fe.overrideFog=$e>=Ve||ct>=Ve}}const Ie=Xu(a,h.paint.get("model-cutoff-fade-range"));Ie.shouldRenderCutoff&&fe.defines.push("RENDER_CUTOFF");const Se=a.getOrCreateProgram("model",fe);a.uploadCommonUniforms(P,Se,null,me,Ie),a.renderPass!=="shadow"&&Ce&&Ce.setupShadowsFromMatrix(g.nodeModelMatrix,Se),Se.draw(a,P.gl.TRIANGLES,M,b,T,O.material.doubleSided?$i.disabled:$i.backCCW,ae,h.id,O.vertexBuffer,O.indexBuffer,O.segments,h.paint,a.transform.zoom,void 0,ue)}function tx(g,a,h){return g.type==="vector"?a.scope:h?"basemap":""}function ix(g,a,h,y,b,T,E,P,M){const L=g.transform,O=!!a.isGeometryBloom&&a.isGeometryBloom;if(O&&g.renderPass==="shadow")return;const H=L.projection.name==="globe"?r.eC(h,L):[...h];r.aB(H,H,a.globalMatrix);const F=r.aB([],y,H);if(a.meshes)for(const Z of a.meshes){const Y=P.get(Z.material.name);if(Y&&Y.opacity<=0)continue;if(Z.material.alphaMode!=="BLEND"){E.push({mesh:Z,depth:0,modelIndex:b,worldViewProjection:F,nodeModelMatrix:H,isLightMesh:O,materialOverride:Y,modelColor:M});continue}const J=r.af([],Z.centroid,F);!L.isOrthographic&&J[2]<=0||T.push({mesh:Z,depth:J[2],modelIndex:b,worldViewProjection:F,nodeModelMatrix:H,isLightMesh:O,materialOverride:Y,modelColor:M})}if(a.children)for(const Z of a.children)ix(g,Z,h,y,b,T,E,P,M)}function Vf(g,a,h,y){const b=h.shadowRenderer;if(!b)return;const T=b.getShadowPassDepthMode(),E=b.getShadowPassColorMode(),P=b.calculateShadowPassMatrixFromMatrix(a),M=zf(P);h.getOrCreateProgram("modelDepth",{defines:h._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(h,h.context.gl.TRIANGLES,T,Yi.disabled,E,$i.disabled,M,y.id,g.vertexBuffer,g.indexBuffer,g.segments,y.paint,h.transform.zoom,void 0,void 0)}function $f(g,a,h,y,b,T){for(const E of b){const P=Object.assign({},y);P.part=E;const M={type:"Unknown",id:a,properties:P},L={orientation:g.paint.get("model-rotation").evaluate(M,h)};T.set(E,L)}}function yD(g,a,h,y,b,T){for(const E of b){const P=Object.assign({},y);P.part=E;const M={type:"Unknown",id:a,properties:P},L={color:g.paint.get("model-color").evaluate(M,h),colorMix:g.paint.get("model-color-mix-intensity").evaluate(M,h),opacity:g.paint.get("model-opacity").evaluate(M,h),emissionStrength:g.paint.get("model-emissive-strength").evaluate(M,h)};T.set(E,L)}}function y2(g,a,h,y,b,T){if(h===1)for(const P of b)Uf(P,g,a,T[P.modelIndex],Yi.disabled,g.colorModeForRenderPass());else{for(const P of b)Uf(P,g,a,T[P.modelIndex],Yi.disabled,mn.disabled);for(const P of b)Uf(P,g,a,T[P.modelIndex],g.stencilModeFor3D(),g.colorModeForRenderPass());g.resetStencilClippingMasks()}const E=mn.additive;for(const P of y)Uf(P,g,a,T[P.modelIndex],Yi.disabled,P.isLightMesh?E:g.colorModeForRenderPass())}function _2(g,a,h){const y=a.updateZoomBasedPaintProperties(),b=function(T,E,P){let M,L,O,H=T.terrain?T.terrain.exaggeration():0;if(T.terrain&&H>0){const F=T.terrain,Z=F.findDEMTileFor(P);Z&&Z.dem?M=r.eE.create(F,P,Z):H=0}if(H===0&&(E.terrainElevationMin=0,E.terrainElevationMax=0),H===E.validForExaggeration&&(H===0||M&&M._demTile&&M._demTile.tileID===E.validForDEMTile.id&&M._dem._timestamp===E.validForDEMTile.timestamp))return!1;for(const F in E.instancesPerModel){const Z=E.instancesPerModel[F];for(let Y=0;Y<Z.instancedDataArray.length;++Y){const J=(M?H*M.getElevationAt(0|Z.instancedDataArray.float32[16*Y],0|Z.instancedDataArray.float32[16*Y+1],!0,!0):0)+Z.instancesEvaluatedElevation[Y];Z.instancedDataArray.float32[16*Y+6]=J,L=L?Math.min(E.terrainElevationMin,J):J,O=O?Math.max(E.terrainElevationMax,J):J}}return E.terrainElevationMin=L||0,E.terrainElevationMax=O||0,E.validForExaggeration=H,E.validForDEMTile=M&&M._demTile?{id:M._demTile.tileID,timestamp:M._dem._timestamp}:{id:void 0,timestamp:0},!0}(g,a,h);(y||b)&&(a.uploaded=!1,a.upload(g.context))}const zl={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new r.d8([0,0,0],[r.al,r.al,0])};function sw(g,a){const h=1<<g.canonical.z,y=a.getFreeCameraOptions().position,b=a.elevation,T=g.canonical.x/h,E=(g.canonical.x+1)/h,P=g.canonical.y/h,M=(g.canonical.y+1)/h;let L=a._centerAltitude;if(b){const Z=b.getMinMaxForTile(g);Z&&Z.max>L&&(L=Z.max)}const O=r.aA(y.x,T,E)-y.x,H=r.aA(y.y,P,M)-y.y,F=r.ce(L,a.center.lat)-y.z;return a._zoomFromMercatorZ(Math.sqrt(O*O+H*H+F*F))}function ow(g,a,h,y,b,T,E){const P=g.context,M=g.renderPass==="shadow",L=g.shadowRenderer,O=M&&L?L.getShadowPassDepthMode():new hi(P.gl.LEQUAL,hi.ReadWrite,g.depthRangeFor3D),H=g.isTileAffectedByFog(T),F=g.transform.projection.name==="globe";if(h.meshes)for(const Z of h.meshes){const Y=F?[]:["MODEL_POSITION_ON_GPU"],J=[];let se,ne,ae;const fe=!F&&y.instancedDataArray.length>20;fe&&Y.push("INSTANCED_ARRAYS");const ue=Xu(g,a.paint.get("model-cutoff-fade-range"));if(ue.shouldRenderCutoff&&Y.push("RENDER_CUTOFF"),M&&L)se=g.getOrCreateProgram("modelDepth",{defines:Y}),ne=zf(E.shadowTileMatrix,E.shadowTileMatrix,Float32Array.from(h.globalMatrix)),ae=L.getShadowPassColorMode();
3704else{Bf(Y,J,Z,g,a.paint.get("model-color-use-theme").constantOr("default")==="none"?null:a.lut),se=g.getOrCreateProgram("model",{defines:Y,overrideFog:H});const me=Z.material,Ie=me.pbrMetallicRoughness,Se=a.paint.get("model-opacity").constantOr(1),ve=a.paint.get("model-emissive-strength").constantOr(0);ne=Wv(T.expandedProjMatrix,Float32Array.from(h.globalMatrix),new Float32Array(16),null,g,Se,Ie.baseColorFactor,me.emissiveFactor,Ie.metallicFactor,Ie.roughnessFactor,me,ve,a,b),L&&(E.shadowUniformsInitialized?se.setShadowUniformValues(P,L.getShadowUniformValues()):(L.setupShadows(T.toUnwrapped(),se,"model-tile"),E.shadowUniformsInitialized=!0)),ae=ue.shouldRenderCutoff||Se<1||me.alphaMode!=="OPAQUE"?mn.alphaBlended:mn.unblended}g.uploadCommonUniforms(P,se,T.toUnwrapped(),null,ue);const Ce=Z.material.doubleSided?$i.disabled:$i.backCCW;if(fe)J.push(y.instancedDataBuffer),se.draw(g,P.gl.TRIANGLES,O,Yi.disabled,ae,Ce,ne,a.id,Z.vertexBuffer,Z.indexBuffer,Z.segments,a.paint,g.transform.zoom,void 0,J,y.instancedDataArray.length);else{const me=M?"u_instance":"u_normal_matrix";for(let Ie=0;Ie<y.instancedDataArray.length;++Ie)ne[me]=new Float32Array(y.instancedDataArray.arrayBuffer,64*Ie,16),se.draw(g,P.gl.TRIANGLES,O,Yi.disabled,ae,Ce,ne,a.id,Z.vertexBuffer,Z.indexBuffer,Z.segments,a.paint,g.transform.zoom,void 0,J)}}if(h.children)for(const Z of h.children)ow(g,a,Z,y,b,T,E)}const v2=[1,-1,1];function nx(g,a,h,y){if(!h.modelManager)return!0;const b=h.modelManager;if(!h.shadowRenderer)return!0;const T=h.shadowRenderer,E=a.aabb;let P=!0,M=g.maxHeight;if(M===0){let O=0;for(const H in g.instancesPerModel){const F=b.getModel(H,y);F?O=Math.max(O,Math.max(Math.max(F.aabb.max[0],F.aabb.max[1]),F.aabb.max[2])):P=!1}M=g.maxScale*O*1.41+g.maxVerticalOffset,P&&(g.maxHeight=M)}E.max[2]=M,E.min[2]+=g.terrainElevationMin,E.max[2]+=g.terrainElevationMax,r.af(E.min,E.min,a.tileMatrix),r.af(E.max,E.max,a.tileMatrix);const L=E.intersects(T.getCurrentCascadeFrustum());return h.currentShadowCascade===0&&(g.isInsideFirstShadowMapFrustum=L===2),L===0}function Ty(g,a){const h=g.uniformValues.u_cutoff_params[0],y=g.uniformValues.u_cutoff_params[1],b=g.uniformValues.u_cutoff_params[2],T=g.uniformValues.u_cutoff_params[3];return y===h||T===b?1:r.aA(((a-h)/(y-h)-b)/(T-b),0,1)}function fp(g,a,h,y){if(a.pitch<20)return 1;const b=a.getWorldToCameraMatrix();r.aB(b,b,g);const T=r.bT(h.min[0],h.min[1],h.min[2],1);let E=r.aC(r.eF(),T,b),P=E,M=E;T[1]=h.max[1],E=r.aC(r.eF(),T,b),P=E[1]<P[1]?E:P,M=E[1]>M[1]?E:M,T[0]=h.max[0],E=r.aC(r.eF(),T,b),P=E[1]<P[1]?E:P,M=E[1]>M[1]?E:M,T[1]=h.min[1],E=r.aC(r.eF(),T,b),P=E[1]<P[1]?E:P,M=E[1]>M[1]?E:M;const L=r.aA(y[0],0,1),O=100*a.pixelsPerMeter*r.aA(y[1],0,1),H=r.aA(y[2],0,1),F=r.eG(r.eF(),P,M,L),Z=Math.tan(.5*a.fovX),Y=-F[2]*Z;if(O===0)return F[1]<-Math.abs(Y)?H:1;const J=(-Math.abs(Y)-F[1])/O,se=(ae,fe,ue)=>(1-ue)*ae+ue*fe,ne=r.aA(se(1,H,J),H,1);return se(1,ne,r.aA((a.pitch-20)/20,0,1))}class x2{}class b2{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(a,h,y){{const H=this._storage.get(h.id);if(H)return H.lastUsedFrameIdx=a,H.buf}const b=y.gl,T=b.getBufferParameter(b.ELEMENT_ARRAY_BUFFER,b.BUFFER_SIZE),E=new ArrayBuffer(T),P=new Int16Array(E);b.getBufferSubData(b.ELEMENT_ARRAY_BUFFER,0,new Int16Array(E));const M=new r.eI;for(let H=0;H<T/2;H+=3){const F=P[H],Z=P[H+1],Y=P[H+2];M.emplaceBack(F,Z),M.emplaceBack(Z,Y),M.emplaceBack(Y,F)}const L=y.bindVertexArrayOES.current,O=new x2;return O.buf=new eh(y,M),O.lastUsedFrameIdx=a,this._storage.set(h.id,O),y.bindVertexArrayOES.set(L),O.buf}update(a){for(const[h,y]of this._storage)a-y.lastUsedFrameIdx>30&&(y.buf.destroy(),this._storage.delete(h))}destroy(){for(const[a,h]of this._storage)h.buf.destroy(),this._storage.delete(a)}}class _D{constructor(a){this.occluderSize=30,this.depthOffset=-1e-4,a.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),a.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const w2=r.eh([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class vD{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class _a{constructor(a,h){this.revealStart=11,this.revealRange=2,a.registerParameter(this,[...h,"Reveal"],"revealStart",{min:0,max:17,step:.05}
vendor: 4,397 bytes, line 3704
3704),a.registerParameter(this,[...h,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const xD=r.eh([{type:"Float32",name:"a_pos_2f",components:2}]);class Cy{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(a,h){const y=a.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const E=new r.eJ,P=new r.b0;E.emplaceBack(-1,-1),E.emplaceBack(1,-1),E.emplaceBack(1,1),E.emplaceBack(-1,1),P.emplaceBack(0,1,2),P.emplaceBack(0,2,3),this.vignetteVx=a.context.createVertexBuffer(E,xD.members),this.vignetteIdx=a.context.createIndexBuffer(P)}const b=r.bf.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){a.uploadCommonUniforms(a.context,y);const E={u_vignetteShape:(T={vignetteShape:[h.start,h.range,Math.pow(10,h.fadePower)],vignetteColor:[h.color.r,h.color.g,h.color.b,h.color.a*h.strength]}).vignetteShape,u_vignetteColor:T.vignetteColor};y.draw(a,a.context.gl.TRIANGLES,hi.disabled,Yi.disabled,mn.alphaBlended,$i.disabled,E,"vignette",this.vignetteVx,this.vignetteIdx,b)}var T}}class $r{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(a,h){const y=a.getFreeCameraOptions().position,b=y.toAltitude(),T=y.toLngLat(),E=r.an(T.lng),P=r.an(T.lat),M=a.pixelsPerMeter/h,L=E*r.eL,O=r.eL*Math.log(Math.tan(Math.PI/4+P/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 H=-this._offsetYPrev+O,F=-this._elevationPrev+b;this._accumulatedOffsetX+=(-this._offsetXPrev+L)*M,this._accumulatedOffsetY+=H*M,this._accumulatedElevation+=F*M,this._offsetXPrev=L,this._offsetYPrev=O,this._elevationPrev=b}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function wn(g,a){return[-(g[0]-Math.floor(g[0]/a)*a),-(g[1]-Math.floor(g[1]/a)*a),-(g[2]-Math.floor(g[2]/a)*a)]}function aw(g){const a=r.eq(1323123451230),h=[];for(let y=0;y<g;++y){const b=2*a()-1,T=2*a()-1,E=2*a()-1;h.push(r.d4(b,T,E))}return h}function Qa(g,a,h,y,b){const T=r.aA((b-h)/(y-h),0,1);return(1-T)*g+T*a}class mp{constructor(a){this._movement=new $r,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Cy,this._ppmScaleFactor=a}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(a,h){const y=a.transform;this._movement.update(y,this._ppmScaleFactor);const b=y.starsProjMatrix,T=r.c6([]);r.c8(T,T,r.an(90)-y._pitch),r.c7(T,T,-y.angle);const E=r.cb(new Float32Array(16),T),P=r.eK(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),M=r.ef([],P),L=r.aB([],M,E),O=Date.now()/1e3;return this._accumulatedTimeFromStart+=(O-this._prevTime)*h,this._prevTime=O,{projectionMatrix:b,modelviewMatrix:L}}}class qf extends mp{constructor(a){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 _a(a.tp,["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(a){const h=a.context;if(!this.particlesVx){const y=aw(this.particlesCount),b=new r.eM,T=new r.b0;let E=0;const P=r.eq(1323123451230);for(let M=0;M<y.length;++M){const L=y[M],O=[2*P()-1,P(),P(),P()];b.emplaceBack(L[0],L[1],L[2],-1,-1,...O),b.emplaceBack(L[0],L[1],L[2],1,-1,...O),b.emplaceBack(L[0],L[1],L[2],1,1,...O),b.emplaceBack(L[0],L[1],L[2],-1,1,...O),T.emplaceBack(E+0,E+1,E+2),T.emplaceBack(E+0,E+2,E+3),E+=4}this.particlesVx=h.createVertexBuffer(b,w2.members),this.particlesIdx=h.createIndexBuffer(T)}}draw(a){if(!this._params.overrideStyleParameters&&!a.style.rain)return;const h=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},y=a.transform.zoom;if(h.revealStart>y)return;const b=Qa(0,1,h.revealStart,h.revealStart+h.revealRange,y);if(!this.particlesVx||!this.particlesIdx)return;const T=structuredClone(this._params);let E=[-T.direction.x,T.direction.y,-100];r.aw(E,E);
3704const P=structuredClone(this._vignetteParams);P.strength*=b,T.overrideStyleParameters||(T.intensity=a.style.rain.state.density,T.timeFactor=a.style.rain.state.intensity,T.color=structuredClone(a.style.rain.state.color),E=structuredClone(a.style.rain.state.direction),T.screenThinning.intensity=a.style.rain.state.centerThinning,T.dropletSizeX=a.style.rain.state.dropletSize[0],T.dropletSizeYScale=a.style.rain.state.dropletSize[1]/a.style.rain.state.dropletSize[0],T.distortionStrength=100*a.style.rain.state.distortionStrength,P.strength=1,P.color=structuredClone(a.style.rain.state.vignetteColor));const M=this.updateOnRender(a,T.timeFactor),L=a.context,O=L.gl,H=a.transform;this.screenTexture&&this.screenTexture.size[0]===a.width&&this.screenTexture.size[1]===a.height||(this.screenTexture=new r.T(L,{width:a.width,height:a.height,data:null},O.RGBA8)),T.distortionStrength>0&&(L.activeTexture.set(O.TEXTURE0),this.screenTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),O.copyTexSubImage2D(O.TEXTURE_2D,0,0,0,0,0,a.width,a.height));const F=a.getOrCreateProgram("rainParticle");a.uploadCommonUniforms(L,F),L.activeTexture.set(O.TEXTURE0),this.screenTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE);const Z=[T.color.r,T.color.g,T.color.b,T.color.a],Y=(J,se)=>{const ne=wn(this._movement.getPosition(),J),ae=T.dropletSizeX,fe=T.dropletSizeX*T.dropletSizeYScale,ue=a.width/2,Ce=a.height/2,me=Qa(0,T.screenThinning.start,0,1,T.screenThinning.intensity),Ie=Qa(.001,T.screenThinning.range,0,1,T.screenThinning.intensity),Se=Qa(0,T.screenThinning.particleOffset,0,1,T.screenThinning.intensity),ve=(ke={modelview:M.modelviewMatrix,projection:M.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:ne,velocityConeAperture:T.velocityConeAperture,velocity:T.velocity,boxSize:J,rainDropletSize:[ae,fe],distortionStrength:T.distortionStrength,rainDirection:E,color:Z,screenSize:[H.width,H.height],thinningCenterPos:[ue,Ce],thinningShape:[me,Ie,Math.pow(10,T.screenThinning.fadePower)],thinningAffectedRatio:T.screenThinning.affectedRatio,thinningParticleOffset:Se,shapeDirectionalPower:T.shapeDirPower,shapeNormalPower:T.shapeNormalPower,mode:se?0:1},{u_modelview:Float32Array.from(ke.modelview),u_projection:Float32Array.from(ke.projection),u_time:ke.time,u_cam_pos:ke.camPos,u_texScreen:0,u_velocityConeAperture:ke.velocityConeAperture,u_velocity:ke.velocity,u_boxSize:ke.boxSize,u_rainDropletSize:ke.rainDropletSize,u_distortionStrength:ke.distortionStrength,u_rainDirection:ke.rainDirection,u_color:ke.color,u_screenSize:ke.screenSize,u_thinningCenterPos:ke.thinningCenterPos,u_thinningShape:ke.thinningShape,u_thinningAffectedRatio:ke.thinningAffectedRatio,u_thinningParticleOffset:ke.thinningParticleOffset,u_shapeDirectionalPower:ke.shapeDirectionalPower,u_shapeNormalPower:ke.shapeNormalPower,u_mode:ke.mode});var ke;const Ke=Math.round(T.intensity*this.particlesCount),$e=r.bf.simpleSegment(0,0,4*Ke,2*Ke);F.draw(a,O.TRIANGLES,hi.disabled,Yi.disabled,mn.alphaBlended,$i.disabled,ve,"rain_particles",this.particlesVx,this.particlesIdx,$e)};T.distortionStrength>0&&Y(T.boxSize,!0),Y(T.boxSize,!1),this._vignette.draw(a,P)}}const ed=r.eh([{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 lw extends mp{constructor(a){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 _a(a.tp,["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(a){const h=a.context;if(!this.particlesVx){const y=aw(this.particlesCount),b=new r.eN,T=new r.b0;let E=0;const P=r.eq(1323123451230);for(let M=0;M<y.length;++M){const L=y[M],O=P(),H=P(),F=P(),Z=[M/y.length,O,H,F],Y=[P(),P()];b.emplaceBack(L[0],L[1],L[2],-1,-1,...Z,...Y),b.emplaceBack(L[0],L[1],L[2],
37041,-1,...Z,...Y),b.emplaceBack(L[0],L[1],L[2],1,1,...Z,...Y),b.emplaceBack(L[0],L[1],L[2],-1,1,...Z,...Y),T.emplaceBack(E+0,E+1,E+2),T.emplaceBack(E+0,E+2,E+3),E+=4}this.particlesVx=h.createVertexBuffer(b,ed.members),this.particlesIdx=h.createIndexBuffer(T)}}draw(a){if(!this._params.overrideStyleParameters&&!a.style.snow)return;const h=structuredClone(this._params);let y=[-h.direction.x,h.direction.y,-100];r.aw(y,y);const b=structuredClone(this._vignetteParams),T=h.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},E=a.transform.zoom;if(T.revealStart>E)return;const P=Qa(0,1,T.revealStart,T.revealStart+T.revealRange,E);b.strength*=P,h.overrideStyleParameters||(h.intensity=a.style.snow.state.density,h.timeFactor=a.style.snow.state.intensity,h.color=structuredClone(a.style.snow.state.color),y=structuredClone(a.style.snow.state.direction),h.screenThinning.intensity=a.style.snow.state.centerThinning,h.billboardSize=2.79*a.style.snow.state.flakeSize,b.strength=1,b.color=structuredClone(a.style.snow.state.vignetteColor));const M=this.updateOnRender(a,h.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const L=a.context,O=L.gl,H=a.transform,F=a.getOrCreateProgram("snowParticle");a.uploadCommonUniforms(L,F),((Z,Y,J)=>{const se=wn(this._movement.getPosition(),Z),ne=H.width/2,ae=H.height/2,fe=Qa(0,J.screenThinning.start,0,1,J.screenThinning.intensity),ue=Qa(.001,J.screenThinning.range,0,1,J.screenThinning.intensity),Ce=Qa(0,J.screenThinning.particleOffset,0,1,J.screenThinning.intensity),me=(Ie={modelview:M.modelviewMatrix,projection:M.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:se,velocityConeAperture:J.velocityConeAperture,velocity:J.velocity,horizontalOscillationRadius:J.horizontalOscillationRadius,horizontalOscillationRate:J.horizontalOscillationRate,boxSize:Z,billboardSize:1*J.billboardSize,simpleShapeParameters:[J.shapeFadeStart,J.shapeFadePower],screenSize:[H.width,H.height],thinningCenterPos:[ne,ae],thinningShape:[fe,ue,Math.pow(10,J.screenThinning.fadePower)],thinningAffectedRatio:J.screenThinning.affectedRatio,thinningParticleOffset:Ce,color:[J.color.r,J.color.g,J.color.b,J.color.a],direction:y},{u_modelview:Float32Array.from(Ie.modelview),u_projection:Float32Array.from(Ie.projection),u_time:Ie.time,u_cam_pos:Ie.camPos,u_velocityConeAperture:Ie.velocityConeAperture,u_velocity:Ie.velocity,u_horizontalOscillationRadius:Ie.horizontalOscillationRadius,u_horizontalOscillationRate:Ie.horizontalOscillationRate,u_boxSize:Ie.boxSize,u_billboardSize:Ie.billboardSize,u_simpleShapeParameters:Ie.simpleShapeParameters,u_screenSize:Ie.screenSize,u_thinningCenterPos:Ie.thinningCenterPos,u_thinningShape:Ie.thinningShape,u_thinningAffectedRatio:Ie.thinningAffectedRatio,u_thinningParticleOffset:Ie.thinningParticleOffset,u_particleColor:Ie.color,u_direction:Ie.direction});var Ie;const Se=Math.round(J.intensity*this.particlesCount),ve=r.bf.simpleSegment(0,0,4*Se,2*Se);this.particlesVx&&this.particlesIdx&&F.draw(a,O.TRIANGLES,hi.disabled,Yi.disabled,mn.alphaBlended,$i.disabled,me,"snow_particles",this.particlesVx,this.particlesIdx,ve)})(h.boxSize,0,h),this._vignette.draw(a,b)}}const cw={symbol:function(g,a,h,y,b){if(g.renderPass!=="translucent")return;const T=Yi.disabled,E=g.colorModeForRenderPass(),P=h.layout.get("text-variable-anchor"),M=h.layout.get("text-size-scale-range"),L=r.aA(g.scaleFactor,M[0],M[1]);P&&function(F,Z,Y,J,se,ne,ae,fe){const ue=Z.transform,Ce=se==="map",me=ne==="map";for(const Ie of F){const Se=J.getTile(Ie),ve=Se.getBucket(Y);if(!ve||!ve.text||!ve.text.segments.get().length)continue;const ke=r.bJ(ve.textSizeData,ue.zoom,fe),Ke=yv(Ie,ve.getProjection(),ue),$e=ue.calculatePixelsToTileUnitsMatrix(Se),ct=_f(Ke,Se.tileID.canonical,me,Ce,ue,ve.getProjection(),$e),it=ve.hasIconTextFit()&&ve.hasIconData();ke&&Yv(ve,Ce,me,ae,ue,ct,Ie,Math.pow(2,ue.zoom-Se.tileID.overscaledZ),ke,it)}}(y,g,h,a,h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),b,L);const O=h.paint.get("icon-opacity").constantOr(1)!==0,H=h.paint.get("text-opacity").constantOr(1)!==0;h.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(O||H)?wy(g,a,h,y,T,E):(O&&wy(g,a,h,y,T,E,{onlyIcons:!0}),H&&wy(g,a,h,y,T,E,{onlyText:!0})),a.map.showCollisionBoxes&&(by(g,a,h,y,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),!0),by(g,a,h,y,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),!1))},circle:function(g,a,h,y){if(g.renderPass!=="translucent")return;const b=h.paint.get("circle-opacity"),T=h.paint.get("circle-stroke-width"),E=h.paint.get("circle-stroke-opacity"),P=h.layout.get("
vendor: 6,921 bytes, line 3704
3704circle-sort-key").constantOr(1)!==void 0,M=h.paint.get("circle-emissive-strength");if(b.constantOr(1)===0&&(T.constantOr(1)===0||E.constantOr(1)===0))return;const L=g.context,O=L.gl,H=g.transform,F=!(!g.terrain||!g.terrain.enabled),Z=h.layout.get("circle-elevation-reference"),Y=g.depthModeForSublayer(0,hi.ReadOnly),J=new hi(g.context.gl.LEQUAL,hi.ReadOnly,g.depthRangeFor3D),se=Z==="none"||F?Y:J,ne=Yi.disabled,ae=g.colorModeForDrapableLayerRenderPass(M),fe=H.projection.name==="globe",ue=[r.aF(H.center.lng),r.aJ(H.center.lat)],Ce=[];for(let Ie=0;Ie<y.length;Ie++){const Se=y[Ie],ve=a.getTile(Se),ke=ve.getBucket(h);if(!ke||ke.projection.name!==H.projection.name)continue;const Ke=ke.programConfigurations.get(h.id),$e=ke.layoutVertexBuffer,ct=ke.globeExtVertexBuffer,it=ke.indexBuffer,gt=r.d$(h),jt=[ct],et=g.isTileAffectedByFog(Se);fe&>.push("PROJECTION_GLOBE_VIEW"),gt.push("DEPTH_D24"),g.terrain&&H.depthOcclusionForSymbolsAndCircles&>.push("DEPTH_OCCLUSION"),ke.hasElevation&&!g.terrain&&(gt.push("ELEVATED_ROADS"),jt.push(ke.elevatedLayoutVertexBuffer));const Oe=g.getOrCreateProgram("circle",{config:Ke,defines:gt,overrideFog:et}),yt=H.projection.createInversionMatrix(H,Se.canonical),nt={programConfiguration:Ke,program:Oe,layoutVertexBuffer:$e,dynamicBuffers:jt,indexBuffer:it,uniformValues:r.e0(g,Se,ve,yt,ue,h),tile:ve};if(P){const wt=ke.segments.get();for(const Bt of wt)Ce.push({segments:new r.bf([Bt]),sortKey:Bt.sortKey,state:nt})}else Ce.push({segments:ke.segments,sortKey:0,state:nt})}P&&Ce.sort((Ie,Se)=>Ie.sortKey-Se.sortKey);const me={useDepthForOcclusion:H.depthOcclusionForSymbolsAndCircles};for(const Ie of Ce){const{programConfiguration:Se,program:ve,layoutVertexBuffer:ke,dynamicBuffers:Ke,indexBuffer:$e,uniformValues:ct,tile:it}=Ie.state,gt=Ie.segments;g.terrain&&g.terrain.setupElevationDraw(it,ve,me),g.uploadCommonUniforms(L,ve,it.tileID.toUnwrapped()),ve.draw(g,O.TRIANGLES,se,ne,ae,$i.disabled,ct,h.id,ke,$e,gt,h.paint,H.zoom,Se,Ke)}},heatmap:function(g,a,h,y){if(h.paint.get("heatmap-opacity")!==0)if(g.renderPass==="offscreen"){const b=g.context,T=b.gl,E=Yi.disabled,P=new mn([T.ONE,T.ONE,T.ONE,T.ONE],r.ao.transparent,[!0,!0,!0,!0]);(function(Z,Y,J,se){const ne=Z.gl,ae=Y.width*se,fe=Y.height*se;Z.activeTexture.set(ne.TEXTURE1),Z.viewport.set([0,0,ae,fe]);let ue=J.heatmapFbo;if(!ue||ue&&(ue.width!==ae||ue.height!==fe)){ue&&ue.destroy();const Ce=ne.createTexture();ne.bindTexture(ne.TEXTURE_2D,Ce),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_WRAP_S,ne.CLAMP_TO_EDGE),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_WRAP_T,ne.CLAMP_TO_EDGE),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_MIN_FILTER,ne.LINEAR),ne.texParameteri(ne.TEXTURE_2D,ne.TEXTURE_MAG_FILTER,ne.LINEAR),ue=J.heatmapFbo=Z.createFramebuffer(ae,fe,!0,null),function(me,Ie,Se,ve,ke,Ke){const $e=me.gl;$e.texImage2D($e.TEXTURE_2D,0,me.extRenderToTextureHalfFloat?$e.RGBA16F:$e.RGBA,ke,Ke,0,$e.RGBA,me.extRenderToTextureHalfFloat?$e.HALF_FLOAT:$e.UNSIGNED_BYTE,null),ve.colorAttachment.set(Se)}(Z,0,Ce,ue,ae,fe)}else ne.bindTexture(ne.TEXTURE_2D,ue.colorAttachment.get()),Z.bindFramebuffer.set(ue.framebuffer)})(b,g,h,g.transform.projection.name==="globe"?.5:.25),b.clear({color:r.ao.transparent});const M=g.transform,L=M.projection.name==="globe",O=L?["PROJECTION_GLOBE_VIEW"]:[],H=L?$i.frontCCW:$i.disabled,F=[r.aF(M.center.lng),r.aJ(M.center.lat)];for(let Z=0;Z<y.length;Z++){const Y=y[Z];if(a.hasRenderableParent(Y))continue;const J=a.getTile(Y),se=J.getBucket(h);if(!se||se.projection.name!==M.projection.name)continue;const ne=g.isTileAffectedByFog(Y),ae=se.programConfigurations.get(h.id),fe=g.getOrCreateProgram("heatmap",{config:ae,defines:O,overrideFog:ne}),{zoom:ue}=g.transform;g.terrain&&g.terrain.setupElevationDraw(J,fe),g.uploadCommonUniforms(b,fe,Y.toUnwrapped());const Ce=M.projection.createInversionMatrix(M,Y.canonical);fe.draw(g,T.TRIANGLES,hi.disabled,E,P,H,c2(g,Y,J,Ce,F,ue,h.paint.get("heatmap-intensity")),h.id,se.layoutVertexBuffer,se.indexBuffer,se.segments,h.paint,g.transform.zoom,ae,L?[se.globeExtVertexBuffer]:null)}b.viewport.set([0,0,g.width,g.height])}else g.renderPass==="translucent"&&(g.context.setColorMode(g.colorModeForRenderPass()),function(b,T){const E=b.context,P=E.gl,M=T.heatmapFbo;if(!M)return;E.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,M.colorAttachment.get()),E.activeTexture.set(P.TEXTURE1);let L=T.colorRampTexture;L||(L=T.colorRampTexture=new r.T(E,T.colorRamp,P.RGBA8)),L.bind(P.LINEAR,P.CLAMP_TO_EDGE),b.getOrCreateProgram("heatmapTexture").draw(b,P.TRIANGLES,hi.disabled,Yi.disabled,b.colorModeForRenderPass(),$i.disabled,((O,H,F,Z)=>({u_image:0,u_color_ramp:1,u_opacity:H.paint.get("heatmap-opacity")}))(0,T),T.id,b.viewportBuffer,b.quadTriangleIndexBuffer,b.viewportSegments,T.paint,b.transform.zoom)}(g,h))},line:function(g,a,h,y){if(g.renderPass!=="translucent")return;const b=h.paint.get("line-opacity"),T=h.paint.get("line-width");if(b.constantOr(1)===0||T.constantOr(1)===0)return;const E=h.paint.get("line-emissive-strength"),P=h.paint.get("line-occlusion-opacity"),M=h.layout.get("line-elevation-reference"),L=h.layout.get("line-width-unit")==="meters",O=M==="sea",H=!(!g.terrain||!g.terrain.enabled),F=g.context,Z=F.gl;if(h.hasElevatedBuckets&&g.transform.projection.name==="globe")return;const Y=h.layout.get("line-cross-slope"),J=Y!==void 0,se=Y<1,ne=g.colorModeForDrapableLayerRenderPass(E),ae=g.terrain&&g.terrain.renderingToTexture,fe=ae?1:r.o.devicePixelRatio,ue=h.paint.get("line-dasharray"),Ce=ue.constantOr(1),me=h.layout.get("line-cap"),Ie=ue.constantOr(null),Se=me.constantOr(null),ve=h.paint.get("line-pattern"),ke=ve.constantOr(1),Ke=h.paint.get("line-pattern-cross-fade"),$e=ve.constantOr(null),ct=h.paint.get("line-opacity").constantOr(1);let it=!ke&&ct!==1||g.depthOcclusion&&P>0&&P<1;const gt=h.paint.get("line-gradient"),jt=ke?"linePattern":"line",et=r.e1(h);let Oe;if(ae&&g.terrain&&g.terrain.clipOrMaskOverlapStencilType()&&(it=!1),P!==0&&g.depthOcclusion){const Bt=h.paint._values["line-opacity"];Bt&&Bt.value&&Bt.value.kind==="constant"?Oe=Bt.value:r.w(`Occlusion opacity for layer ${h.id} is supported only when line-opacity isn't data-driven.`)}T.value.kind!=="constant"&&T.value.isLineProgressConstant===!1&&et.push("VARIABLE_LINE_WIDTH");const yt=(Bt,oi,Mt,Lt,li,ti)=>{for(const Yt of Bt){const ii=a.getTile(Yt);if(ke&&!ii.patternsLoaded())continue;const ji=ii.getBucket(h);if(!ji||ji.elevationType!=="none"&&!li||ji.elevationType==="none"&&li)continue;g.prepareDrawTile();const Sn=[...oi],zn=g.shadowRenderer,vr=ji.elevationType==="road"&&!!zn&&zn.enabled;let qi=[0,0,0];if(vr){const Ki=g.style.directionalLight,Bn=g.style.ambientLight;Ki&&Bn&&(qi=vc(g.style,Ki,Bn)),Sn.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Dn=ji.programConfigurations.get(h.id);let dn=!1;if($e&&ii.imageAtlas){const Ki=r.e2.from($e),Bn=Ki.getPrimary().scaleSelf(fe).toString(),ts=ii.imageAtlas.patternPositions.get(Bn),Ps=Ki.get
3704Secondary(),cs=Ps?ii.imageAtlas.patternPositions.get(Ps.scaleSelf(fe).toString()):null;dn=!!ts&&!!cs,ts&&Dn.setConstantPatternPositions(ts,cs)}Ke>0&&(dn||Dn.getPatternTransitionVertexBuffer("line-pattern"))&&Sn.push("LINE_PATTERN_TRANSITION");const hr=g.isTileAffectedByFog(Yt),Ln=g.getOrCreateProgram(jt,{config:Dn,defines:Sn,overrideFog:hr});if(!ke&&Ie&&Se&&ii.lineAtlas){const Ki=ii.lineAtlas.getDash(Ie,Se);Ki&&Dn.setConstantPatternPositions(Ki)}vr&&zn.setupShadows(ii.tileID.toUnwrapped(),Ln,"vector-tile");let[Ir,Wn]=h.paint.get("line-trim-offset");(Se==="round"||Se==="square")&&Ir!==Wn&&(Ir===0&&(Ir-=1),Wn===1&&(Wn+=1));const hn=ae?Yt.projMatrix:null,nr=L?1/ji.tileToMeter/r.ay(ii,1,g.transform.zoom):1,gn=L?1/ji.tileToMeter/r.ay(ii,1,Math.floor(g.transform.zoom)):1,Or=ke?r.e3(g,ii,h,hn,fe,nr,gn,[Ir,Wn],qi,Ke):r.e4(g,ii,h,hn,ji.lineClipsArray.length,fe,nr,gn,[Ir,Wn],qi);if(gt){const Ki=ji.gradients[h.id];let Bn=Ki.texture;if(h.gradientVersion!==Ki.version){let ts=256;if(h.stepInterpolant){const Ps=a.getSource().maxzoom,cs=Yt.canonical.z===Ps?Math.ceil(1<<g.transform.maxZoom-Yt.canonical.z):1;ts=r.aA(r.e5(ji.maxLineLength/r.al*1024*cs),256,F.maxTextureSize)}Ki.gradient=r.e6({expression:h.gradientExpression(),evaluationKey:"lineProgress",resolution:ts,image:Ki.gradient||void 0,clips:ji.lineClipsArray}),Ki.texture?Ki.texture.update(Ki.gradient):Ki.texture=new r.T(F,Ki.gradient,Z.RGBA8),Ki.version=h.gradientVersion,Bn=Ki.texture}F.activeTexture.set(Z.TEXTURE1),Bn.bind(h.stepInterpolant?Z.NEAREST:Z.LINEAR,Z.CLAMP_TO_EDGE)}Ce&&(F.activeTexture.set(Z.TEXTURE0),ii.lineAtlasTexture&&ii.lineAtlasTexture.bind(Z.LINEAR,Z.REPEAT),Dn.updatePaintBuffers()),ke&&(F.activeTexture.set(Z.TEXTURE0),ii.imageAtlasTexture&&ii.imageAtlasTexture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE),Dn.updatePaintBuffers()),li&&!O&&g.terrain.setupElevationDraw(ii,Ln),g.uploadCommonUniforms(F,Ln,Yt.toUnwrapped());const or=Ki=>{Oe!=null&&(Oe.value=ct*P),Ln.draw(g,Z.TRIANGLES,Mt,Ki,ne,$i.disabled,Or,h.id,ji.layoutVertexBuffer,ji.indexBuffer,ji.segments,h.paint,g.transform.zoom,Dn,[ji.layoutVertexBuffer2,ji.patternVertexBuffer,ji.zOffsetVertexBuffer]),Oe!=null&&(Oe.value=ct)};if(it&&!li){const Ki=g.stencilModeForClipping(Yt).ref;Ki===0&&ae&&F.clear({stencil:0});const Bn={func:Z.EQUAL,mask:255};Or.u_alpha_discard_threshold=.8,or(new Yi(Bn,Ki,255,Z.KEEP,Z.KEEP,Z.INVERT)),Or.u_alpha_discard_threshold=0,or(new Yi(Bn,Ki,255,Z.KEEP,Z.KEEP,Z.KEEP))}else Or.u_alpha_discard_threshold=it&&li&&ti?.8:0,or(li?Lt:g.stencilModeForClipping(Yt))}};let nt=g.depthModeForSublayer(0,hi.ReadOnly);const wt=new hi(g.depthOcclusion?Z.GREATER:Z.LEQUAL,hi.ReadOnly,g.depthRangeFor3D);if(h.hasNonElevatedBuckets){const Bt=!ae&&g.terrain;P!==0&&Bt?r.w(`Occlusion opacity for layer ${h.id} is supported on terrain only if the layer has line-z-offset enabled.`):Bt?r.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${h.id}.`):yt(y,et,nt,Yi.disabled,!1,!0)}if(h.hasElevatedBuckets){M==="hd-road-markup"?H||(nt=wt,et.push("ELEVATED_ROADS")):(et.push("ELEVATED"),nt=wt,J&&et.push(se?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),O&&et.push("ELEVATION_REFERENCE_SEA"));const Bt=it?g.stencilModeFor3D():Yi.disabled;g.forceTerrainMode=!0,yt(y,et,nt,Bt,!0,!0),it&&yt(y,et,nt,Bt,!0,!1),g.forceTerrainMode=!1}it&&(g.resetStencilClippingMasks(),ae&&F.clear({stencil:0})),P===0||g.depthOcclusion||ae||g.layersWithOcclusionOpacity.push(g.currentLayer)},fill:function(g,a,h,y){const b=h.paint.get("fill-color"),T=h.paint.get("fill-opacity");if(T.constantOr(1)===0)return;const E=h.paint.get("fill-emissive-strength"),P=g.colorModeForDrapableLayerRenderPass(E),M=h.paint.get("fill-pattern"),L=g.opaquePassEnabledForLayer()&&!M.constantOr(1)&&b.constantOr(r.ao.transparent).a===1&&T.constantOr(0)===1?"opaque":"translucent";let O="none";h.layout.get("fill-elevation-reference")!=="none"?O="road":h.paint.get("fill-z-offset").constantOr(1)!==0&&(O="offset");const H=!(!g.terrain||!g.terrain.enabled),F={painter:g,sourceCache:a,layer:h,coords:y,colorMode:P,elevationType:O,terrainEnabled:H,pass:L};if(g.renderPass!=="shadow")if(O!=="offset"){if(Lf(F,!1),O==="road"){const Z=!H&&g.renderPass==="translucent";Z&&hp(g,a,h,y,"geometry"),Lf(F,!0,Yi.disabled),Z&&function(Y){const{painter:J,sourceCache:se,layer:ne,coords:ae,colorMode:fe}=Y,ue=J.context.gl,Ce=Y.painter.shadowRenderer,me=!!Ce&&Ce.enabled,Ie=new hi(J.context.gl.LEQUAL,hi.ReadOnly,J.depthRangeFor3D);let Se=[0,0,0];if(me){const ke=J.style.directionalLight,Ke=J.style.ambientLight;ke&&Ke&&(Se=vc(J.style,ke,Ke))}const ve=ke=>{for(const Ke of ae){const $e=se.getTile(Ke),ct=$e.getBucket(ne);if(!ct)continue;const it=ct.elevatedStructures;if(!it)continue;let gt,jt;if(ke?(gt=it.renderableBridgeSegments,jt=it.bridgeProgramConfigurations.get(ne.id)):(gt=it.renderableTunnelSegments,jt=it.tunnelProgramConfigurations.get(ne.id)),!gt||gt.segments[0].primitiveLength===0)continue;jt.updatePaintBuffers(),J.prepareDrawTile();const et=J.isTileAffectedByFog(Ke),Oe=[];me&&Oe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const yt=J.getOrCreateProgram("elevatedStructures",{config:jt,overrideFog:et,defines:Oe}),nt=J.translatePosMatrix(Ke.projMatrix,$e,ne.paint.get("fill-translate"),ne.paint.get("fill-translate-anchor"));me&&Ce.setupShadows($e.tileID.toUnwrapped(),yt,"vector-tile");const wt=hD(nt,Se);J.uploadCommonUniforms(J.context,yt,Ke.toUnwrapped()),yt.draw(J,ue.TRIANGLES,Ie,Yi.disabled,fe,$i.backCCW,wt,ne.id,it.vertexBuffer,it.indexBuffer,gt,ne.paint,J.transform.zoom,jt,[it.vertexBufferNormal])}};ve(!0),ve(!1)}(F)}}else Lf(F,!1,g.stencilModeFor3D());else g.shadowRenderer&&O==="road"&&!H&&function(Z){const{painter:Y,sourceCache:J,layer:se,coords:ne}=Z,ae=Y.context.gl,fe=Z.painter.shadowRenderer;for(const ue of ne){const Ce=J.getTile(ue),me=Ce.getBucket(se);if(!me)continue;const Ie=me.elevatedStructures;if(!Ie||!Ie.shadowCasterSegments||Ie.shadowCasterSegments.segments[0].primitiveLength===0)continue;Y.prepareDrawTile();const Se=me.bufferData.programConfigurations.get(se.id),ve=Y.isTileAffectedByFog(ue),ke=Y.getOrCreateProgram("elevatedStructuresDepth",{config:Se,overrideFog:ve}),Ke=fe.calculateShadowPassMatrixFromTile(Ce.tileID.toUnwrapped());Y.uploadCommonUniforms(Y.context,ke,ue.toUnwrapped());const $e={u_matrix:Ke,u_depth_bias:0};ke.draw(Y,ae.TRIANGLES,fe.getShadowPassDepthMode(),Yi.disabled,fe.getShadowPassColorMode(),$i.disabled,$e,se.id,Ie.vertexBuffer,Ie.indexBuffer,Ie.shadowCasterSegments,se.paint,Y.transform.zoom,Se)}}
3704(F)},"fill-extrusion":function(g,a,h,y){const b=h.paint.get("fill-extrusion-opacity"),T=g.context,E=T.gl,P=g.terrain,M=P&&P.renderingToTexture;if(b===0)return;const L=g.conflationActive&&g.style.isLayerClipped(h,a.getSource()),O=g.style.order.indexOf(h.fqid);if(L&&function(H,F,Z,Y,J){for(const se of Y){const ne=F.getTile(se).getBucket(Z);ne&&(ne.updateReplacement(se,H.replacementSource,J),ne.uploadCentroid(H.context))}}(g,a,h,y,O),P||L)for(const H of y){const F=a.getTile(H).getBucket(h);F&&ih(g.context,a,H,F,h,P,L)}if(g.renderPass==="shadow"&&g.shadowRenderer){const H=g.shadowRenderer;if(P&&b<.65&&h._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof r.ad)return;const F=H.getShadowPassDepthMode(),Z=H.getShadowPassColorMode();ri(g,a,h,y,F,Yi.disabled,Z,L)}else if(g.renderPass==="translucent"){const H=!h.paint.get("fill-extrusion-pattern").constantOr(1),F=h.paint.get("fill-extrusion-color").constantOr(r.ao.white);if(!M&&F.a!==0){const Z=new hi(g.context.gl.LEQUAL,hi.ReadWrite,g.depthRangeFor3D);b===1&&H?ri(g,a,h,y,Z,Yi.disabled,mn.unblended,L):(ri(g,a,h,y,Z,Yi.disabled,mn.disabled,L),ri(g,a,h,y,Z,g.stencilModeFor3D(),g.colorModeForRenderPass(),L),g.resetStencilClippingMasks())}if(g.style.enable3dLights()&&H&&(!P&&g.transform.projection.name!=="globe"||M)){const Z=h.paint.get("fill-extrusion-opacity"),Y=h.paint.get("fill-extrusion-ambient-occlusion-intensity"),J=h.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),se=h.paint.get("fill-extrusion-flood-light-intensity"),ne=h.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ae=h.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:h.lut).toArray01().slice(0,3),fe=Y>0&&J>0,ue=se>0,Ce=(Se,ve,ke)=>(1-ke)*Se+ke*ve,me=new K1;me.translate=h.paint.get("fill-extrusion-translate"),me.translateAnchor=h.paint.get("fill-extrusion-translate-anchor"),me.edgeRadius=h.layout.get("fill-extrusion-edge-radius"),me.cutoffFadeRange=h.paint.get("fill-extrusion-cutoff-fade-range");const Ie=Se=>{const ve=g.depthModeForSublayer(1,hi.ReadOnly,E.LEQUAL,!0),ke=h.paint.get(Se?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ke=Ce(.1,3,ke),$e=g._showOverdrawInspector;if(!$e){const ct=new Yi({func:E.ALWAYS,mask:255},255,255,E.KEEP,E.KEEP,E.REPLACE),it=new mn([E.ONE,E.ONE,E.ONE,E.ONE],r.ao.transparent,[!1,!1,!1,!0],E.MIN);Qu(me,g,a,h,y,ve,ct,it,$i.disabled,Se,"sdf",Z,Y,J,se,ae,Ke,L,!1)}{const ct=$e?Yi.disabled:new Yi({func:E.EQUAL,mask:255},255,255,E.KEEP,E.DECR,E.DECR),it=$e?g.colorModeForRenderPass():new mn([E.ONE_MINUS_DST_ALPHA,E.DST_ALPHA,E.ONE,E.ONE],r.ao.transparent,[!0,!0,!0,!0]);Qu(me,g,a,h,y,ve,ct,it,$i.disabled,Se,"color",Z,Y,J,se,ae,Ke,L,!1)}};if(M){const Se=(ve,ke,Ke)=>{const $e=g.depthModeForSublayer(1,hi.ReadOnly,E.LEQUAL,!1),ct=h.paint.get(ve?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),it=Ce(.1,3,ct);{const gt=new mn([E.ONE,E.ONE,E.ONE,E.ONE],r.ao.transparent,[!1,!1,!1,!0]);Qu(me,g,a,h,y,$e,Yi.disabled,gt,$i.disabled,ve,"clear",Z,Y,J,se,ae,it,L,ke)}{const gt=new Yi({func:E.ALWAYS,mask:255},255,255,E.KEEP,E.KEEP,E.REPLACE),jt=new mn([E.ONE,E.ONE,E.ONE,E.ONE],r.ao.transparent,[!1,!1,!1,!0],E.MIN);Qu(me,g,a,h,y,$e,gt,jt,$i.disabled,ve,"sdf",Z,Y,J,se,ae,it,L,ke)}{const gt=ve?E.ZERO:E.ONE_MINUS_DST_ALPHA,jt=new Yi({func:E.EQUAL,mask:255},255,255,E.KEEP,E.DECR,E.DECR),et=new mn([gt,E.DST_ALPHA,E.ONE_MINUS_DST_ALPHA,E.ZERO],r.ao.transparent,[!0,!0,!0,!0]);Qu(me,g,a,h,y,$e,jt,et,$i.disabled,ve,"color",Z,Y,J,se,ae,it,L,ke)}{const gt=new mn([E.ONE,E.ONE,E.ONE,ve?E.ZERO:E.ONE],r.ao.transparent,[!1,!1,!1,!0],ve?E.FUNC_ADD:E.MAX);Qu(me,g,a,h,y,$e,Yi.disabled,gt,$i.disabled,ve,"clear",Z,Y,J,se,ae,it,L,ke,Ke)}};if(fe||ue){let ve;if(g.prepareDrawTile(),P){const ke=P.drapeBufferSize[0],Ke=P.drapeBufferSize[1];ve=P.framebufferCopyTexture,ve&&(!ve||ve.size[0]===ke&&ve.size[1]===Ke)||(ve&&ve.destroy(),ve=P.framebufferCopyTexture=new r.T(T,new r.q({width:ke,height:Ke}),E.RGBA8)),ve.bind(E.LINEAR,E.CLAMP_TO_EDGE),E.copyTexSubImage2D(E.TEXTURE_2D,0,0,0,0,0,ke,Ke)}fe&&Se(!0,!1,ve),ue&&Se(!1,!0,ve)}}else fe&&Ie(!0),ue&&Ie(!1),(fe||ue)&&g.resetStencilClippingMasks()}}},building:function(g,a,h,y){g.currentLayer<g.firstLightBeamLayer&&(g.firstLightBeamLayer=g.currentLayer);const b=h.paint.get("building-ambient-occlusion-ground-intensity"),T=h.paint.get("building-ambient-occlusion-ground-radius"),E=h.paint.get("building-ambient-occlusion-ground-attenuation"),P=h.paint.get("building-opacity");if(P<=0)return;let M=b>0&&T>0,L=!0;const O=h.paint.get("building-vertical-scale");if(O<=0)return;(!g.shadowRenderer||O<1)&&(L=!1);const H=g.conflationActive&&g.style.isLayerClipped(h,a.getSource()),F=g.style.order.indexOf(h.fqid);if(function(Z,Y,J,se,ne,ae){for(const fe of ae){const ue=Y.getTile(fe).getBucket(J);ue&&(ne&&ue.updateReplacement(fe,Z.replacementSource,se),ue.uploadUpdatedIndexBuffer(Z.context))}}(g,a,h,F,H,y),function(Z,Y,J,se){for(const ne of se){const ae=Y.getTile(ne).getBucket(J);ae&&ae.needsEvaluation()&&ae.uploadUpdatedColorBuffer(Z.context)}}(g,a,h,y),h.resetLayerRenderingStats(g),g.shadowRenderer&&(g.shadowRenderer.useNormalOffset=!0),g.renderPass==="shadow"&&g.shadowRenderer){const Z=g.shadowRenderer,Y=[],J=Z.getShadowPassDepthMode();Jv({painter:g,source:a,layer:h,coords:y,defines:Y,blendMode:Z.getShadowPassColorMode(),depthMode:J,opacity:P,verticalScale:O,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(g.renderPass==="translucent"){let Z=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];
3704L&&(Z=Z.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),g.shadowRenderer&&g.shadowRenderer.useNormalOffset&&(Z=Z.concat("NORMAL_OFFSET"));const Y=h.paint.get("building-facade-emissive-chance"),J=h.paint.get("building-ambient-occlusion-intensity"),se=h.paint.get("building-flood-light-intensity"),ne=h.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",ae=h.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(ne?null:h.lut).toArray01().slice(0,3),fe=h.paint.get("building-flood-light-ground-attenuation"),ue=se>0,Ce=new hi(g.context.gl.LEQUAL,hi.ReadWrite,g.depthRangeFor3D);P<1&&Jv({painter:g,source:a,layer:h,coords:y,defines:Z,blendMode:mn.disabled,depthMode:Ce,opacity:P,verticalScale:O,facadeEmissiveChance:Y,facadeAOIntensity:J,floodLightIntensity:se,floodLightColor:ae,depthOnly:!0});const me=g.colorModeForRenderPass();Jv({painter:g,source:a,layer:h,coords:y,defines:Z,blendMode:me,depthMode:Ce,opacity:P,verticalScale:O,facadeEmissiveChance:Y,facadeAOIntensity:J,floodLightIntensity:se,floodLightColor:ae}),M&&ex(g,a,h,y,!0,P,b,T,se,ae,E,H),ue&&ex(g,a,h,y,!1,P,b,T,se,ae,fe,H)}else if(g.renderPass==="light-beam"){const Z=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],Y=new hi(g.context.gl.LEQUAL,hi.ReadOnly,g.depthRangeFor3D);Jv({painter:g,source:a,layer:h,coords:y,defines:Z,blendMode:mn.alphaBlended,depthMode:Y,opacity:P,verticalScale:O,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}g.shadowRenderer&&(g.shadowRenderer.useNormalOffset=!1),g.resetStencilClippingMasks()},hillshade:function(g,a,h,y){if(g.renderPass!=="offscreen"&&g.renderPass!=="translucent"||g.style.disableElevatedTerrain)return;const b=g.context,T=g.terrain&&g.terrain.renderingToTexture,[E,P]=g.renderPass!=="translucent"||T?[{},y]:g.stencilConfigForOverlap(y);for(const M of P){const L=a.getTile(M);if(L.needsHillshadePrepare&&g.renderPass==="offscreen")tD(g,L,h);else if(g.renderPass==="translucent"){const O=g.depthModeForSublayer(0,hi.ReadOnly),H=h.paint.get("hillshade-emissive-strength"),F=g.colorModeForDrapableLayerRenderPass(H),Z=T&&g.terrain?g.terrain.stencilModeForRTTOverlap(M):E[M.overscaledZ];eD(g,M,L,h,O,Z,F)}}b.viewport.set([0,0,g.width,g.height]),g.resetStencilClippingMasks()},raster:function(g,a,h,y,b,T){if(g.renderPass!=="translucent"||h.paint.get("raster-opacity")===0)return;const E=g.transform.projection.name==="globe",P=h.paint.get("raster-elevation")!==0,M=P&&E;if(g.renderElevatedRasterBackface&&!M)return;const L=g.context,O=L.gl,H=a.getSource(),F=function(me,Ie,Se,ve){const ke=Ie.paint.get("raster-color"),Ke=me.type==="raster-array",$e=[],ct=Ie.paint.get("raster-resampling"),it=Ie.paint.get("raster-color-mix");let gt=Ie.paint.get("raster-color-range");const jt=[it[0],it[1],it[2],0],et=it[3];let Oe=ct==="nearest"?ve.NEAREST:ve.LINEAR;if(Ke&&($e.push("RASTER_ARRAY"),ke||$e.push("RASTER_COLOR"),ct==="linear"&&$e.push("RASTER_ARRAY_LINEAR"),Oe=ve.NEAREST,!gt&&me.rasterLayers)){const yt=me.rasterLayers.find(({id:nt})=>nt===Ie.sourceLayer);yt&&yt.fields&&yt.fields.range&&(gt=yt.fields.range)}if(gt=gt||[0,1],ke){$e.push("RASTER_COLOR"),Se.activeTexture.set(ve.TEXTURE2),Ie.updateColorRamp(gt);let yt=Ie.colorRampTexture;yt||(yt=Ie.colorRampTexture=new r.T(Se,Ie.colorRamp,ve.RGBA8)),yt.bind(ve.LINEAR,ve.CLAMP_TO_EDGE)}return{mix:jt,range:gt,offset:et,defines:$e,resampling:Oe}}(H,h,L,O);if(H instanceof r.aT&&!y.length&&!E)return;const Z=h.paint.get("raster-emissive-strength"),Y=g.colorModeForDrapableLayerRenderPass(Z),J=g.terrain&&g.terrain.renderingToTexture,se=!g.options.moving,ne=h.paint.get("raster-resampling")==="nearest"?O.NEAREST:O.LINEAR;if(H instanceof r.aT&&!y.length&&(H.onNorthPole||H.onSouthPole)){const me=P?g.stencilModeFor3D():Yi.disabled;return void Y1(!!H.onNorthPole,null,g,a,h,Z,F,$i.disabled,me)}if(!y.length)return;const[ae,fe]=H instanceof r.aT||J?[{},y]:g.stencilConfigForOverlap(y),ue=fe[fe.length-1].overscaledZ;M&&F.defines.push("PROJECTION_GLOBE_VIEW"),P&&F.defines.push("RENDER_CUTOFF");const Ce=(me,Ie,Se)=>{for(const ve of me){const ke=ve.toUnwrapped(),Ke=a.getTile(ve);if(J&&(!Ke||!Ke.hasData()))continue;L.activeTexture.set(O.TEXTURE0);const $e=mD(Ke,H,h,F);if(!$e||!$e.texture)continue;const{texture:ct,mix:it,offset:gt,tileSize:jt,buffer:et}=$e;let Oe,yt;J?(Oe=hi.disabled,yt=ve.projMatrix):P?(Oe=new hi(O.LEQUAL,hi.ReadWrite,g.depthRangeFor3D),yt=E?Float32Array.from(g.transform.expandedFarZProjMatrix):g.transform.calculateProjMatrix(ke,se)):(Oe=g.depthModeForSublayer(ve.overscaledZ-ue,h.paint.get("raster-opacity")===1?hi.ReadWrite:hi.ReadOnly,O.LESS),yt=g.transform.calculateProjMatrix(ke,se));const nt=g.terrain&&J?g.terrain.stencilModeForRTTOverlap(ve):ae[ve.overscaledZ],wt=T?0:h.paint.get("raster-fade-duration");Ke.registerFadeDuration(wt);const Bt=a.findLoadedParent(ve,0),oi=Lv(Ke,Bt,a,g.transform,wt);let Mt,Lt;!oi.isFading&&Ke.refreshedUponExpiration&&(Ke.refreshedUponExpiration=!1),g.terrain&&g.terrain.prepareDrawTile(),L.activeTexture.set(O.TEXTURE0),ct.bind(ne,O.CLAMP_TO_EDGE),L.activeTexture.set(O.TEXTURE1),Bt?(Bt.texture&&Bt.texture.bind(ne,O.CLAMP_TO_EDGE),Mt=Math.pow(2,Bt.tileID.overscaledZ-Ke.tileID.overscaledZ
3704),Lt=[Ke.tileID.canonical.x*Mt%1,Ke.tileID.canonical.y*Mt%1]):ct.bind(ne,O.CLAMP_TO_EDGE),"useMipmap"in ct&&L.extTextureFilterAnisotropic&&g.transform.pitch>20&&O.texParameterf(O.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const li=g.transform;let ti;const Yt=P?p2(li):[0,0,0,0];let ii,ji,Sn,zn,vr,qi=0;if(M&&H instanceof r.aT&&H.coordinates.length>3)ii=Float32Array.from(r.bj(r.dI(new r.cC(0,0,0)))),ji=Float32Array.from(li.globeMatrix),Sn=Float32Array.from(r.dE(li)),zn=[r.aF(li.center.lng),r.aJ(li.center.lat)],ti=H.elevatedGlobePerspectiveTransform,vr=H.elevatedGlobeGridMatrix||new Float32Array(9);else if(M){const Ln=r.dF(ve.canonical);qi=r.dG(Ln.getCenter().lat),ii=Float32Array.from(r.bj(r.dI(ve.canonical))),ji=Float32Array.from(li.globeMatrix),Sn=Float32Array.from(r.dE(li)),zn=[r.aF(li.center.lng),r.aJ(li.center.lat)],ti=[0,0],vr=Float32Array.from(r.dH(ve.canonical,Ln,qi,li.worldSize/li._pixelsPerMercatorPixel))}else ti=H instanceof r.aT?H.perspectiveTransform:[0,0],ii=new Float32Array(16),ji=new Float32Array(9),Sn=new Float32Array(16),zn=[0,0],vr=new Float32Array(9);const Dn=xy(yt,ii,ji,Sn,vr,Lt||[0,0],r.aj(g.transform.zoom),zn,Yt,Mt||1,oi,h,ti,P?h.paint.get("raster-elevation"):0,2,it,gt,F.range,jt,et,Z),dn=g.isTileAffectedByFog(ve),hr=g.getOrCreateProgram("raster",{defines:F.defines,overrideFog:dn});if(g.uploadCommonUniforms(L,hr,ke),H instanceof r.aT){const Ln=H.elevatedGlobeVertexBuffer,Ir=H.elevatedGlobeIndexBuffer;if(J||!E)H.boundsBuffer&&H.boundsSegments&&hr.draw(g,O.TRIANGLES,Oe,Yi.disabled,Y,$i.disabled,Dn,h.id,H.boundsBuffer,g.quadTriangleIndexBuffer,H.boundsSegments);else if(Ln&&Ir){const Wn=li.zoom<=r.cZ?H.elevatedGlobeSegments:H.getSegmentsForLongitude(li.center.lng);Wn&&hr.draw(g,O.TRIANGLES,Oe,Yi.disabled,Y,Ie,Dn,h.id,Ln,Ir,Wn)}}else if(M){Oe=new hi(O.LEQUAL,hi.ReadOnly,g.depthRangeFor3D);const Ln=g.globeSharedBuffers;if(Ln){const[Ir,Wn,hn]=Ln.getGridBuffers(qi,!1);hr.draw(g,O.TRIANGLES,Oe,Se||nt,g.colorModeForRenderPass(),Ie,Dn,h.id,Ir,Wn,hn)}}else{const{tileBoundsBuffer:Ln,tileBoundsIndexBuffer:Ir,tileBoundsSegments:Wn}=g.getTileBoundsBuffers(Ke);hr.draw(g,O.TRIANGLES,Oe,nt,Y,$i.disabled,Dn,h.id,Ln,Ir,Wn)}}if(!(H instanceof r.aT)&&M)for(const ve of me){const ke=ve.canonical.y===(1<<ve.canonical.z)-1;ve.canonical.y===0&&Y1(!0,ve,g,a,h,Z,F,Ie,Se||Yi.disabled),ke&&Y1(!1,ve,g,a,h,Z,F,Ie===$i.frontCW?$i.backCW:$i.frontCW,Se||Yi.disabled)}};M?Ce(fe,g.renderElevatedRasterBackface?$i.backCW:$i.frontCW,g.stencilModeFor3D()):Ce(fe,$i.disabled,void 0),g.resetStencilClippingMasks()},"raster-particle":function(g,a,h,y,b,T){g.renderPass==="offscreen"&&function(E,P,M,L){if(!L.length)return;const O=E.context,H=O.gl,F=P.getSource();if(!(F instanceof uo))return;const Z=Math.ceil(Math.sqrt(M.paint.get("raster-particle-count")));let Y=M.particlePositionRGBAImage;if(!Y||Y.width!==Z){const fe=function(ue){const Ce=ue*ue,me=new Uint8Array(4*Ce),Ie=function(ve){return ve|=0,ve=Math.imul(2747636419^ve,2654435769),ve=Math.imul(ve^ve>>>16,2654435769),((ve=Math.imul(ve^ve>>>16,2654435769))>>>0)/4294967296},Se=1/1.1;for(let ve=0;ve<Ce;ve++){const ke=Se*(Ie(2*ve+0)+dp),Ke=Se*(Ie(2*ve+1)+dp),$e=255*ke%1,ct=255*Ke%1,it=$e,gt=Ke-ct/255,jt=ct;me[4*ve+0]=255*(ke-$e/255),me[4*ve+1]=255*it,me[4*ve+2]=255*gt,me[4*ve+3]=255*jt}return me}(Z);Y=M.particlePositionRGBAImage=new r.q({width:Z,height:Z},fe)}let J=M.particleFramebuffer;J?J.width!==Z&&(J.destroy(),J=M.particleFramebuffer=O.createFramebuffer(Z,Z,!0,null)):J=M.particleFramebuffer=O.createFramebuffer(Z,Z,!0,null);const se=[];for(const fe of L){const ue=P.getTile(fe);if(!(ue instanceof Zd))continue;const Ce=Q1(ue,F,M);if(!Ce)continue;const me=[ue.tileSize,ue.tileSize];let Ie=M.tileFramebuffer;Ie||(Ie=M.tileFramebuffer=O.createFramebuffer(me[0],me[1],!0,null));let Se=ue.rasterParticleState;Se||(Se=ue.rasterParticleState=new ml(O,fe,me,Y));const ve=Se.update(M.lastInvalidatedAt);Se.particleTextureDimension!==Z&&Se.updateParticleTexture(fe,Y);const ke=Se.targetColorTexture;Se.targetColorTexture=Se.backgroundColorTexture,Se.backgroundColorTexture=ke;const Ke=Se.particleTexture0;Se.particleTexture0=Se.particleTexture1,Se.particleTexture1=Ke,se.push([fe,Ce,Se,ve])}if(se.length===0)return;const ne=r.o.now(),ae=M.previousDrawTimestamp?.001*(ne-M.previousDrawTimestamp):.0167;if(M.previousDrawTimestamp=ne,M.hasColorMap()){O.activeTexture.set(H.TEXTURE0+2);let fe=M.colorRampTexture;fe||(fe=M.colorRampTexture=new r.T(O,M.colorRamp,H.RGBA8)),fe.bind(H.LINEAR,H.CLAMP_TO_EDGE)}O.bindFramebuffer.set(M.tileFramebuffer.framebuffer),function(fe,ue,Ce){const me=fe.context,Ie=me.gl,Se=ue.tileFramebuffer;me.activeTexture.set(Ie.TEXTURE0);const ve={u_texture:0,u_opacity:1.05*(Ke=ue.paint.get("raster-particle-fade-opacity-factor"))/(Ke+.05)},ke=fe.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var Ke;for(const $e of Ce){const[,,ct,it]=$e;Se.colorAttachment.set(ct.targetColorTexture.texture),me.viewport.set([0,0,Se.width,Se.height]),me.clear({color:r.ao.transparent}),it&&(ct.backgroundColorTexture.bind(Ie.NEAREST,Ie.CLAMP_TO_EDGE),ke.draw(fe,Ie.TRIANGLES,hi.disabled,Yi.disabled,mn.alphaBlended,$i.disabled,ve,ue.id,fe.viewportBuffer,fe.quadTriangleIndexBuffer,fe.viewportSegments))}}(E,M,se),function(fe,ue,Ce,me){const Ie=fe.context,Se=Ie.gl,ve=Ce.tileFramebuffer,ke=fe.transform.projection.name==="globe",Ke=Ce.paint.get("raster-particle-max-speed");for(const $e of me){const[ct,it,gt]=$e;Ie.activeTexture.set(Se.TEXTURE0+0),it.texture.bind(Se.LINEAR,Se.CLAMP_TO_EDGE),ve.colorAttachment.set(gt.targetColorTexture.texture);const jt=fe.getOrCreateProgram("rasterParticleDraw",{defines:it.defines,overrideFog:!1});Ie.activeTexture.set(Se.TEXTURE0+1);const et=it.scalarData?[]:[0,1,2,3].map(nt=>r.e8[nt](ct));et.push(ct);const Oe=ct.canonical.x,yt=ct.canonical.y;for(const nt of et){const wt=ue.getTile(ke?nt.wrapped():nt);if(!wt)continue;const Bt=wt.rasterParticleState;if(!Bt)continue;const oi=nt.canonical.x+(1<<nt.canonical.z)*(nt.wrap-ct.wrap),Mt=nt.canonical.y;Bt.particleTexture0.bind(Se.NEAREST,Se.CLAMP_TO_EDGE);const Lt=$1(1,Bt.particleTexture0.size[0],[oi-Oe,Mt-yt],0,it.texture.size,2,Ke,it.textureOffset,it.scale,it.offset);jt.draw(fe,Se.POINTS,hi.disabled,Yi.disabled,mn.alphaBlended,$i.disabled,Lt,Ce.id,Bt.particleIndexBuffer,void 0,Bt.particleSegment)}}}(E,P,M,se),O.bindFramebuffer.set(M.particleFramebuffer.framebuffer),function(fe,ue,Ce,me){const Ie=fe.context,Se=Ie.gl,ve=ue.paint.get("raster-particle-max-speed"),ke=me*ue.paint.get("raster-particle-speed-factor")*.15,Ke=function(ct){return Math.pow(ct,6)}(.01+1*ue.paint.get("raster-particle-reset-rate-factor")),$e=ue.particleFramebuffer;Ie.viewport.set([0,0,$e.width,$e.height]);for(const ct of Ce){const[,it,gt]=ct;Ie.activeTexture.set(Se.TEXTURE0+0),it.texture.bind(Se.LINEAR,Se.CLAMP_TO_EDGE),Ie.activeTexture.set(Se.TEXTURE0+1);const jt=gt.particleTexture0;jt.bind(Se.NEAREST,Se.CLAMP_TO_EDGE);const et=qv(1,jt.size[0],0,it.texture.size,ve,ke,Ke,it.textureOffset,it.scale,it.offset);$e.colorAttachment.set(gt.particleTexture1.texture),Ie.clear({color:r.ao.transparent}),fe.getOrCreateProgram("rasterParticleUpdate",{defines:it.defines}).draw(fe,Se.TRIANGLES,hi.disabled,Yi.disabled,mn.unblended,$i.disabled,et,ue.id,fe.viewportBuffer,fe.quadTriangleIndexBuffer,fe.viewportSegments)}}(E,M,se,ae)}(g,a,h,y),g.renderPass==="translucent"&&(function(E,P,M,L,O){const H=E.context,F=H.gl,Z=P.getSource().tileSize,Y=5*(1-r.ah(r.cK,r.cK+1,E.transform.zoom))*Z+M.paint.get("raster-particle-elevation"),J=!E.options.moving,
vendor: 10,421 bytes, line 3704
3704se=E.transform.projection.name==="globe";if(!L.length)return;const[ne,ae]=E.stencilConfigForOverlap(L),fe=[];se&&fe.push("PROJECTION_GLOBE_VIEW");const ue=E.stencilModeFor3D();for(const Ce of ae){const me=Ce.toUnwrapped(),Ie=P.getTile(Ce);if(!Ie.rasterParticleState)continue;const Se=Ie.rasterParticleState,ve=100;Ie.registerFadeDuration(ve);const ke=P.findLoadedParent(Ce,0),Ke=Lv(Ie,ke,P,E.transform,ve);let $e,ct;E.terrain&&E.terrain.prepareDrawTile(),H.activeTexture.set(F.TEXTURE0),Se.targetColorTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),H.activeTexture.set(F.TEXTURE1),ke&&ke.rasterParticleState?(ke.rasterParticleState.targetColorTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE),$e=Math.pow(2,ke.tileID.overscaledZ-Ie.tileID.overscaledZ),ct=[Ie.tileID.canonical.x*$e%1,Ie.tileID.canonical.y*$e%1]):Se.targetColorTexture.bind(F.LINEAR,F.CLAMP_TO_EDGE);const it=se?Float32Array.from(E.transform.expandedFarZProjMatrix):E.transform.calculateProjMatrix(me,J),gt=E.transform,jt=Na(gt),et=r.dF(Ce.canonical),Oe=r.dG(et.getCenter().lat);let yt,nt,wt,Bt,oi;se?(yt=Float32Array.from(r.bj(r.dI(Ce.canonical))),nt=Float32Array.from(gt.globeMatrix),wt=Float32Array.from(r.dE(gt)),Bt=[r.aF(gt.center.lng),r.aJ(gt.center.lat)],oi=Float32Array.from(r.dH(Ce.canonical,et,Oe,gt.worldSize/gt._pixelsPerMercatorPixel))):(yt=new Float32Array(16),nt=new Float32Array(9),wt=new Float32Array(16),Bt=[0,0],oi=new Float32Array(9));const Mt=Jd(it,yt,nt,wt,oi,ct||[0,0],r.aj(E.transform.zoom),Bt,jt,$e||1,Ke,Y),Lt=E.isTileAffectedByFog(Ce),li=E.getOrCreateProgram("rasterParticle",{defines:fe,overrideFog:Lt});if(E.uploadCommonUniforms(H,li,me),se){const ti=new hi(F.LEQUAL,hi.ReadOnly,E.depthRangeFor3D),Yt=0,ii=E.globeSharedBuffers;if(ii){const[ji,Sn,zn]=ii.getGridBuffers(Oe,Yt!==0);li.draw(E,F.TRIANGLES,ti,ue,mn.alphaBlended,E.renderElevatedRasterBackface?$i.frontCCW:$i.backCCW,Mt,M.id,ji,Sn,zn)}}else{const ti=E.depthModeForSublayer(0,hi.ReadOnly),Yt=ne[Ce.overscaledZ],{tileBoundsBuffer:ii,tileBoundsIndexBuffer:ji,tileBoundsSegments:Sn}=E.getTileBoundsBuffers(Ie);li.draw(E,F.TRIANGLES,ti,Yt,mn.alphaBlended,$i.disabled,Mt,M.id,ii,ji,Sn)}}E.resetStencilClippingMasks()}(g,a,h,y),g.style.map.triggerRepaint())},background:function(g,a,h,y){const b=h.paint.get("background-color"),T=h.paint.get("background-color-use-theme").constantOr("default")==="none",E=h.paint.get("background-opacity"),P=h.paint.get("background-emissive-strength"),M=h.paint.get("background-pitch-alignment")==="viewport";if(E===0)return;const L=g.context,O=L.gl,H=g.transform,F=H.tileSize,Z=h.paint.get("background-pattern");let Y;if(Z!==void 0&&(Z===null||(Y=g.imageManager.getPattern(r.I.from(Z.toString()),h.scope,g.style.getLut(h.scope)),!Y)))return;const J=!Z&&b.a===1&&E===1&&g.opaquePassEnabledForLayer()?"opaque":"translucent";if(g.renderPass!==J)return;const se=Yi.disabled,ne=g.depthModeForSublayer(0,J==="opaque"?hi.ReadWrite:hi.ReadOnly),ae=g.colorModeForDrapableLayerRenderPass(P),fe=Z?"backgroundPattern":"background";let ue,Ce=y;if(Ce||(ue=g.getBackgroundTiles(),Ce=Object.values(ue).map(me=>me.tileID)),Z&&(L.activeTexture.set(O.TEXTURE0),g.imageManager.bind(g.context,h.scope)),M){const me=g.getOrCreateProgram(fe,{overrideFog:!1,overrideRtt:!0}),Ie=new Float32Array(r.bz([])),Se=new r.aP(0,0,0,0,0),ve=Z?Gv(Ie,P,E,g,0,h.scope,Y,M,{tileID:Se,tileSize:F}):Hv(Ie,P,E,b.toPremultipliedRenderColor(T?null:h.lut));me.draw(g,O.TRIANGLES,ne,se,ae,$i.disabled,ve,h.id,g.viewportBuffer,g.quadTriangleIndexBuffer,g.viewportSegments)}else for(const me of Ce){const Ie=g.isTileAffectedByFog(me),Se=g.getOrCreateProgram(fe,{overrideFog:Ie}),ve=me.toUnwrapped(),ke=y?me.projMatrix:g.transform.calculateProjMatrix(ve);g.prepareDrawTile();const Ke=a?a.getTile(me):ue?ue[me.key]:new fu(me,F,H.zoom,g),$e=Z?Gv(ke,P,E,g,0,h.scope,Y,M,{tileID:me,tileSize:F}):Hv(ke,P,E,b.toPremultipliedRenderColor(T?null:h.lut));g.uploadCommonUniforms(L,Se,ve);const{tileBoundsBuffer:ct,tileBoundsIndexBuffer:it,tileBoundsSegments:gt}=g.getTileBoundsBuffers(Ke);Se.draw(g,O.TRIANGLES,ne,se,ae,$i.disabled,$e,h.id,ct,it,gt)}},sky:function(g,a,h){const y=g._atmosphere?r.aj(g.transform.zoom):1,b=h.paint.get("sky-opacity")*y;if(b===0)return;const T=g.context,E=h.paint.get("sky-type"),P=new hi(T.gl.LEQUAL,hi.ReadOnly,[0,1]),M=g.frameCounter/1e3%1;E==="atmosphere"?g.renderPass==="offscreen"?h.needsSkyboxCapture(g)&&(function(L,O,H,F){const Z=L.context,Y=Z.gl;let J=O.skyboxFbo;if(!J){J=O.skyboxFbo=Z.createFramebuffer(32,32,!0,null),O.skyboxGeometry=new nw(Z),O.skyboxTexture=Z.gl.createTexture(),Y.bindTexture(Y.TEXTURE_CUBE_MAP,O.skyboxTexture),Y.texParameteri(Y.TEXTURE_CUBE_MAP,Y.TEXTURE_WRAP_S,Y.CLAMP_TO_EDGE),Y.texParameteri(Y.TEXTURE_CUBE_MAP,Y.TEXTURE_WRAP_T,Y.CLAMP_TO_EDGE),Y.texParameteri(Y.TEXTURE_CUBE_MAP,Y.TEXTURE_MIN_FILTER,Y.LINEAR),Y.texParameteri(Y.TEXTURE_CUBE_MAP,Y.TEXTURE_MAG_FILTER,Y.LINEAR);for(let fe=0;fe<6;++fe)Y.texImage2D(Y.TEXTURE_CUBE_MAP_POSITIVE_X+fe,0,Y.RGBA,32,32,0,Y.RGBA,Y.UNSIGNED_BYTE,null)}Z.bindFramebuffer.set(J.framebuffer),Z.viewport.set([0,0,32,32]);const se=O.getCenter(L,!0),ne=L.getOrCreateProgram("skyboxCapture"),ae=new Float64Array(16);r.bz(ae),r.em(ae,ae,.5*-Math.PI),wc(L,O,ne,ae,se,0),r.bz(ae),r.em(ae,ae,.5*Math.PI),wc(L,O,ne,ae,se,1),r.bz(ae),r.cT(ae,ae,.5*-Math.PI),wc(L,O,ne,ae,se,2),r.bz(ae),r.cT(ae,ae,.5*Math.PI),wc(L,O,ne,ae,se,3),r.bz(ae),wc(L,O,ne,ae,se,4),r.bz(ae),r.em(ae,ae,Math.PI),wc(L,O,ne,ae,se,5),Z.viewport.set([0,0,L.width,L.height])}(g,h),h.markSkyboxValid(g)):g.renderPass==="sky"&&function(L,O,H,F,Z){const Y=L.context,J=Y.gl,se=L.transform,ne=L.getOrCreateProgram("skybox");Y.activeTexture.set(J.TEXTURE0),J.bindTexture(J.TEXTURE_CUBE_MAP,O.skyboxTexture);const ae=((fe,ue,Ce,me,Ie)=>({u_matrix:fe,u_sun_direction:ue,u_cubemap:0,u_opacity:me,u_temporal_offset:Ie}))(se.skyboxMatrix,O.getCenter(L,!1),0,F,Z);L.uploadCommonUniforms(Y,ne),ne.draw(L,J.TRIANGLES,H,Yi.disabled,L.colorModeForRenderPass(),$i.backCW,ae,"skybox",O.skyboxGeometry.vertexBuffer,O.skyboxGeometry.indexBuffer,O.skyboxGeometry.segment)}(g,h,P,b,M):E==="gradient"&&g.renderPass==="sky"&&function(L,O,H,F,Z){const Y=L.context,J=Y.gl,se=L.transform,ne=L.getOrCreateProgram("skyboxGradient");O.skyboxGeometry||(O.skyboxGeometry=new nw(Y)),Y.activeTexture.set(J.TEXTURE0);let ae=O.colorRampTexture;ae||(ae=O.colorRampTexture=new r.T(Y,O.colorRamp,J.RGBA8)),ae.bind(J.LINEAR,J.CLAMP_TO_EDGE);const fe=((ue,Ce,me,Ie,Se)=>({u_matrix:ue,u_color_ramp:0,u_center_direction:Ce,u_radius:r.an(me),u_opacity:Ie,u_temporal_offset:Se}))(se.skyboxMatrix,O.getCenter(L,!1),O.paint.get("sky-gradient-radius"),F,Z);L.uploadCommonUniforms(Y,ne),ne.draw(L,J.TRIANGLES,H,Yi.disabled,L.colorModeForRenderPass(),$i.backCW,fe,"skyboxGradient",O.skyboxGeometry.vertexBuffer,O.skyboxGeometry.indexBuffer,O.skyboxGeometry.segment)}(g,h,P,b,M)},custom:function(g,a,h,y){const b=g.context,T=h.implementation;if(!g.transform.projection.unsupportedLayers||!g.transform.projection.unsupportedLayers.includes("custom")||g.terrain&&(g.terrain.renderingToTexture||g.renderPass==="offscreen")&&h.isDraped(a)){if(g.renderPass==="offscreen"){const E=T.prerender;if(E){if(g.setCustomLayerDefaults(),b.setColorMode(g.colorModeForRenderPass()),g.transform.projection.name==="globe"){const P=g.transform.pointMerc;E.call(T,b.gl,g.transform.customLayerMatrix(),g.transform.getProjection(),g.transform.globeToMercatorMatrix(),r.aj(g.transform.zoom),[P.x,P.y],g.transform.pixelsPerMeterRatio)}else E.call(T,b.gl,g.transform.customLayerMatrix());b.setDirty(),g.setBaseState()}}else if(g.renderPass==="translucent"){if(g.terrain&&g.terrain.renderingToTexture){const P=T.renderToTile;if(P){const M=y[0].canonical,L={x:M.x+y[0].wrap*(T.wrapTileId?0:1<<M.z),y:M.y,z:M.z};b.setDepthMode(hi.disabled),b.setStencilMode(Yi.disabled),b.setColorMode(g.colorModeForRenderPass()),g.setCustomLayerDefaults(),P.call(T,b.gl,L),b.setDirty(),g.setBaseState()}return}g.setCustomLayerDefaults(),b.setColorMode(g.colorModeForRenderPass()),b.setStencilMode(Yi.disabled);const E=T.renderingMode==="3d"?new hi(g.context.gl.LEQUAL,hi.ReadWrite,g.depthRangeFor3D):g.depthModeForSublayer(0,hi.ReadOnly);if(b.setDepthMode(E),g.transform.projection.name==="globe"){const P=g.transform.pointMerc;T.render(b.gl,g.transform.customLayerMatrix(),g.transform.getProjection(),g.transform.globeToMercatorMatrix(),r.aj(g.transform.zoom),[P.x,P.y],g.transform.pixelsPerMeterRatio)}else T.render(b.gl,g.transform.customLayerMatrix());b.setDirty(),g.setBaseState(),b.bindFramebuffer.set(null)}}else r.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(g,a,h,y){if(g.renderPass==="opaque")return;const b=h.paint.get("model-opacity").constantOr(1),T=h.paint.get("model-elevation-reference"),E=T==="ground",P=T==="ground";if(b===0)return;const M=h.paint.get("model-cast-shadows");if(g.renderPass==="shadow"&&(!M||g.terrain&&b<.65&&h._transitionablePaint._values["model-opacity"].value.expression instanceof r.ad))return;const L=g.shadowRenderer,O=h.paint.get("model-receive-shadows");L&&(L.useNormalOffset=!0,O||(L.enabled=!1));const H=()=>{L&&(L.useNormalOffset=!0,O||(L.enabled=!0))},F=a.getSource();if(g.renderPass==="light-beam"&&F.type!=="batched-model")return;if(F.type==="vector"||F.type==="geojson")return function(ue,Ce,me,Ie,Se){const ve=ue.transform,ke=ve.projection.name==="globe",Ke=ve.getFreeCameraOptions().position;if(!ue.modelManager)return;const $e=ue.modelManager;me.modelManager=$e;const ct=ue.shadowRenderer;if(!me._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const it=me._unevaluatedLayout._values["model-id"],gt=Object.assign({},me.layout.get("model-id").parameters),jt=ue.style.order.indexOf(me.fqid);for(const et of Ie){const Oe=Ce.getTile(et).getBucket(me);if(!Oe||Oe.projection.name!==ve.projection.name)continue;const yt=Oe.getModelUris();if(yt&&!Oe.modelsRequested&&($e.addModelsFromBucket(yt,Se),Oe.modelsRequested=!0),ke)gt.zoom=et.overscaledZ;else{const ti=sw(et,ve);gt.zoom=ti}const nt=it.possiblyEvaluate(gt);if(_2(ue,Oe,et),zl.shadowUniformsInitialized=!1,zl.useSingleShadowCascade=!!ct&&ct.getMaxCascadeForTile(et.toUnwrapped())===0,ue.renderPass==="shadow"&&ct){if(ue.currentShadowCascade===1&&Oe.isInsideFirstShadowMapFrustum)continue;const ti=ve.calculatePosMatrix(et.toUnwrapped(),ve.worldSize);if(zl.tileMatrix.set(ti),zl.shadowTileMatrix=Float32Array.from(ct.calculateShadowPassMatrixFromMatr
3704ix(ti)),zl.aabb.min=[0,0,0],zl.aabb.max[0]=zl.aabb.max[1]=r.al,zl.aabb.max[2]=0,nx(Oe,zl,ue,me.scope))continue}const wt=1<<et.canonical.z,Bt=[((Ke.x-et.wrap)*wt-et.canonical.x)*r.al,(Ke.y*wt-et.canonical.y)*r.al,Ke.z*wt*r.al];ue.conflationActive&&Object.keys(Oe.instancesPerModel).length>0&&ue.style.isLayerClipped(me,Ce.getSource())&&Oe.updateReplacement(et,ue.replacementSource,jt,Se)&&(Oe.uploaded=!1,Oe.upload(ue.context));let oi=0;const Mt=new Array,Lt=new Array,li=new Array;for(let ti in Oe.instancesPerModel){const Yt=Oe.instancesPerModel[ti];Yt.features.length>0&&!ke&&(ti=nt.evaluate(Yt.features[0].feature,{}));const ii=$e.getModel(ti,Se);if(ii||$e.hasURLBeenRequested(ti)||Oe.modelUris.includes(ti)||(Oe.modelUris.push(ti),Oe.modelsRequested=!1),ii&&ii.uploaded)if(ke){const ji=r.c4([],[Ke.x,Ke.y,Ke.z],ue.transform.worldSize);r.ev(ji,ji);for(let Sn=0;Sn<Yt.instancedDataArray.length;++Sn){const zn=[0,0,0],vr=[1,1,1],qi=r.ew(),Dn=Yt.tileCoordinatesForInstance(Sn),dn=Yt.transformForInstance(Sn);r.ex(vr,dn),r.ey(qi,dn),r.ez(zn,qi);const hr=Yt.translationForInstance(Sn),Ln=new r.aS(0,0);r.eA(Oe.canonical,Ln,Dn.x,Dn.y);const Ir=r.bB();r.eB(Ir,ii,ue.transform,Ln,zn,vr,hr,!0,!1,!1);const Wn=Yt.colorForInstance(Sn),hn=r.bz([]),nr=r.ee(Ln.lat,ue.transform.zoom),gn=r.bp([],[1,1,1/nr]);r.bq(hn,hn,ji),li.push({zScaleMatrix:gn,negCameraPosMatrix:hn});for(const Or of ii.nodes)ix(ue,Or,Ir,ue.transform.expandedFarZProjMatrix,oi,Mt,Lt,ii.materialOverrides,Wn);++oi}}else for(const ji of ii.nodes)ow(ue,me,ji,Yt,Bt,et,zl)}if(ke)if(ue.renderPass==="shadow"){for(const ti of Lt)Vf(ti.mesh,ti.nodeModelMatrix,ue,me);for(const ti of Mt)Vf(ti.mesh,ti.nodeModelMatrix,ue,me)}else y2(ue,me,1,Mt,Lt,li)}}(g,a,h,y,tx(F,h,g.style._importedAsBasemap)),void H();if(!F.loaded())return;if(F.type==="batched-model")return function(ue,Ce,me,Ie){me.resetLayerRenderingStats(ue);const Se=ue.context,ve=ue.transform,ke=ue.style.fog,Ke=ue.shadowRenderer;if(ve.projection.name!=="mercator")return void r.w(`Drawing 3D landmark models for ${ve.projection.name} projection is not yet implemented`);const $e=ue.transform.getFreeCameraOptions().position,ct=r.c4([],[$e.x,$e.y,$e.z],ue.transform.worldSize),it=r.ev([],ct),gt=r.bz([]),jt=r.ee(ve.center.lat,ve.zoom),et=r.bp([],[1,1,1/jt]);r.bq(gt,gt,it);const Oe=me.paint.get("model-opacity").constantOr(1),yt=new hi(Se.gl.LEQUAL,hi.ReadWrite,ue.depthRangeFor3D),nt=new hi(Se.gl.LEQUAL,hi.ReadOnly,ue.depthRangeFor3D),wt=new r.d8([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Bt=ue.renderPass==="shadow",oi=Bt&&Ke?Ke.getCurrentCascadeFrustum():ve.getFrustum(ve.scaleZoom(ve.worldSize)),Mt=me.paint.get("model-front-cutoff"),Lt=Mt[2]<1,li=Xu(ue,me.paint.get("model-cutoff-fade-range")),ti=me.getLayerRenderingStats();(function(Yt,ii,ji,Sn){const zn=Yt.terrain?Yt.terrain.exaggeration():0,vr=Yt.transform.zoom;for(const qi of Sn){const Dn=ii.getTile(qi).getBucket(ji);Dn&&(Dn.setFilter(ji.filter),Yt.conflationActive&&Dn.updateReplacement(qi,Yt.replacementSource),Dn.evaluateTransform(Yt,ji),Yt.terrain&&zn>0&&Dn.elevationUpdate(Yt.terrain,zn,qi,ji.source),Dn.needsReEvaluation(Yt,vr,ji)&&Dn.evaluate(ji))}})(ue,Ce,me,Ie),function(){let Yt,ii,ji;Lt?(Yt=Ie.length-1,ii=-1,ji=-1):(Yt=0,ii=Ie.length,ji=1);const Sn=new Float64Array(16),zn=r.cz(),vr=new r.P(0,0);for(let qi=Yt;qi!==ii;qi+=ji){const Dn=Ie[qi],dn=Ce.getTile(Dn).getBucket(me);if(!dn||!dn.uploaded)continue;let hr=!1;Ke&&(hr=Ke.getMaxCascadeForTile(Dn.toUnwrapped())===0);const Ln=ve.calculatePosMatrix(Dn.toUnwrapped(),ve.worldSize),Ir=dn.modelTraits;!Bt&&Lt&&(r.bk(Sn,Ln),r.af(zn,ct,Sn),vr.x=zn[0],vr.y=zn[1]);const Wn=[];dn.setFilter(me.filter);for(const hn of dn.getNodesInfo()){if(hn.hiddenByReplacement||!hn.node.meshes)continue;const nr=hn.node;let gn=0;ue.terrain&&nr.elevation&&(gn=nr.elevation*ue.terrain.exaggeration());const Or=(()=>{const sa=hn.aabb;return wt.min=[...sa.min],wt.max=[...sa.max],wt.min[2]+=gn,wt.max[2]+=gn,r.af(wt.min,wt.min,Ln),r.af(wt.max,wt.max,Ln),wt})(),or=hn.evaluatedScale;if(or[0]<=1&&or[1]<=1&&or[2]<=1&&Or.intersects(oi)===0)continue;if(!Bt&&Lt){const sa=.16666666666666666;hn.cameraCollisionOpacity=ct[0]>Or.min[0]&&ct[0]<Or.max[0]&&ct[1]>Or.min[1]&&ct[1]<Or.max[1]&&ct[2]*jt<Or.max[2]&&nr.footprint&&r.b$(vr,nr.footprint)?Math.max(hn.cameraCollisionOpacity-sa,0):Math.min(1,hn.cameraCollisionOpacity+sa)}const Ki=[...Ln],Bn=1/r.d6(Dn.canonical),ts=nr.anchor?nr.anchor[0]:0,Ps=nr.anchor?nr.anchor[1]:0;r.bq(Ki,Ki,[ts*(or[0]-1)+hn.evaluatedTranslation[0]*Bn,Ps*(or[1]-1)+hn.evaluatedTranslation[1]*Bn,gn+hn.evaluatedTranslation[2]]),r.cp(or,r.eD)||r.cR(Ki,Ki,or);const cs=r.aB([],Ki,nr.globalMatrix),ws=r.aB([],ve.expandedFarZProjMatrix,cs),el=r.aB([],ve.expandedFarZProjMatrix,Ki),Ma=r.aC([],[ts,Ps,gn,1],ws)[2];nr.hidden=!1;let Ho=Oe;Bt||(Lt&&(Ho*=hn.cameraCollisionOpacity,Ho*=fp(Ki,ve,hn.aabb,Mt)),Ho*=Ty(li,Ma)),Ho!==0?Wn.push({nodeInfo:hn,depth:Ma,opacity:Ho,wvpForNode:ws,wvpForTile:el,nodeModelMatrix:cs,tileModelMatrix:Ki}):nr.hidden=!0}Bt||Wn.sort((hn,nr)=>!Lt||hn.opacity===1&&nr.opacity===1?hn.depth<nr.depth?-1:1:hn.opacity===1?-1:nr.opacity===1?1:hn.depth>nr.depth?-1:1);for(const hn of Wn){const nr=hn.nodeInfo,gn=nr.node;let Or=r.aB([],et,hn.tileModelMatrix);r.aB(Or,gt,Or);const or=r.bk([],Or);r.ef(or,or),r.cR(or,or,v2),Or=r.aB(Or,Or,gn.globalMatrix);const Ki=ue.renderPass==="light-beam",Bn=me.paint.get("model-color-use-theme").
3704constantOr("default")==="none",ts=Ir&r.eH.HasMapboxMeshFeatures,Ps=ts?0:nr.evaluatedRMEA[0][2];for(let cs=0;cs<gn.meshes.length;++cs){const ws=gn.meshes[cs],el=cs===gn.lightMeshIndex;let Ma=hn.wvpForNode;if(el){if(!Ki&&!ue.terrain&&ue.shadowRenderer){ue.currentLayer<ue.firstLightBeamLayer&&(ue.firstLightBeamLayer=ue.currentLayer);continue}Ma=hn.wvpForTile}else if(Ki)continue;const Ho={defines:[]},sa=[];if(!Bt&&Ke&&(Ke.useNormalOffset=!!ws.normalBuffer),Bf(Ho.defines,sa,ws,ue,Bn?null:me.lut),ts||Ho.defines.push("DIFFUSE_SHADED"),hr&&Ho.defines.push("SHADOWS_SINGLE_CASCADE"),ti&&(Bt?ti.numRenderedVerticesInShadowPass+=ws.vertexArray.length:ti.numRenderedVerticesInTransparentPass+=ws.vertexArray.length),Bt){Vf(ws,hn.nodeModelMatrix,ue,me);continue}let Ol=null;if(ke){const Ns=rw(hn.nodeModelMatrix,ue.transform);if(Ol=new Float32Array(Ns),ve.projection.name!=="globe"){const Ar=ws.aabb.min,Rs=ws.aabb.max,[xo,gs]=ke.getOpacityForBounds(Ns,Ar[0],Ar[1],Rs[0],Rs[1]);Ho.overrideFog=xo>=Ve||gs>=Ve}}const Go=ws.material;let Fl;Go.occlusionTexture&&Go.occlusionTexture.offsetScale&&(Fl=Go.occlusionTexture.offsetScale,Ho.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Cc=ue.getOrCreateProgram("model",Ho);!Bt&&Ke&&Ke.setupShadowsFromMatrix(hn.tileModelMatrix,Cc,Ke.useNormalOffset),ue.uploadCommonUniforms(Se,Cc,null,Ol);const vo=Go.pbrMetallicRoughness;vo.metallicFactor=.9,vo.roughnessFactor=.5;const ms=Wv(new Float32Array(Ma),new Float32Array(Or),new Float32Array(or),new Float32Array(gn.globalMatrix),ue,hn.opacity,vo.baseColorFactor,Go.emissiveFactor,vo.metallicFactor,vo.roughnessFactor,Go,Ps,me,[0,0,0],Fl);!el&&(nr.hasTranslucentParts||hn.opacity<1)&&Cc.draw(ue,Se.gl.TRIANGLES,yt,Yi.disabled,mn.disabled,$i.backCCW,ms,me.id,ws.vertexBuffer,ws.indexBuffer,ws.segments,me.paint,ue.transform.zoom,void 0,sa),Cc.draw(ue,Se.gl.TRIANGLES,el?nt:yt,Yi.disabled,el||hn.opacity<1||nr.hasTranslucentParts?mn.alphaBlended:mn.unblended,$i.backCCW,ms,me.id,ws.vertexBuffer,ws.indexBuffer,ws.segments,me.paint,ue.transform.zoom,void 0,sa)}}}}()}(g,a,h,y),void H();if(F.type!=="model")return;const Z=F.getModels(),Y=[],J=g.transform.getFreeCameraOptions().position,se=r.c4([],[J.x,J.y,J.z],g.transform.worldSize);r.ev(se,se);const ne=[],ae=[];let fe=0;for(const ue of Z){const Ce=a.getFeatureState("",ue.id),me={type:"Unknown",id:ue.id,properties:ue.featureProperties},Ie=h.paint.get("model-rotation").evaluate(me,Ce),Se=h.paint.get("model-scale").evaluate(me,Ce),ve=h.paint.get("model-translation").evaluate(me,Ce);$f(h,ue.id,Ce,ue.featureProperties,ue.nodeOverrideNames,ue.nodeOverrides),yD(h,ue.id,Ce,ue.featureProperties,ue.materialOverrideNames,ue.materialOverrides),ue.nodeOverrides.size>0&&ue.computeBoundsAndApplyParent(),ue.computeModelMatrix(g,Ie,Se,ve,P,E,!1);const ke=r.bz([]),Ke=r.ee(ue.position.lat,g.transform.zoom),$e=r.bp([],[1,1,1/Ke]);r.bq(ke,ke,se),Y.push({zScaleMatrix:$e,negCameraPosMatrix:ke});for(const ct of ue.nodes)ix(g,ct,ue.matrix,g.transform.expandedFarZProjMatrix,fe,ne,ae,ue.materialOverrides);fe++}if(ne.sort((ue,Ce)=>Ce.depth-ue.depth),g.renderPass!=="shadow")y2(g,h,b,ne,ae,Y),H();else{for(const ue of ae)Vf(ue.mesh,ue.nodeModelMatrix,g,h);for(const ue of ne)Vf(ue.mesh,ue.nodeModelMatrix,g,h);H()}}},rx={line:function(g,a,h){if(g.hasElevatedBuckets=!1,g.hasNonElevatedBuckets=!1,g._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||g._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(a){const y=a.getVisibleCoordinates();for(const b of y){const T=a.getTile(b).getBucket(g);if(T&&(T.elevationType!=="none"?g.hasElevatedBuckets=!0:g.hasNonElevatedBuckets=!0,g.hasElevatedBuckets&&g.hasNonElevatedBuckets))break}}}else g.hasNonElevatedBuckets=!0},model:function(g,a,h){const y=a.getSource();if(!y.loaded())return;if(y.type==="vector"||y.type==="geojson"){const T=tx(y,g,h.style._importedAsBasemap);return void(h.modelManager&&h.modelManager.upload(h,T))}if(y.type==="batched-model"||y.type!=="model")return;const b=y.getModels();for(const T of b)T.upload(h.context)},raster:function(g,a,h){const y=a.getSource();if(!(y instanceof uo&&y.loaded()))return;
3704const b=g.sourceLayer||y.rasterLayerIds&&y.rasterLayerIds[0];if(!b)return;const T=g.paint.get("raster-array-band")||y.getInitialBand(b);if(T==null)return;const E=a.getIds().map(P=>a.getTileByID(P));for(const P of E)P.updateNeeded(g.id,T)&&y.prepareTile(P,b,g.id,T)},"raster-particle":function(g,a,h){const y=a.getSource();if(!(y instanceof uo&&y.loaded()))return;const b=g.sourceLayer||y.rasterLayerIds&&y.rasterLayerIds[0];if(!b)return;const T=g.paint.get("raster-particle-array-band")||y.getInitialBand(b);if(T==null)return;const E=a.getIds().map(P=>a.getTileByID(P));for(const P of E)P.updateNeeded(g.id,T)&&y.prepareTile(P,b,g.id,T)}},sx={fill:hp},Ll={fill:function(g,a,h,y){if(!h.layout||h.layout.get("fill-elevation-reference")==="none"||h.paint.get("fill-opacity").constantOr(1)===0)return;const b=g.context.gl,T=new hi(b.LEQUAL,hi.ReadOnly,g.depthRangeFor3D),E=new Yi({func:b.ALWAYS,mask:255},255,255,b.KEEP,b.KEEP,b.REPLACE),P=g.transform.getFreeCameraOptions().position,M=g.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const L of y){const O=a.getTile(L),H=O.getBucket(h);if(!H)continue;const F=H.elevatedStructures;if(!F||F.depthSegments.segments[0].primitiveLength===0)continue;const Z=d2(L.toUnwrapped(),P),Y=g.translatePosMatrix(L.projMatrix,O,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor")),J=Uv(Y,Z,0,1,0);M.draw(g,b.TRIANGLES,T,E,mn.disabled,$i.disabled,J,h.id,F.vertexBuffer,F.indexBuffer,F.depthSegments,h.paint,g.transform.zoom)}}};class sh{constructor(a,h,y,b,T,E){this.context=new Zv(a,h),this.transform=y,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=T,this._timeStamp=r.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const P=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const L of P)this._debugParams.enabledLayers[L]=!0;T.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),T.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),T.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),T.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),T.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),T.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const L of P)T.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],L);this.occlusionParams=new _D(T),this.setup(),this.numSublayers=gc.maxUnderzooming+gc.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new r.eO,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new cy(this),this._wireframeDebugCache=new b2,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const M=new r.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new r.T(this.context,M,a.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=b,this.worldview=E}updateTerrain(a,h){const y=!!a&&!!a.terrain&&this.transform.projection.supportsTerrain;if(!(y||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new _y(this,a));const b=this._terrain;this.transform.elevation=y?b:null,b.update(a,this.transform,h),this.transform.elevation&&!b.enabled&&(this.transform.elevation=null)}_updateFog(a){const h=a.fog;if(!h||this.transform.projection.name==="globe"||h.getOpacity(this.transform.pitch)<1||h.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[y,b]=h.getFovAdjustedRange(this.transform._fov);if(y>b)return void(this.transform.fogCullDistSq=null);const T=y+.78*(b-y);this.transform.fogCullDistSq=T*T}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(a){a&&!this._terrain&&(this._terrain=new _y(this,this.style)),this._forceTerrainMode=a}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(a,h){if(this.width=a*r.o.devicePixelRatio,this.height=h*r.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style.order)this.style._mergedLayers[y].resize()}setup(){const a=this.context,h=new r.bc;h.emplaceBack(0,0),h.emplaceBack(r.al,0),h.emplaceBack(0,r.al),h.emplaceBack(r.al,r.al),this.tileExtentBuffer=a.createVertexBuffer(h,r.be.members),this.tileExtentSegments=r.bf.simpleSegment(0,0,4,2);const y=new r.bc;y.emplaceBack(0,0),y.emplaceBack(r.al,0),y.emplaceBack(0,r.al),y.emplaceBack(r.al,r.al),this.debugBuffer=a.createVertexBuffer(y,r.be.members),this.debugSegments=r.bf.simpleSegment(0,0,4,5);const b=new r.bc;b.emplaceBack(-1,-1),b.emplaceBack(1,-1),b.emplaceBack(-1,1),b.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(b,r.be.members),this.viewportSegments=r.bf.simpleSegment(0,0,4,2);const T=new r.a$;T.emplaceBack(0,0,0,0),T.emplaceBack(r.al,0,r.al,0),T.emplaceBack(0,r.al,0,r.al),T.emplaceBack(r.al,r.al,r.al,r.al),this.mercatorBoundsBuffer=a.createVertexBuffer(T,r.bh.members),this.mercatorBoundsSegments=r.bf.simpleSegment(0,0,4,2);const E=new r.b0;E.emplaceBack(0,1,2),E.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(E);const P=new r.bd;for(const L of[0,1,3,2,0])P.emplaceBack(L);this.debugIndexBuffer=a.createIndexBuffer(P),this.emptyTexture=new r.T(a,new r.q({width:1,height:1},Uint8Array.of(0,0,0,0)),a.gl.RGBA8),this.identityMat=r.bB();const M=this.context.gl;this.stencilClearMode=new Yi({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const a=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,a.TRIANGLES,hi.disabled,this.stencilClearMode,mn.disabled,$i.disabled,up(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(a,h,y){if(!h||this.currentStencilSource===h.id||!a.isTileClipped()||!y||y.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let P=!1;for(const M of y)if(this._tileClippingMaskIDs[M.key]===void 0){P=!0;break}if(!P)return}this.currentStencilSource=h.id;const b=this.context,T=b.gl;this.nextStencilID+y.length>256&&this.clearStencil(),b.setColorMode(mn.disabled),b.setDepthMode(hi.disabled);const E=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const P of y){const M=h.getTile(P),L=this._tileClippingMaskIDs[P.key]=this.nextStencilID++,{tileBoundsBuffer:O,tileBoundsIndexBuffer:H,tileBoundsSegments:F}=this.getTileBoundsBuffers(M);E.draw(this,T.TRIANGLES,hi.disabled,new Yi({func:T.ALWAYS,mask:0},L,255,T.KEEP,T.KEEP,T.REPLACE),mn.disabled,$i.disabled,up(P.projMatrix),"$clipping",O,H,F)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const a=this.nextStencilID++,h=this.context.gl;return new Yi({func:h.NOTEQUAL,mask:255},a,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(a){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(a);const h=this.context.gl;return new Yi({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(a){const h=this.context.gl,y=a.sort((E,P)=>
3704P.overscaledZ-E.overscaledZ),b=y[y.length-1].overscaledZ,T=y[0].overscaledZ-b+1;if(T>1){this.currentStencilSource=void 0,this.nextStencilID+T>256&&this.clearStencil();const E={};for(let P=0;P<T;P++)E[P+b]=new Yi({func:h.GEQUAL,mask:255},P+this.nextStencilID,255,h.KEEP,h.KEEP,h.REPLACE);return this.nextStencilID+=T,[E,y]}return[{[b]:Yi.disabled},y]}colorModeForRenderPass(){const a=this.context.gl;return this._showOverdrawInspector?new mn([a.CONSTANT_COLOR,a.ONE,a.CONSTANT_COLOR,a.ONE],new r.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?mn.unblended:mn.alphaBlended}colorModeForDrapableLayerRenderPass(a){const h=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new mn([h.ONE,h.ONE_MINUS_SRC_ALPHA,h.CONSTANT_ALPHA,h.ONE_MINUS_SRC_ALPHA],new r.ao(0,0,0,a===void 0?0:a),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(a,h,y,b=!1){if(this.depthOcclusion)return new hi(this.context.gl.GREATER,hi.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!b)return hi.disabled;const T=1-((1+this.currentLayer)*this.numSublayers+a)*this.depthEpsilon;return new hi(y||this.context.gl.LEQUAL,h,[T,T])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const a=this.context.gl,h=Math.ceil(this.width),y=Math.ceil(this.height),b=this.context.bindFramebuffer.get(),T=a.getParameter(a.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===h&&this.depthFBO.height===y||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),h!==0&&y!==0&&(this.depthFBO=new Kv(this.context,h,y,!1,"texture"),this.depthTexture=new r.T(this.context,{width:h,height:y,data:null},a.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(b),a.bindTexture(a.TEXTURE_2D,T),this.depthFBO&&(a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),a.blitFramebuffer(0,0,h,y,0,0,h,y,a.DEPTH_BUFFER_BIT,a.NEAREST),a.bindFramebuffer(a.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((a,h)=>a+h/this._fpsHistory.length,0))}render(a,h){const y=r.o.now();this._dt=y-this._timeStamp,this._timeStamp=y,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=a.map.repaint,this.style=a,this.options=h;const b=this.style._mergedLayers,T=!(!this.terrain||!this.terrain.enabled),E=()=>this.style._getOrder(T).filter(et=>{const Oe=b[et];return!(Oe.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Oe.type]});let P=E(),M=!1,L=!1,O=null;for(const et of P){const Oe=b[et];Oe.type==="circle"?M=!0:Oe.type==="building"?O=Oe:Oe.type==="symbol"&&(Oe.hasOcclusionOpacityProperties?L=!0:M=!0)}let H=P.map(et=>b[et]);const F=this.style._mergedSourceCaches;this.imageManager=a.imageManager,this.modelManager=a.modelManager,this.symbolFadeChange=a.placement.symbolFadeChange(r.o.now()),this.imageManager.beginFrame();let Z=0,Y=!1;for(const et in F){const Oe=F[et];Oe.used&&(Oe.prepare(this.context),Oe.getSource().usedInConflation&&++Z)}let J=!1;for(const et of H)et.isHidden(this.transform.zoom)||(et.type==="clip"&&(J=!0),this.prepareLayer(et));const se={},ne={},ae={},fe={},ue={};for(const et in F){const Oe=F[et];se[et]=Oe.getVisibleCoordinates(),ne[et]=se[et].slice().reverse(),ae[et]=Oe.getVisibleCoordinates(!0).reverse(),fe[et]=Oe.getShadowCasterCoordinates(),ue[et]=Oe.sortCoordinatesByDistance(se[et])}const Ce=et=>{const Oe=this.style.getLayerSourceCache(et);return Oe&&Oe.used?Oe.getSource():null};if(Z||J||this._clippingActiveLastFrame){const et=[],Oe=[];let yt=0;for(const nt of H)this.isSourceForClippingOrConflation(nt,Ce(nt))&&(et.push(nt),Oe.push(yt)),yt++;if(et&&(J||et.length>1)||this._clippingActiveLastFrame){J=!1;const nt=[];for(let wt=0;wt<et.length;wt++){const Bt=et[wt],oi=Oe[wt],Mt=this.style.getLayerSourceCache(Bt);if(!Mt||!Mt.used||!Mt.getSource().usedInConflation&&Bt.type!=="clip"&&Bt.type!=="building")continue;let Lt=r.eP,li=r.bZ.None;const ti=[];let Yt=!0;if(Bt.type==="building")Lt=r.eR;else if(Bt.type==="clip"){Lt=oi;
vendor: 9,152 bytes, line 3704
3704for(const ii of Bt.layout.get("clip-layer-types"))li|=ii==="model"?r.bZ.Model:ii==="symbol"?r.bZ.Symbol:r.bZ.FillExtrusion;for(const ii of Bt.layout.get("clip-layer-scope"))ti.push(ii);Bt.isHidden(this.transform.zoom)?Yt=!1:J=!0}Yt&&nt.push({layer:Bt.fqid,cache:Mt,order:Lt,clipMask:li,clipScope:ti})}this.replacementSource.setSources(nt),Y=!0}}this._clippingActiveLastFrame=J,Y||this.replacementSource.clear(),this.conflationActive=Y,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let et=0;et<H.length;et++){const Oe=H[et],yt=Oe.cutoffRange();if(this.longestCutoffRange=Math.max(yt,this.longestCutoffRange),yt>0){const nt=Ce(Oe);nt&&(this.minCutoffZoom=Math.max(nt.minzoom,this.minCutoffZoom)),Oe.minzoom&&(this.minCutoffZoom=Math.max(Oe.minzoom,this.minCutoffZoom))}Oe.is3D(T)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=et),this._lastOcclusionLayer=et)}const me=this.style&&this.style.fog;me?(this._fogVisible=me.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=me.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(ae),this.opaquePassCutoff=0,P=E(),H=P.map(et=>b[et]));const Ie=this._shadowRenderer;if(Ie){Ie.updateShadowParameters(this.transform,this.style.directionalLight);for(const et in F)for(const Oe of se[et]){let yt={min:0,max:0};this.terrain&&(yt=this.terrain.getMinMaxForTile(Oe)||yt),Ie.addShadowReceiver(Oe.toUnwrapped(),yt.min,yt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new r.eQ(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new bs(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const Se=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ve=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(Se&&!this._snow&&(this._snow=new lw(this)),!Se&&this._snow&&(this._snow.destroy(),delete this._snow),ve&&!this._rain&&(this._rain=new qf(this)),!ve&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),O){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Ze);const et=this.style.getLayerSourceCache(O);this.buildingTileBorderManager.updateBorders(et,O)}if(!zi.has(this.context.gl))return;this.renderPass="offscreen";for(const et of H){const Oe=a.getLayerSourceCache(et);if(!et.hasOffscreenPass()||et.isHidden(this.transform.zoom))continue;const yt=Oe?ne[Oe.id]:void 0;(et.type==="custom"||et.type==="raster"||et.type==="raster-particle"||et.isSky()||yt&&yt.length)&&this.renderLayer(this,Oe,et,yt)}this.depthRangeFor3D=[0,1-(H.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,fe)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ke=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ke=(()=>{if(h.showOverdrawInspector)return r.ao.black;const et=this.style.fog;if(et&&this.transform.projection.supportsFog){const Oe=this.style.getLut(et.scope);if(!ke){const yt=et.properties.get("color-use-theme")==="none",nt=et.properties.get("color").toNonPremultipliedRenderColor(yt?null:Oe).toArray01();return new r.ao(...nt)}if(ke){const yt=et.properties.get("space-color-use-theme")==="none",nt=et.properties.get("space-color").toNonPremultipliedRenderColor(yt?null:Oe).toArray01();return new r.ao(...nt)}}return r.ao.transparent})();if(this.context.clear({color:Ke,depth:1}),this.clearStencil(),this._showOverdrawInspector=h.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ke&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=P.length-1;this.currentLayer>=0;this.currentLayer--){const et=H[this.currentLayer],Oe=a.getLayerSourceCache(et);if(et.isSky())continue;const yt=Oe?(et.is3D(T)?ue:ne)[Oe.id]:void 0;this._renderTileClippingMasks(et,Oe,yt),this.renderLayer(this,Oe,et,yt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ke&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||r.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<P.length;this.currentLayer++){const et=H[this.currentLayer],Oe=a.getLayerSourceCache(et);et.isSky()&&this.renderLayer(this,Oe,et,Oe?ne[Oe.id]:void 0)}function $e(et,Oe){let yt;return Oe&&(yt=(et.type==="symbol"?ae:et.is3D(T)?ue:ne)[Oe.id]),yt}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<P.length;){const et=H[this.currentLayer];if(et.type==="raster"||et.type==="raster-particle"){const Oe=a.getLayerSourceCache(et);this.renderLayer(this,Oe,et,$e(et,Oe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let ct=0;Ie&&(ct=Ie.getShadowCastingLayerCount());let it=!1,gt=-1;for(let et=0;et<P.length;++et){const Oe=H[et];Oe.isHidden(this.transform.zoom)||Oe.is3D(T)&&(gt=et)}L&>===-1&&(M=!0);let jt=!1;for(;this.currentLayer<P.length;){const et=H[this.currentLayer],Oe=a.getLayerSourceCache(et);if(et.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(et)){if(et.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!jt&&et.is3D(T)&&!T){const yt=this.currentLayer,nt=wt=>{for(this.currentLayer=0;this.currentLayer<H.length;this.currentLayer++){const Bt=H[this.currentLayer];if(sx[Bt.type]){const oi=this.style.getLayerSourceCache(Bt);sx[Bt.type](this,oi,Bt,$e(Bt,oi),wt)}}};nt("initialize"),nt("reset"),this.currentLayer=yt,jt=!0}if(M&&!it&&this.terrain&&!this.transform.isOrthographic&&(it=!0,this.blitDepth()),L&>!==-1&&this.currentLayer===gt+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(et,Oe,Oe?se[Oe.id]:void 0),this.renderLayer(this,Oe,et,$e(et,Oe)),!this.terrain&&Ie&&ct>0&&et.hasShadowPass()&&--ct==0){{this.clearStencil(),this.resetStencilClippingMasks();const yt=this.currentLayer;for(this.currentLayer=0;this.currentLayer<H.length;this.currentLayer++){const nt=H[this.currentLayer];if(Ll[nt.type]){const wt=this.style.getLayerSourceCache(nt);Ll[nt.type](this,wt,nt,$e(nt,wt))}}this.currentLayer=yt}if(Ie.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const yt=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=yt;this.currentLayer++){const nt=H[this.currentLayer];if(!nt.hasLightBeamPass())continue;const wt=a.getLayerSourceCache(nt);this.renderLayer(this,wt,nt,wt?ne[wt.id]:void 0)}this.currentLayer=yt,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const yt=this.currentLayer;this.depthOcclusion=!0;for(const nt of this.layersWithOcclusionOpacity){this.currentLayer=nt;const wt=H[this.currentLayer],Bt=a.getLayerSourceCache(wt),oi=Bt?ne[Bt.id]:void 0;this.terrain||this._renderTileClippingMasks(wt,Bt,Bt?se[Bt.id]:void 0),this.renderLayer(this,Bt,wt,oi)}this.depthOcclusion=!1,this.currentLayer=yt,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 et=null;H.forEach(Oe=>{const yt=a.getLayerSourceCache(Oe);yt&&!Oe.isHidden(this.transform.zoom)&&yt.getVisibleCoordinates().length&&(!et||et.getSource().maxzoom<yt.getSource().maxzoom)&&(et=yt)}),et&&this.options.showTileBoundaries&&iw(this,et,et.getVisibleCoordinates(),r.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&iw(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new r.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(et){const Oe=et.transform.padding;Rr(et,et.transform.height-(Oe.top||0),3,rh),Rr(et,Oe.bottom||0,3,f2),Sy(et,Oe.left||0,3,J1),Sy(et,et.transform.width-(Oe.right||0),3,ew);const yt=et.transform.centerPoint;(function(nt,wt,Bt,oi){Of(nt,wt-1,Bt-10,2,20,oi),Of(nt,wt-10,Bt-1,20,2,oi)})(et,yt.x,et.transform.height-yt.y,tw)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
3704anvasCopy()),Y||(this.conflationActive=!1)}prepareLayer(a){this.gpuTimingStart(a);const{unsupportedLayers:h}=this.transform.projection,y=!h||!h.includes(a.type);if(rx[a.type]&&(y||this.terrain&&a.type==="custom")){const b=this.style.getLayerSourceCache(a);rx[a.type](a,b,this)}this.gpuTimingEnd()}renderLayer(a,h,y,b){y.isHidden(this.transform.zoom)||(y.type==="background"||y.type==="sky"||y.type==="custom"||y.type==="model"||y.type==="raster"||y.type==="raster-particle"||b&&b.length)&&(this.id=y.id,this.gpuTimingStart(y),a.transform.projection.unsupportedLayers&&a.transform.projection.unsupportedLayers.includes(y.type)&&(!a.terrain||y.type!=="custom")||y.type==="clip"||cw[y.type](a,h,y,b,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(a){if(!this.options.gpuTiming)return;const h=this.context.extTimerQuery,y=this.context.gl;let b=this.gpuTimers[a.id];b||(b=this.gpuTimers[a.id]={calls:0,cpuTime:0,query:y.createQuery()}),b.calls++,y.beginQuery(h.TIME_ELAPSED_EXT,b.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const a=this.context.extTimerQuery,h=this.context.gl,y=h.createQuery();this.deferredRenderGpuTimeQueries.push(y),h.beginQuery(a.TIME_ELAPSED_EXT,y)}}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 a=this.gpuTimers;return this.gpuTimers={},a}collectDeferredRenderGpuQueries(){const a=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],a}queryGpuTimers(a){const h={};for(const y in a){const b=a[y],T=this.context.extTimerQuery,E=T.getQueryParameter(b.query,this.context.gl.QUERY_RESULT)/1e6;T.deleteQueryEXT(b.query),h[y]=E}return h}queryGpuTimeDeferredRender(a){if(!this.options.gpuTimingDeferredRender)return 0;const h=this.context.gl;let y=0;for(const b of a)y+=h.getQueryParameter(b,h.QUERY_RESULT)/1e6,h.deleteQuery(b);return y}translatePosMatrix(a,h,y,b,T){if(!y[0]&&!y[1])return a;const E=T?b==="map"?this.transform.angle:0:b==="viewport"?-this.transform.angle:0;if(E){const L=Math.sin(E),O=Math.cos(E);y=[y[0]*O-y[1]*L,y[0]*L+y[1]*O]}const P=[T?y[0]:r.ay(h,y[0],this.transform.zoom),T?y[1]:r.ay(h,y[1],this.transform.zoom),0],M=new Float32Array(16);return r.bq(M,a,P),M}saveTileTexture(a){if(a.context!==this.context)return;const h=a.size[0],y=this._tileTextures[h];y?y.push(a):this._tileTextures[h]=[a]}getTileTexture(a){const h=this._tileTextures[a];return h&&h.length>0?h.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(a,h,y){const b=y===void 0?this.terrain&&this.terrain.renderingToTexture:y,T=[];return this.style&&this.style.enable3dLights()&&(a==="globeRaster"||a==="terrainRaster"?(T.push("LIGHTING_3D_MODE"),T.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):b||T.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||T.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(T.push("TERRAIN"),this.linearFloatFilteringSupported()&&T.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&T.push("GLOBE"),!this._fogVisible||b||h!==void 0&&!h||T.push("FOG","FOG_DITHERING"),b&&T.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&T.push("OVERDRAW_INSPECTOR"),T}getOrCreateProgram(a,h){this.cache=this.cache||{};const y=h&&h.defines||[],b=h&&h.config,T=this.currentGlobalDefines(a,h&&h.overrideFog,h&&h.overrideRtt).concat(y),E=vy.cacheKey(Av[a],a,T,b);return this.cache[E]||(this.cache[E]=new vy(this.context,a,Av[a],b,pD[a],T)),this.cache[E]}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 a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new r.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
vendor: 30,503 bytes, line 3704
3704stroy(),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(a,h){if(this.style.enable3dLights()){const y=this.style.directionalLight,b=this.style.ambientLight;if(y&&b){const T=((E,P,M)=>{const L=E.properties.get("direction"),O=E.properties.get("color-use-theme")==="none",H=E.properties.get("color").toNonPremultipliedRenderColor(O?null:M.getLut(E.scope)).toArray01(),F=E.properties.get("intensity"),Z=P.properties.get("color-use-theme")==="none",Y=P.properties.get("color").toNonPremultipliedRenderColor(Z?null:M.getLut(P.scope)).toArray01(),J=P.properties.get("intensity"),se=[L.x,L.y,L.z],ne=r.dM(Y,J),ae=r.dM(H,F);return{u_lighting_ambient_color:ne,u_lighting_directional_dir:se,u_lighting_directional_color:ae,u_ground_radiance:L1(se,ae,ne)}})(y,b,this.style);h.setLightsUniformValues(a,T)}}}uploadCommonUniforms(a,h,y,b,T){if(this.uploadCommonLightUniforms(a,h),this.terrain&&this.terrain.renderingToTexture)return;const E=this.style.fog;if(E){const P=E.getOpacity(this.transform.pitch),M=((L,O,H,F,Z,Y,J,se,ne,ae,fe,ue)=>{const Ce=L.transform,me=O.properties.get("color-use-theme")==="none",Ie=O.properties.get("color").toNonPremultipliedRenderColor(me?null:L.style.getLut(O.scope)).toArray01();Ie[3]=F;const Se=L.frameCounter/1e3%1,[ve,ke]=O.properties.get("vertical-range");return{u_fog_matrix:H?Ce.calculateFogTileMatrix(H):ue||L.identityMat,u_fog_range:O.getFovAdjustedRange(Ce._fov),u_fog_color:Ie,u_fog_horizon_blend:O.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ve,ke),ke],u_fog_temporal_offset:Se,u_frustum_tl:Z,u_frustum_tr:Y,u_frustum_br:J,u_frustum_bl:se,u_globe_pos:ne,u_globe_radius:ae,u_viewport:fe,u_globe_transition:r.aj(Ce.zoom),u_is_globe:+(Ce.projection.name==="globe")}})(this,E,y,P,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*r.o.devicePixelRatio,this.transform.height*r.o.devicePixelRatio],b);h.setFogUniformValues(a,M)}T&&h.setCutoffUniformValues(a,T.uniformValues)}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){const a=this.canvasCopy();a&&(this.frameCopies.push(a),this.tileLoaded=!1)}canvasCopy(){const a=this.context.gl,h=a.createTexture();return a.bindTexture(a.TEXTURE_2D,h),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),h}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&a.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const a=this._backgroundTiles,h=this._backgroundTiles={},y=this.transform.coveringTiles({tileSize:512});for(const b of y)h[b.key]=a[b.key]||new fu(b,512,this.transform.tileZoom,this,void 0,this.worldview);return h}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(a,h){return!(!a.is3D(!(!this.terrain||!this.terrain.enabled))||a.type!=="clip"&&a.type!=="building"&&(a.minzoom&&a.minzoom>this.transform.zoom||(this.style._clipLayerPresent||a.sourceLayer!=="building"&&a.sourceLayer!=="procedural_buildings")&&(!h||h.type!=="batched-model")))}isTileAffectedByFog(a){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let h=this._cachedTileFogOpacities[a.key];return h||(this._cachedTileFogOpacities[a.key]=h=this.style.fog.getOpacityForTile(a)),h[0]>=Ve||h[1]>=Ve}setupDepthForOcclusion(a,h,y){const b=this.context,T=b.gl,E=!!y;var P;y||(y={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),b.activeTexture.set(T.TEXTURE3),a&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE),y.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],y.u_depth_range_unpack=[2/((P=this.depthRangeFor3D)[1]-P[0]),-1-2*P[0]/(P[1]-P[0])],y.u_occluder_half_size=.5*this.occlusionParams.occluderSize,y.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(T.NEAREST,T.CLAMP_TO_EDGE),b.activeTexture.set(T.TEXTURE0),E||h.setTerrainUniformValues(b,y)}}function gp(g,a){let h=!1,y=null;const b=()=>{y=null,h&&(g(),y=setTimeout(b,a),h=!1)};return()=>(h=!0,y||b(),y)}class ox{constructor(a){this._hashName=a&&encodeURIComponent(a),r.aX(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=gp(this._updateHashUnthrottled.bind(this),300)}addTo(a){return this._map=a,window.addEventListener("hashchange",this._onHashChange,!1),a.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 a=this._map;if(!a)return"";const h=ax(a);if(this._hashName){const y=this._hashName;let b=!1;const T=location.hash.slice(1).split("&").map(E=>{const P=E.split("=")[0];return P===y?(b=!0,`${P}=${h}`):E}).filter(E=>E);return b||T.push(`${y}=${h}`),`#${T.join("&")}`}return`#${h}`}_getCurrentHash(){const a=location.hash.replace("#","");if(this._hashName){let h;return a.split("&").map(y=>y.split("=")).forEach(y=>{y[0]===this._hashName&&(h=y)}),(h&&h[1]||"").split("/")}return a.split("/")}_onHashChange(){const a=this._map;if(!a)return!1;const h=this._getCurrentHash();if(h.length>=3&&!h.some(y=>isNaN(Number(y)))){const y=a.dragRotate.isEnabled()&&a.touchZoomRotate.isEnabled()?+(h[3]||0):a.getBearing();return a.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:y,pitch:+(h[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function ax(g,a){const h=g.getCenter(),y=Math.round(100*g.getZoom())/100,b=Math.ceil((y*Math.LN2+Math.log(512/360/.5))/Math.LN10),T=Math.pow(10,b),E=Math.round(h.lng*T)/T,P=Math.round(h.lat*T)/T,M=g.getBearing(),L=g.getPitch();let O=a?`/${E}/${P}/${y}`:`${y}/${P}/${E}`;return(M||L)&&(O+="/"+Math.round(10*M)/10),L&&(O+=`/${Math.round(L)}`),O}const Hf={linearity:.3,easing:r.eS(0,0,.3,1)},oh=Object.assign({deceleration:2500,maxSpeed:1400},Hf),uw=Object.assign({deceleration:20,maxSpeed:1400},Hf),Sc=Object.assign({deceleration:1e3,maxSpeed:360},Hf),dw=Object.assign({deceleration:1e3,maxSpeed:90},Hf);class lx{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:r.o.now(),settings:a})}_drainInertiaBuffer(){const a=this._inertiaBuffer,h=r.o.now();for(;a.length>0&&h-a[0].time>160;)a.shift()}_onMoveEnd(a){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const h={zoom:0,bearing:0,pitch:0,pan:new r.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:T}of this._inertiaBuffer)h.zoom+=T.zoomDelta||0,h.bearing+=T.bearingDelta||0,h.pitch+=T.pitchDelta||0,T.panDelta&&h.pan._add(T.panDelta),T.around&&(h.around=T.around),T.pinchAround&&(h.pinchAround=T.pinchAround);const y=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,b={};if(h.pan.mag()){const T=Wf(h.pan.mag(),y,Object.assign({},oh,a||{}));b.offset=h.pan.mult(T.amount/h.pan.mag()),b.center=this._map.transform.center,Gf(b,T)}if(h.zoom){const T=Wf(h.zoom,y,uw);b.zoom=this._map.transform.zoom+T.amount,Gf(b,T)}if(h.bearing){const T=Wf(h.bearing,y,Sc);b.bearing=this._map.transform.bearing+r.aA(T.amount,-179,179),Gf(b,T)}if(h.pitch){const T=Wf(h.pitch,y,dw);b.pitch=this._map.transform.pitch+T.amount,Gf(b,T)}if(b.zoom||b.bearing){const T=h.pinchAround===void 0?h.around:h.pinchAround;b.around=T?this._map.unproject(T):this._map.getCenter()}return this.clear(),b.noMoveStart=!0,b}}function Gf(g,a){(!g.duration||g.duration<a.duration)&&(g.duration=a.duration,g.easing=a.easing)}function Wf(g,a,h){const{maxSpeed:y,linearity:b,deceleration:T}=h,E=r.aA(g*b/(a/1e3),-y,y),P=Math.abs(E)/(T*b);return{easing:h.easing,duration:1e3*P,amount:E*(P/2)}}class Xr extends r.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,h,y,b={}){const T=Ne(h.getCanvasContainer(),y),E=h.unproject(T);super(a,Object.assign({point:T,lngLat:E,originalEvent:y},b)),this._defaultPrevented=!1,this.target=h}}class Kf extends r.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,h,y){const b=a==="touchend"?y.changedTouches:y.touches,T=pe(h.getCanvasContainer(),b),E=T.map(M=>h.unproject(M)),P=T.reduce((M,L,O,H)=>M.add(L.div(H.length)),new r.P(0,0));super(a,{points:T,point:P,lngLats:E,lngLat:h.unproject(P),originalEvent:y}),this._defaultPrevented=!1}}class hw extends r.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,h){super("wheel",{originalEvent:h}),this._defaultPrevented=!1}}class pw{constructor(a,h){this._map=a,this._clickTolerance=h.clickTolerance}reset(){this._mousedownPos=void 0}wheel(a){return this._firePreventable(new hw(this._map,a))}mousedown(a,h){return this._mousedownPos=h,this._firePreventable(new Xr(a.type,this._map,a))}mouseup(a){this._map.fire(new Xr(a.type,this._map,a))}preclick(a){const h=new MouseEvent("preclick",a);this._map.fire(new Xr(h.type,this._map,h))}click(a,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||(this.preclick(a),this._map.fire(new Xr(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new Xr(a.type,this._map,a))}mouseover(a){this._map.fire(new Xr(a.type,this._map,a))}mouseout(a){this._map.fire(new Xr(a.type,this._map,a))}touchstart(a){return this._firePreventable(new Kf(a.type,this._map,a))}touchmove(a){this._map.fire(new Kf(a.type,this._map,a))}touchend(a){this._map.fire(new Kf(a.type,this._map,a))}touchcancel(a){this._map.fire(new Kf(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class yp{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(a){this._map.fire(new Xr(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Xr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new Xr(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fw{constructor(a,h){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,h){this.isEnabled()&&a.shiftKey&&a.button===0&&(ce(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(a,h){if(!this._active)return;const y=h,b=this._startPos,T=this._lastPos;if(!b||!T||T.equals(y)||!this._box&&y.dist(b)<this._clickTolerance)return;this._lastPos=y,this._box||(this._box=B("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",a));const E=Math.min(b.x,y.x),P=Math.max(b.x,y.x),M=Math.min(b.y,y.y),L=Math.max(b.y,y.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${E}px,${M}px)`,this._box.style.width=P-E+"px",this._box.style.height=L-M+"px")})}mouseupWindow(a,h){if(!this._active)return;const y=this._startPos,b=h;if(y&&a.button===0){if(this.reset(),we(),y.x!==b.x||y.y!==b.y)return this._map.fire(new r.z("boxzoomend",{originalEvent:a})),{cameraAnimation:T=>T.fitScreenCoordinates(y,b,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",a)}}keydown(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),_e(),delete this._startPos,delete this._lastPos}_fireEvent(a,h){return this._map.fire(new r.z(a,{originalEvent:h}))}}function Ey(g,a){const h={};for(let y=0;y<g.length;y++)h[g[y].identifier]=a[y];return h}class mw{constructor(a){this.reset(),this.numTouches=a.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(a,h,y){(this.centroid||y.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=a.timeStamp),y.length===this.numTouches&&(this.centroid=function(b){const T=new r.P(0,0);for(const E of b)T._add(E);return T.div(b.length)}(h),this.touches=Ey(y,h)))}touchmove(a,h,y){if(this.aborted||!this.centroid)return;const b=Ey(y,h);for(const T in this.touches){const E=b[T];(!E||E.dist(this.touches[T])>30)&&(this.aborted=!0)}}touchend(a,h,y){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),y.length===0){const b=!this.aborted&&this.centroid;if(this.reset(),b)return b}}}class ah{constructor(a){this.singleTap=new mw(a),this.numTaps=a.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(a,h,y){this.singleTap.touchstart(a,h,y)}touchmove(a,h,y){this.singleTap.touchmove(a,h,y)}touchend(a,h,y){const b=this.singleTap.touchend(a,h,y);if(b){const T=a.timeStamp-this.lastTime<500,E=!this.lastTap||this.lastTap.dist(b)<30;if(T&&E||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=b,this.count===this.numTaps)return this.reset(),b}}}class gw{constructor(){this._zoomIn=new ah({numTouches:1,numTaps:2}),this._zoomOut=new ah({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,h,y){this._zoomIn.touchstart(a,h,y),this._zoomOut.touchstart(a,h,y)}touchmove(a,h,y){this._zoomIn.touchmove(a,h,y),this._zoomOut.touchmove(a,h,y)}touchend(a,h,y){const b=this._zoomIn.touchend(a,h,y),T=this._zoomOut.touchend(a,h,y);return b?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:E.getZoom()+1,around:E.unproject(b)},{originalEvent:a})}):T?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:E=>E.easeTo({duration:300,zoom:E.getZoom()-1,around:E.unproject(T)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cx={0:1,2:2},ux={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Zf{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(a,h){return!1}_move(a,h){return{}}mousedown(a,h){if(this._lastPoint)return;const y=Pe(a);this._correctButton(a,y)&&(this._lastPoint=h,this._eventButton=y)}mousemoveWindow(a,h){const y=this._lastPoint;if(y){if(a.preventDefault(),this._eventButton!=null&&function(b,T){const E=cx[T];return b.buttons===void 0||(b.buttons&E)!==E}(a,this._eventButton))this.reset();else if(this._moved||!(h.dist(y)<this._clickTolerance))return this._moved=!0,this._lastPoint=h,this._move(y,h)}}mouseupWindow(a){this._lastPoint&&Pe(a)===this._eventButton&&(this._moved&&we(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yw extends Zf{mousedown(a,h){super.mousedown(a,h),this._lastPoint&&(this._active=!0)}_correctButton(a,h){return h===0&&!a.ctrlKey}_move(a,h){return{around:h,panDelta:h.sub(a)}}}class dx extends Zf{constructor(a){super(a),this._pitchRotateKey=a.pitchRotateKey?ux[a.pitchRotateKey]:void 0}_correctButton(a,h){return this._pitchRotateKey?h===0&&a[this._pitchRotateKey]:h===0&&a.ctrlKey||h===2}_move(a,h){const y=.8*(h.x-a.x);if(y)return this._active=!0,{bearingDelta:y}}contextmenu(a){this._pitchRotateKey||a.preventDefault()}}class _w extends Zf{constructor(a){super(a),this._pitchRotateKey=a.pitchRotateKey?ux[a.pitchRotateKey]:void 0}_correctButton(a,h){return this._pitchRotateKey?h===0&&a[this._pitchRotateKey]:h===0&&a.ctrlKey||h===2}_move(a,h){const y=-.5*(h.y-a.y);if(y)return this._active=!0,{pitchDelta:y}}contextmenu(a){this._pitchRotateKey||a.preventDefault()}}class S2{constructor(a,h){this._map=a,this._el=a.getCanvasContainer(),this._minTouches=1,this._clickTolerance=h.clickTolerance||1,this.reset(),r.aX(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new r.P(0,0)}touchstart(a,h,y){return this._calculateTransform(a,h,y)}touchmove(a,h,y){if(this._active&&!(y.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(y.length===1&&!r.eT())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return a.cancelable&&a.preventDefault(),this._calculateTransform(a,h,y)}}touchend(a,h,y){this._calculateTransform(a,h,y),this._active&&y.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(a,h,y){y.length>0&&(this._active=!0);const b=Ey(y,h),T=new r.P(0,0),E=new r.P(0,0);let P=0;for(const L in b){const O=b[L],H=this._touches[L];H&&(T._add(O),E._add(O.sub(H)),P++,b[L]=O)}if(this._touches=b,P<this._minTouches||!E.mag())return;const M=E.div(P);return this._sum._add(M),this._sum.mag()<this._clickTolerance?void 0:{around:T.div(P),panDelta:M}}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=B("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 hx{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(a){}_move(a,h,y){return{}}touchstart(a,h,y){this._firstTwoTouches||y.length<2||(this._firstTwoTouches=[y[0].identifier,y[1].identifier],this._start([h[0],h[1]]))}touchmove(a,h,y){const b=this._firstTwoTouches;if(!b)return;a.preventDefault();const[T,E]=b,P=Ay(y,h,T),M=Ay(y,h,E);if(!P||!M)return;const L=this._aroundCenter?null:P.add(M).div(2);return this._move([P,M],L,a)}touchend(a,h,y){if(!this._firstTwoTouches)return;const[b,T]=this._firstTwoTouches,E=Ay(y,h,b),P=Ay(y,h,T);E&&P||(this._active&&we(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&a.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ay(g,a,h){for(let y=0;y<g.length;y++)if(g[y].identifier===h)return a[y]}function vw(g,a){return Math.log2(g/a)}class T2 extends hx{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(a){this._startDistance=this._distance=a[0].dist(a[1])}_move(a,h){const y=this._distance;if(this._distance=a[0].dist(a[1]),this._active||!(Math.abs(vw(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vw(this._distance,y),pinchAround:h}}}function xw(g,a){return 180*g.angleWith(a)/Math.PI}class C2 extends hx{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,h){const y=this._vector;if(this._vector=a[0].sub(a[1]),y&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:xw(this._vector,y),pinchAround:h}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const h=25/(Math.PI*this._minDiameter)*360,y=this._startVector;if(!y)return!1;const b=xw(a,y);return Math.abs(b)<h}}function px(g){return Math.abs(g.y)>Math.abs(g.x)}class E2 extends hx{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(a){this._lastPoints=a,px(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,h,y){const b=this._lastPoints;if(!b)return;const T=a[0].sub(b[0]),E=a[1].sub(b[1]);return this._map._cooperativeGestures&&!r.eT()&&y.touches.length<3||(this._valid=this.gestureBeginsVertically(T,E,y.timeStamp),!this._valid)?void 0:(this._lastPoints=a,this._active=!0,{pitchDelta:(T.y+E.y)/2*-.5})}gestureBeginsVertically(a,h,y){if(this._valid!==void 0)return this._valid;const b=a.mag()>=2,T=h.mag()>=2;if(!b&&!T)return;if(!b||!T)return this._firstMove==null&&(this._firstMove=y),y-this._firstMove<100&&void 0;const E=a.y>0==h.y>0;return px(a)&&px(h)&&E}}const A2={panStep:100,bearingStep:15,pitchStep:10};class I2{constructor(){const a=A2;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let h=0,y=0,b=0,T=0,E=0;switch(a.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:a.shiftKey?y=-1:(a.preventDefault(),T=-1);break;case 39:a.shiftKey?y=1:(a.preventDefault(),T=1);break;case 38:a.shiftKey?b=1:(a.preventDefault(),E=-1);break;case 40:a.shiftKey?b=-1:(a.preventDefault(),E=1);break;default:return}return this._rotationDisabled&&(y=0,b=0),{cameraAnimation:P=>{const M=P.getZoom();P.easeTo({duration:300,easeId:"keyboardHandler",easing:k2,zoom:h?Math.round(M)+h*(a.shiftKey?2:1):M,bearing:P.getBearing()+y*this._bearingStep,pitch:P.getPitch()+b*this._pitchStep,offset:[-T*this._panStep,-E*this._panStep],center:P.getCenter()},{originalEvent:a})}}}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 k2(g){return g*(2-g)}const P2=4.000244140625,bD=1/450;class wD{constructor(a,h){this._map=a,this._el=a.getCanvasContainer(),this._handler=h,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=bD,r.aX(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&a.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(a){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(a.ctrlKey||a.metaKey||this.isZooming()||r.eT()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let h=a.deltaMode===WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY;const y=r.o.now(),b=y-(this._lastWheelEventTime||0);this._lastWheelEventTime=y,h!==0&&h%P2==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":b>400?(this._type=null,this._lastValue=h,this._timeout=window.setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(b*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),a.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=a,this._delta-=h,this._active||this._start(a)),a.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){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 h=Ne(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:h,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 a=this._map.transform;this._type==="wheel"&&a.projection.wrap&&(a._center.lng>=180||a._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const h=()=>a._terrainEnabled()&&this._aroundCoord?a.computeZoomRelativeTo(this._aroundCoord):a.zoom;if(this._delta!==0){const L=this._type==="wheel"&&Math.abs(this._delta)>P2?this._wheelZoomRate:this._defaultZoomRate;let O=2/(1+Math.exp(-Math.abs(this._delta*L)));this._delta<0&&O!==0&&(O=1/O);const H=h(),F=Math.pow(2,H),Z=typeof this._targetZoom=="number"?a.zoomScale(this._targetZoom):F;this._targetZoom=Math.min(a.maxZoom,Math.max(a.minZoom,a.scaleZoom(Z*O))),this._type==="wheel"&&(this._startZoom=H,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const y=typeof this._targetZoom=="number"?this._targetZoom:h(),b=this._startZoom,T=this._easing;let E,P=!1;if(this._type==="wheel"&&b&&T){const L=Math.min((r.o.now()-this._lastWheelEventTime)/200,1),O=T(L);E=r.ak(b,y,O),L<1?this._frameId||(this._frameId=!0):P=!0}else E=y,P=!0;this._active=!0,P&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let M=E-h();return M*this._lastDelta<0&&(M=0),{noInertia:!0,needsRenderFrame:!P,zoomDelta:M,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(a){let h=r.eU;if(this._prevEase){const y=this._prevEase,b=(r.o.now()-y.start)/y.duration,T=y.easing(b+.01)-y.easing(b),E=.27/Math.sqrt(T*T+1e-4)*.01,P=Math.sqrt(.0729-E*E);h=r.eS(E,P,.25,1)}return this._prevEase={start:r.o.now(),duration:a,easing:h},h}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=B("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 ls{constructor(a,h){this._clickZoom=a,this._tapZoom=h}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 N2{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,h){return a.preventDefault(),{cameraAnimation:y=>{y.easeTo({duration:300,zoom:y.getZoom()+(a.shiftKey?-1:1),around:y.unproject(h)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class SD{constructor(){this._tap=new ah({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(a,h,y){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?y.length>0&&(this._swipePoint=h[0],this._swipeTouch=y[0].identifier):this._tap.touchstart(a,h,y))}touchmove(a,h,y){if(this._tapTime){if(this._swipePoint){if(y[0].identifier!==this._swipeTouch)return;const b=h[0],T=b.y-this._swipePoint.y;return this._swipePoint=b,a.preventDefault(),this._active=!0,{zoomDelta:T/128}}}else this._tap.touchmove(a,h,y)}touchend(a,h,y){this._tapTime?this._swipePoint&&y.length===0&&this.reset():this._tap.touchend(a,h,y)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class TD{constructor(a,h,y){this._el=a,this._mousePan=h,this._touchPan=y}enable(a){this._inertiaOptions=a||{},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 CD{constructor(a,h,y){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=h,this._mousePitch=y}
vendor: 5,151 bytes, line 3704
3704enable(){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 Iy{constructor(a,h,y,b){this._el=a,this._touchZoom=h,this._touchRotate=y,this._tapDragZoom=b,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),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 ky=g=>g.zoom||g.drag||g.pitch||g.rotate;class bw extends r.z{}class fx{constructor(){this.constants=[1,1,.01],this.radius=0}setup(a,h){const y=r.av([],h,a);this.radius=r.ag(y[2]<0?r.eW([],y,this.constants):[y[0],y[1],0])}projectRay(a){r.eW(a,a,this.constants),r.aw(a,a),r.eX(a,a,this.constants);const h=r.c4([],a,this.radius);if(h[2]>0){const y=r.c4([],[0,0,1],r.bI(h,[0,0,1])),b=r.c4([],r.aw([],[h[0],h[1],0]),this.radius),T=r.d7([],h,r.c4([],r.av([],r.d7([],b,y),h),2));h[0]=T[0],h[1]=T[1]}return h}}function Tc(g){return g.panDelta&&g.panDelta.mag()||g.zoomDelta||g.bearingDelta||g.pitchDelta}class mx{constructor(a,h){this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new lx(a),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new fx,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(h),r.aX(["handleEvent","handleWindowEvent"],this);const y=this._el;this._listeners=[[y,"touchstart",{passive:!0}],[y,"touchmove",{passive:!1}],[y,"touchend",void 0],[y,"touchcancel",void 0],[y,"mousedown",void 0],[y,"mousemove",void 0],[y,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[y,"mouseover",void 0],[y,"mouseout",void 0],[y,"dblclick",void 0],[y,"click",void 0],[y,"keydown",{capture:!1}],[y,"keyup",void 0],[y,"wheel",{passive:!1}],[y,"contextmenu",void 0],[window,"blur",void 0]];for(const[b,T,E]of this._listeners){const P=b===document?this.handleWindowEvent:this.handleEvent;b.addEventListener(T,P,E)}}destroy(){for(const[a,h,y]of this._listeners){const b=a===document?this.handleWindowEvent:this.handleEvent;a.removeEventListener(h,b,y)}}_addDefaultHandlers(a){const h=this._map,y=h.getCanvasContainer();this._add("mapEvent",new pw(h,a));const b=h.boxZoom=new fw(h,a);this._add("boxZoom",b);const T=new gw,E=new N2;h.doubleClickZoom=new ls(E,T),this._add("tapZoom",T),this._add("clickZoom",E);const P=new SD;this._add("tapDragZoom",P);const M=h.touchPitch=new E2(h);this._add("touchPitch",M);const L=new dx(a),O=new _w(a);h.dragRotate=new CD(a,L,O),this._add("mouseRotate",L,["mousePitch"]),this._add("mousePitch",O,["mouseRotate"]);const H=new yw(a),F=new S2(h,a);h.dragPan=new TD(y,H,F),this._add("mousePan",H),this._add("touchPan",F,["touchZoom","touchRotate"]);const Z=new C2,Y=new T2;h.touchZoomRotate=new Iy(y,Y,Z,P),this._add("touchRotate",Z,["touchPan","touchZoom"]),this._add("touchZoom",Y,["touchPan","touchRotate"]),this._add("blockableMapEvent",new yp(h));const J=h.scrollZoom=new wD(h,this);this._add("scrollZoom",J,["mousePan"]);const se=h.keyboard=new I2;this._add("keyboard",se);for(const ne of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])a.interactive&&a[ne]&&h[ne].enable(a[ne])}_add(a,h,y){this._handlers.push({handlerName:a,handler:h,allowed:y}),this._handlersById[a]=h}stop(a){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ky(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(a,h,y){for(const b in a)if(b!==y&&(!h||h.indexOf(b)<0))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(a){const h=[];for(const y of a)this._el.contains(y.target)&&h.push(y);return h}handleEvent(a,h){this._updatingCamera=!0;const y=a.type==="renderFrame",b=y?void 0:a,T={needsRenderFrame:!1},E={},P={},M=a.touches?this._getMapTouches(a.touches):void 0,L=M?pe(this._el,M):y?void 0:Ne(this._el,a);for(const{handlerName:F,handler:Z,allowed:Y}
vendor: 21,780 bytes, line 3704
3704of this._handlers){if(!Z.isEnabled())continue;let J;this._blockedByActive(P,Y,F)?Z.reset():Z[h||a.type]&&(J=Z[h||a.type](a,L,M),this.mergeHandlerResult(T,E,J,F,b),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||Z.isActive())&&(P[F]=Z)}const O={};for(const F in this._previousActiveHandlers)P[F]||(O[F]=b);this._previousActiveHandlers=P,(Object.keys(O).length||Tc(T))&&(this._changes.push([T,E,O]),this._triggerRenderFrame()),(Object.keys(P).length||Tc(T))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:H}=T;H&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],H(this._map))}mergeHandlerResult(a,h,y,b,T){if(!y)return;Object.assign(a,y);const E={handlerName:b,originalEvent:y.originalEvent||T};y.zoomDelta!==void 0&&(h.zoom=E),y.panDelta!==void 0&&(h.drag=E),y.pitchDelta!==void 0&&(h.pitch=E),y.bearingDelta!==void 0&&(h.rotate=E)}_applyChanges(){const a={},h={},y={};for(const[b,T,E]of this._changes)b.panDelta&&(a.panDelta=(a.panDelta||new r.P(0,0))._add(b.panDelta)),b.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+b.zoomDelta),b.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+b.bearingDelta),b.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+b.pitchDelta),b.around!==void 0&&(a.around=b.around),b.aroundCoord!==void 0&&(a.aroundCoord=b.aroundCoord),b.pinchAround!==void 0&&(a.pinchAround=b.pinchAround),b.noInertia&&(a.noInertia=b.noInertia),Object.assign(h,T),Object.assign(y,E);this._updateMapTransform(a,h,y),this._changes=[]}_updateMapTransform(a,h,y){const b=this._map,T=b.transform,E=ae=>[ae.x,ae.y,ae.z];if((ae=>{const fe=this._eventsInProgress.drag;return fe&&!this._handlersById[fe.handlerName].isActive()})()&&!Tc(a)){const ae=T.zoom;T.cameraElevationReference="sea",this._originalZoom!=null&&T._orthographicProjectionAtLowPitch&&T.projection.name!=="globe"&&T.pitch===0?(T.cameraElevationReference="ground",T.zoom=this._originalZoom):(T.recenterOnTerrain(),T.cameraElevationReference="ground"),ae!==T.zoom&&this._map._update(!0)}if(T._isCameraConstrained&&b._stop(!0),!Tc(a))return void this._fireEvents(h,y,!0);let{panDelta:P,zoomDelta:M,bearingDelta:L,pitchDelta:O,around:H,aroundCoord:F,pinchAround:Z}=a;T._isCameraConstrained&&(M>0&&(M=0),T._isCameraConstrained=!1),Z!==void 0&&(H=Z),(M||(ae=>h[ae]&&!this._eventsInProgress[ae])("drag"))&&H&&(this._dragOrigin=E(T.pointCoordinate3D(H)),this._originalZoom=T.zoom,this._trackingEllipsoid.setup(T._camera.position,this._dragOrigin)),T.cameraElevationReference="sea",b._stop(!0),H=H||b.transform.centerPoint,L&&(T.bearing+=L),O&&(T.pitch+=O),T._updateCameraState();const Y=[0,0,0];if(P)if(T.projection.name==="mercator"){const ae=this._trackingEllipsoid.projectRay(T.screenPointToMercatorRay(H).dir),fe=this._trackingEllipsoid.projectRay(T.screenPointToMercatorRay(H.sub(P)).dir);Y[0]=fe[0]-ae[0],Y[1]=fe[1]-ae[1]}else{const ae=T.pointCoordinate(H);if(T.projection.name==="globe"){P=P.rotate(-T.angle);const fe=T._pixelsPerMercatorPixel/T.worldSize;Y[0]=-P.x*r.eV(r.a_(ae.y))*fe,Y[1]=-P.y*r.eV(T.center.lat)*fe}else{const fe=T.pointCoordinate(H.sub(P));ae&&fe&&(Y[0]=fe.x-ae.x,Y[1]=fe.y-ae.y)}}const J=T.zoom,se=[0,0,0];if(M){const ae=E(F||T.pointCoordinate3D(H)),fe={dir:r.aw([],r.av([],ae,T._camera.position))};if(fe.dir[2]<0){const ue=T.zoomDeltaToMovement(ae,M);r.c4(se,fe.dir,ue)}}const ne=r.d7(Y,Y,se);T._translateCameraConstrained(ne),M&&Math.abs(T.zoom-J)>1e-4&&T.recenterOnTerrain(),T.cameraElevationReference="ground",this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(h,y,!0)}_fireEvents(a,h,y){const b=ky(this._eventsInProgress),T=ky(a),E={};for(const O in a){const{originalEvent:H}=a[O];this._eventsInProgress[O]||(E[`${O}start`]=H),this._eventsInProgress[O]=a[O]}!b&&T&&this._fireEvent("movestart",T.originalEvent);for(const O in E)this._fireEvent(O,E[O]);T&&this._fireEvent("move",T.originalEvent);for(const O in a){const{originalEvent:H}=a[O];this._fireEvent(O,H)}const P={};let M;for(const O in this._eventsInProgress){const{handlerName:H,originalEvent:F}=this._eventsInProgress[O];this._handlersById[H].isActive()||(delete this._eventsInProgress[O],M=h[H]||F,P[`${O}end`]=M)}for(const O in P)this._fireEvent(O,P[O]);const L=ky(this._eventsInProgress);if(y&&(b||T)&&!L){this._updatingCamera=!0;const O=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),H=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;O?(H(O.bearing||this._map.getBearing())&&(O.bearing=0),this._map.easeTo(O,{originalEvent:M})):(this._map.fire(new r.z("moveend",{originalEvent:M})),H(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(a,h){this._map.fire(new r.z(a,h?{originalEvent:h}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(a=>{this._frameId=void 0,this.handleEvent(new bw("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Fs="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class vu extends r.E{constructor(a,h){super(),this._moving=!1,this._zooming=!1,this.transform=a,this._bearingSnap=h.bearingSnap,this._respectPrefersReducedMotion=h.respectPrefersReducedMotion!==!1,r.aX(["_renderFrameCallback"],this)}getCenter(){return new r.aS(this.transform.center.lng,this.transform.center.lat)}setCenter(a,h){return this.jumpTo({center:a},h)}panBy(a,h,y){return a=r.P.convert(a).mult(-1),this.panTo(this.transform.center,Object.assign({offset:a},h),y)}panTo(a,h,y){return this.easeTo(Object.assign({center:a},h),y)}getZoom(){return this.transform.zoom}setZoom(a,h){return this.jumpTo({zoom:a},h),this}zoomTo(a,h,y){return this.easeTo(Object.assign({zoom:a},h),y)}zoomIn(a,h){return this.zoomTo(this.getZoom()+1,a,h),this}zoomOut(a,h){return this.zoomTo(this.getZoom()-1,a,h),this}getBearing(){return this.transform.bearing}setBearing(a,h){return this.jumpTo({bearing:a},h),this}getPadding(){return this.transform.padding}setPadding(a,h){return this.jumpTo({padding:a},h),this}rotateTo(a,h,y){return this.easeTo(Object.assign({bearing:a},h),y)}resetNorth(a,h){return this.rotateTo(0,Object.assign({duration:1e3},a),h),this}resetNorthPitch(a,h){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},a),h),this}snapToNorth(a,h){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(a,h):this}getPitch(){return this.transform.pitch}setPitch(a,h){return this.jumpTo({pitch:a},h),this}cameraForBounds(a,h){a=r.aI.convert(a);const y=h&&h.bearing||0,b=h&&h.pitch||0,T=a.getNorthWest(),E=a.getSouthEast();return this._cameraForBounds(this.transform,T,E,y,b,h)}_extendPadding(a){const h={top:0,right:0,bottom:0,left:0};return a==null?Object.assign({},h,this.transform.padding):typeof a=="number"?{top:a,bottom:a,right:a,left:a}:Object.assign({},h,a)}_extendCameraOptions(a){return(a=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding=this._extendPadding(a.padding),a}_minimumAABBFrustumDistance(a,h){const y=h.max[0]-h.min[0],b=h.max[1]-h.min[1];return y/b>a.aspect?y/(2*Math.tan(.5*a.fovX)*a.aspect):b/(2*Math.tan(.5*a.fovY)*a.aspect)}_cameraForBoundsOnGlobe(a,h,y,b,T,E){const P=a.clone(),M=this._extendCameraOptions(E);P.bearing=b,P.pitch=T;const L=r.aS.convert(h),O=r.aS.convert(y),H=.5*(L.lat+O.lat),F=.5*(L.lng+O.lng),Z=r.eY(H,F),Y=r.aw([],Z),J=r.aw([],r.bH([],Y,[0,1,0])),se=r.bH([],J,Y),ne=[J[0],J[1],J[2],0,se[0],se[1],se[2],0,Y[0],Y[1],Y[2],0,0,0,0,1],ae=[Z,r.eY(L.lat,L.lng),r.eY(O.lat,L.lng),r.eY(O.lat,O.lng),r.eY(L.lat,O.lng),r.eY(H,L.lng),r.eY(H,O.lng),r.eY(L.lat,F),r.eY(O.lat,F)];let fe=r.d8.fromPoints(ae.map(nt=>[r.bI(J,nt),r.bI(se,nt),r.bI(Y,nt)]));const ue=r.af([],fe.center,ne);r.eZ(ue)===0&&r.e_(ue,0,0,1),r.aw(ue,ue),r.c4(ue,ue,r.aD),P.center=r.e$(ue);const Ce=P.getWorldToCameraMatrix(),me=r.bk(new Float64Array(16),Ce);fe=r.d8.applyTransform(fe,r.aB([],Ce,ne));const Ie=this._extendAABB(fe,P,M,b);if(!Ie)return void r.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");fe=Ie,r.af(ue,ue,Ce);const Se=.5*(fe.max[2]-fe.min[2]),ve=this._minimumAABBFrustumDistance(P,fe),ke=r.c4([],[0,0,1],Se),Ke=r.d7(ke,ue,ke),$e=ve+(P.pitch===0?0:r.bF(ue,Ke)),ct=P.globeCenterInViewSpace,it=r.av([],ue,[ct[0],ct[1],ct[2]]);r.aw(it,it),r.c4(it,it,$e);const gt=r.d7([],ue,it);r.af(gt,gt,me);const jt=r.eL/r.aD,et=r.ag(gt),Oe=r.ce(Math.max(et*jt-r.eL,Number.EPSILON),0),yt=Math.min(P.zoomFromMercatorZAdjusted(Oe),M.maxZoom);return yt>.5*(r.cZ+r.cK)?(P.setProjection({name:"mercator"}),P.zoom=yt,this._cameraForBounds(P,h,y,b,T,E)):{center:P.center,zoom:yt,bearing:b,pitch:T}}_extendAABB(a,h,y,b){const T=.5*((y.padding.left||0)+(y.padding.right||0)),E=.5*((y.padding.top||0)+(y.padding.bottom||0)),P=E,M=T,L=T,O=E,H=h.width-(M+L),F=h.height-(P+O),Z=r.av([],a.max,a.min),Y=Math.min(H/Z[0],F/Z[1]),J=Math.min(h.scaleZoom(h.scale*Y),y.maxZoom);if(isNaN(J))return null;const se=h.scale/h.zoomScale(J),ne=new r.d8([a.min[0]-M*se,a.min[1]-O*se,a.min[2]],[a.max[0]+L*se,a.max[1]+P*se,a.max[2]]),ae=(typeof y.offset.x=="number"&&typeof y.offset.y=="number"?new r.P(y.offset.x,y.offset.y):r.P.convert(y.offset)).rotate(-r.an(b));return ne.center[0]-=ae.x*se,ne.center[1]+=ae.y*se,ne}queryTerrainElevation(a,h){const y=this.transform.elevation;return y?(h=Object.assign({},{exaggerated:!0},h),y.getAtPoint(r.ae.fromLngLat(a),null,h.exaggerated)):null}_cameraForBounds(a,h,y,b,T,E){if(a.projection.name==="globe")return this._cameraForBoundsOnGlobe(a,h,y,b,T,E);const P=a.clone(),M=this._extendCameraOptions(E);P.bearing=b,P.pitch=T;const L=r.aS.convert(h),O=r.aS.convert(y),H=new r.aS(L.lng,O.lat),F=new r.aS(O.lng,L.lat),Z=P.project(L),Y=P.project(O),J=this.queryTerrainElevation(L),se=this.queryTerrainElevation(O),ne=this.queryTerrainElevation(H),ae=this.queryTerrainElevation(F),fe=[[Z.x,Z.y,Math.min(J||0,se||0,ne||0,ae||0)],[Y.x,Y.y,Math.max(J||0,se||0,ne||0,ae||0)]];let ue=r.d8.fromPoints(fe);const Ce=P.getWorldToCameraMatrix(),me=r.bk(new Float64Array(16),Ce);ue=r.d8.applyTransform(ue,Ce);const Ie=this._extendAABB(ue,P,M,b);if(!Ie)return void r.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");ue=Ie;const Se=.5*r.av([],ue.max,ue.min)[2],ve=this._minimumAABBFrustumDistance(P,ue),ke=[0,0,1,0];r.aC(ke,ke,Ce),r.f0(ke,ke);const Ke=r.c4([],ke,ve+Se),$e=r.d7([],ue.center,Ke);r.af(ue.center,ue.center,me),r.af($e,$e,me);const ct=P.unproject(new r.P(ue.center[0],ue.center[1])),it=r.f1(P.projection,ct),gt=Math.pow(2,it),jt=Math.min(P._zoomFromMercatorZ($e[2]*P.pixelsPerMeter*gt/P.worldSize),M.maxZoom);return P.mercatorFromTransition&&jt<.5*(r.cZ+r.cK)?(P.setProjection({name:"globe"}),P.zoom=jt,this._cameraForBounds(P,h,y,b,T,E)):{center:ct,zoom:jt,bearing:b,pitch:T}}fitBounds(a,h,y){const b=this.cameraForBounds(a,h);return this._fitInternal(b,h,y)}fitScreenCoordinates(a,h,y,b,T){const E=r.P.convert(a),P=r.P.convert(h),M=new r.P(Math.min(E.x,P.x),Math.min(E.y,P.y)),L=new r.P(Math.max(E.x,P.x),Math.max(E.y,P.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(E,P))return this;const O=this.transform.pointLocation3D(M),H=this.transform.pointLocation3D(L),F=this.transform.pointLocation3D(new r.P(M.x,L.y)),Z=this.transform.pointLocation3D(new r.P(L.x,M.y)),Y=[Math.min(O.lng,H.lng,F.lng,Z.lng),Math.min(O.lat,H.lat,F.lat,Z.lat)],J=[Math.max(O.lng,H.lng,F.lng,Z.lng),Math.max(O.lat,H.lat,F.lat,Z.lat)],se=b&&b.pitch?b.pitch:this.getPitch(),ne=this._cameraForBounds(this.transform,Y,J,y,se,b);return this._fitInternal(ne,b,T)}_fitInternal(a,h,y){return a?(h=Object.assign(a,h)).linear?this.easeTo(h,y):this.flyTo(h,y):this}jumpTo(a,h){this.stop();const y=a.preloadOnly?this.transform.clone():this.transform;let b=!1,T=!1,E=!1;"zoom"in a&&y.zoom!==+a.zoom&&(b=!0,y.zoom=+a.zoom),a.center!==void 0&&(y.center=r.aS.convert(a.center)),"bearing"in a&&y.bearing!==+a.bearing&&(T=!0,y.bearing=+a.bearing),"pitch"in a&&y.pitch!==+a.pitch&&(E=!0,y.pitch=+a.pitch);const P=typeof a.padding=="number"?this._extendPadding(a.padding):a.padding;if(a.padding!=null&&!y.isPaddingEqual(P))if(a.retainPadding===!1){const M=y.clone();M.padding=P,y.setLocationAtPoint(y.center,M.centerPoint)}else y.padding=P;return a.preloadOnly?(this._preloadTiles(y),this):(this.fire(new r.z("movestart",h)).fire(new r.z("move",h)),b&&this.fire(new r.z("zoomstart",h)).fire(new r.z("zoom",h)).fire(new r.z("zoomend",h)),T&&this.fire(new r.z("rotatestart",h)).fire(new r.z("rotate",h)).fire(new r.z("rotateend",h)),E&&this.fire(new r.z("pitchstart",h)).fire(new r.z("pitch",h)).fire(new r.z("pitchend",h)),this.fire(new r.z("moveend",h)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||r.w(Fs),this.transform.getFreeCameraOptions()}setFreeCameraOptions(a,h){const y=this.transform;if(!y.projection.supportsFreeCamera)return r.w(Fs),this;this.stop();const b=y.zoom,T=y.pitch,E=y.bearing;y.setFreeCameraOptions(a);const P=b!==y.zoom,M=T!==y.pitch,L=E!==y.bearing;return this.fire(new r.z("movestart",h)).fire(new r.z("move",h)),P&&this.fire(new r.z("zoomstart",h)).fire(new r.z("zoom",h)).fire(new r.z("zoomend",h)),L&&this.fire(new r.z("rotatestart",h)).fire(new r.z("rotate",h)).fire(new r.z("rotateend",h)),M&&this.fire(new r.z("pitchstart",h)).fire(new r.z("pitch",h)).fire(new r.z("pitchend",h)),this.fire(new r.z("moveend",h)),this}easeTo(a,h){this._stop(!1,a.easeId),((a=Object.assign({offset:[0,0],duration:500,easing:r.eU},a)).animate===!1||this._prefersReducedMotion(a))&&(a.duration=0);const y=this.transform,b=this.getZoom(),T=this.getBearing(),E=this.getPitch(),P=this.getPadding(),M="zoom"in a?+a.zoom:b,L="bearing"in a?this._normalizeBearing(a.bearing,T):T,O="pitch"in a?+a.pitch:E,H=this._extendPadding(a.padding),F=r.P.convert(a.offset);let Z,Y,J;if(y.projection.name==="globe"){const ke=r.ae.fromLngLat(y.center),Ke=F.rotate(-y.angle);ke.x+=Ke.x/y.worldSize,ke.y+=Ke.y/y.worldSize;const $e=ke.toLngLat(),ct=r.aS.convert(a.center||$e);this._normalizeCenter(ct),Z=y.centerPoint.add(Ke),Y=new r.P(ke.x,ke.y).mult(y.worldSize),J=new r.P(r.aF(ct.lng),r.aJ(ct.lat)).mult(y.worldSize).sub(Y)}else{Z=y.centerPoint.add(F);const ke=y.pointLocation(Z),Ke=r.aS.convert(a.center||ke);this._normalizeCenter(Ke),Y=y.project(ke),J=y.project(Ke).sub(Y)}const se=y.zoomScale(M-b);let ne,ae;a.around&&(ne=r.aS.convert(a.around),ae=y.locationPoint(ne));const fe=this._zooming||M!==b,ue=this._rotating||T!==L,Ce=this._pitching||O!==E,me=!y.isPaddingEqual(H),Ie=a.retainPadding===!1?y.clone():y,Se=ke=>Ke=>{if(fe&&(ke.zoom=r.ak(b,M,Ke)),ue&&(ke.bearing=r.ak(T,L,Ke)),Ce&&(ke.pitch=r.ak(E,O,Ke)),me&&(Ie.interpolatePadding(P,H,Ke),Z=Ie.centerPoint.add(F)),ne)ke.setLocationAtPoint(ne,ae);else{const $e=ke.zoomScale(ke.zoom-b),ct=M>b?Math.min(2,se):Math.max(.5,se),it=Math.pow(ct,1-Ke),gt=ke.unproject(Y.add(J.mult(Ke*it)).mult($e));ke.setLocationAtPoint(ke.renderWorldCopies?gt.wrap():gt,Z)}return a.preloadOnly||this._fireMoveEvents(h),ke};if(a.preloadOnly){const ke=this._emulate(Se,a.duration,y);return this._preloadTiles(ke),this}const ve={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=fe,this._rotating=ue,this._pitching=Ce,this._padding=me,this._easeId=a.easeId,this._prepareEase(h,a.noMoveStart,ve),this._ease(Se(y),ke=>{y.cameraElevationReference==="sea"&&y.recenterOnTerrain(),this._afterEase(h,ke)},a),this}_prepareEase(a,h,y={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),h||y.moving||this.fire(new r.z("movestart",a)),this._zooming&&!y.zooming&&this.fire(new r.z("zoomstart",a)),this._rotating&&!y.rotating&&this.fire(new r.z("rotatestart",a)),this._pitching&&!y.pitching&&this.fire(new r.z("pitchstart",a))}_fireMoveEvents(a){this.fire(new r.z("move",a)),this._zooming&&this.fire(new r.z("zoom",a)),this._rotating&&this.fire(new r.z("rotate",a)),this._pitching&&this.fire(new r.z("pitch",a))}_afterEase(a,h){if(this._easeId&&h&&this._easeId===h)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const y=this._zooming,b=this._rotating,T=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,y&&this.fire(new r.z("zoomend",a)),b&&this.fire(new r.z("rotateend",a)),T&&this.fire(new r.z("pitchend",a)),this.fire(new r.z("moveend",a))}flyTo(a,h){if(this._prefersReducedMotion(a)){const nt=r.aH(a,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(nt,h)}this.stop(),a=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:r.eU},a);const y=this.transform,b=this.getZoom(),T=this.getBearing(),E=this.getPitch(),P=this.getPadding(),M="zoom"in a?r.aA(+a.zoom,y.minZoom,y.maxZoom):b,L="bearing"in a?this._normalizeBearing(a.bearing,T):T,O="pitch"in a?+a.pitch:E,H=this._extendPadding(a.padding),F=y.zoomScale(M-b),Z=r.P.convert(a.offset);let Y=y.centerPoint.add(Z);const J=y.pointLocation(Y),se=r.aS.convert(a.center||J);this._normalizeCenter(se);const ne=y.project(J),ae=y.project(se).sub(ne);let fe=a.curve;const ue=Math.max(y.width,y.height),Ce=ue/F,me=ae.mag();if("minZoom"in a){const nt=r.aA(Math.min(a.minZoom,b,M),y.minZoom,y.maxZoom),wt=ue/y.zoomScale(nt-b);fe=Math.sqrt(wt/me*2)}const Ie=fe*fe;function Se(nt){const wt=(Ce*Ce-ue*ue+(nt?-1:1)*Ie*Ie*me*me)/(2*(nt?Ce:ue)*Ie*me);return Math.log(Math.sqrt(wt*wt+1)-wt)}function ve(nt){return(Math.exp(nt)-Math.exp(-nt))/2}function ke(nt){return(Math.exp(nt)+Math.exp(-nt))/2}const Ke=Se(0);let $e=function(nt){return ke(Ke)/ke(Ke+fe*nt)},ct=function(nt){return ue*((ke(Ke)*(ve(wt=Ke+fe*nt)/ke(wt))-ve(Ke))/Ie)/me;var wt},it=(Se(1)-Ke)/fe;if(Math.abs(me)<1e-6||!isFinite(it)){if(Math.abs(ue-Ce)<1e-6)return this.easeTo(a,h);const nt=Ce<ue?-1:1;it=Math.abs(Math.log(Ce/ue))/fe,ct=function(){return 0},$e=function(wt){return Math.exp(nt*fe*wt)}}a.duration="duration"in a?+a.duration:1e3*it/("screenSpeed"in a?+a.screenSpeed/fe:+a.speed),a.maxDuration&&a.duration>a.maxDuration&&(a.duration=0);const gt=T!==L,jt=O!==E,et=!y.isPaddingEqual(H),Oe=a.retainPadding===!1?y.clone():y,yt=nt=>wt=>{const Bt=wt*it,oi=1/$e(Bt);nt.zoom=wt===1?M:b+nt.scaleZoom(oi),gt&&(nt.bearing=r.ak(T,L,wt)),jt&&(nt.pitch=r.ak(E,O,wt)),et&&(Oe.interpolatePadding(P,H,wt),Y=Oe.centerPoint.add(Z));const Mt=wt===1?se:nt.unproject(ne.add(ae.mult(ct(Bt))).mult(oi));return nt.setLocationAtPoint(nt.renderWorldCopies?Mt.wrap():Mt,Y),nt._updateCameraOnTerrain(),a.preloadOnly||this._fireMoveEvents(h),nt};if(a.preloadOnly){const nt=this._emulate(yt,a.duration,y);return this._preloadTiles(nt),this}return this._zooming=!0,this._rotating=gt,this._pitching=jt,this._padding=et,this._prepareEase(h,!1),this._ease(yt(y),()=>this._afterEase(h),a),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(a){}_cancelRenderFrame(a){}_stop(a,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const y=this._onEaseEnd;this._onEaseEnd=void 0,y.call(this,h)}if(!a){const y=this.handlers;y&&y.stop(!1)}return this}_ease(a,h,y){y.animate===!1||y.duration===0?(a(1),h()):(this._easeStart=r.o.now(),this._easeOptions=y,this._onEaseFrame=a,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const a=Math.min((r.o.now()-this._easeStart)/this._easeOptions.duration,1),h=this._onEaseFrame;h&&h(this._easeOptions.easing(a)),a<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(a,h){a=r.bS(a,-180,180);const y=Math.abs(a-h);return Math.abs(a-360-h)<y&&(a-=360),Math.abs(a+360-h)<y&&(a+=360),a}_normalizeCenter(a){const h=this.transform;if(h.maxBounds||h.projection.name!=="globe"&&!h.renderWorldCopies)return;const y=a.lng-h.center.lng;a.lng+=y>180?-360:y<-180?360:0}_prefersReducedMotion(a){return this._respectPrefersReducedMotion&&r.o.prefersReducedMotion&&!(a&&a.essential)}_emulate(a,h,y){const b=Math.ceil(15*h/1e3),T=[],E=a(y.clone());for(let P=0;P<=b;P++){const M=E(P/b);T.push(M.clone())}return T}_preloadTiles(a,h){}}class Xf{constructor(a={}){this.options=a,r.aX(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(a){const h=this.options&&this.options.compact,y=a._getUIString("AttributionControl.ToggleAttribution");this._map=a,this._container=B("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=B("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",y);const b=B("span","mapboxgl-ctrl-icon",this._compactButton);return b.setAttribute("aria-hidden","true"),b.setAttribute("title",y),this._innerContainer=B("div","mapboxgl-ctrl-attrib-inner",this._container),h&&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),h===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","fal
3704se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let a=this._editLink;a||(a=this._editLink=this._container.querySelector(".mapbox-improve-map"));const h=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||r.e.ACCESS_TOKEN}];if(a){const y=h.reduce((b,T,E)=>(T.value&&(b+=`${T.key}=${T.value}${E<h.length-1?"&":""}`),b),"?");a.href=`${r.e.FEEDBACK_URL}/${y}#${ax(this._map,!0)}`,a.rel="noopener nofollow"}}_updateData(a){!a||(a.dataType!=="source"||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility")&&a.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let a=[];if(this._map.style.stylesheet){const b=this._map.style.stylesheet;this.styleOwner=b.owner,this.styleId=b.id}const h=this._map.style._mergedSourceCaches;for(const b in h){const T=h[b];if(T.used){const E=T.getSource();E.attribution&&a.indexOf(E.attribution)<0&&a.push(E.attribution)}}a.sort((b,T)=>b.length-T.length),a=a.filter((b,T)=>{for(let E=T+1;E<a.length;E++)if(a[E].indexOf(b)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a]:a.unshift(this.options.customAttribution));const y=a.join(" | ");y!==this._attribHTML&&(this._attribHTML=y,a.length?(this._innerContainer.innerHTML=y,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 Py{constructor(){r.aX(["_updateLogo","_updateCompact"],this)}onAdd(a){this._map=a,this._container=B("div","mapboxgl-ctrl");const h=B("a","mapboxgl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://www.mapbox.com/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),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(a){a&&a.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(Object.entries(a).length===0)return!0;for(const h in a){const y=a[h].getSource();if(y.hasOwnProperty("mapbox_logo")&&!y.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const h=a[0];this._map.getCanvasContainer().offsetWidth<250?h.classList.add("mapboxgl-compact"):h.classList.remove("mapboxgl-compact")}}}class ww{constructor(){r.aX(["_onIndoorUpdate"],this)}onAdd(a){return this._map=a,this._container=B("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",h=>this._onIndoorUpdate(h)),this._container}_createButton(a,h){const y=B("button",a,this._container);return y.type="button",y.addEventListener("click",h),y}_createSeparator(){return B("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(a,h){this._map&&(a.setAttribute("aria-label",h),a.textContent=h)}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(a){if(!a||!a.floors)return this._model=a,void(this._container.style.display="none");const h=this._model;this._model=a,this._container.style.display="inline-block",this._container.style.borderRadius="8px",h&&Array.from(this._container.children).forEach(y=>y.remove()),a.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(a.floors,a.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const a=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const h=this._map;this._model&&h&&h._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});B("span","mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&a.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(a),this._createSeparator()}_updateBuildingsButtonState(){const a=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");a&&this._model&&(this._model.activeFloorsVisible?a.classList.remove("mapboxgl-ctrl-level-button-selected"):a.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(a,h){for(let y=0;y<a.length;y++){const b=a[y],T=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(b.id)});this._setButtonTitle(T,b.zIndex.toString()),this._model&&b.id===this._model.selectedFloorId&&h&&T.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(T),y<a.length-1&&this._createSeparator()}}}class M2{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const h=++this._id;return this._queue.push({callback:a,id:h,cancelled:!1}),h}remove(a){const h=this._currentlyRunning,y=h?this._queue.concat(h):this._queue;
vendor: 21,493 bytes, lines 3704-3709
3704for(const b of y)if(b.id===a)return void(b.cancelled=!0)}run(a=0){const h=this._currentlyRunning=this._queue;this._queue=[];for(const y of h)if(!y.cancelled&&(y.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Ny{constructor(a){this.jumpTo(a)}getValue(a){if(a<=this._startTime)return this._start;if(a>=this._endTime)return this._end;const h=r.dC((a-this._startTime)/(this._endTime-this._startTime));return this._start*(1-h)+this._end*h}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(a,h,y){this._start=this.getValue(h),this._end=a,this._startTime=h,this._endTime=h+y}}const ED={"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 D2 extends r.z{constructor(a,h,y,b){const{point:T,lngLat:E,originalEvent:P,target:M}=a;super(a.type,{point:T,lngLat:E,originalEvent:P,target:M}),this.preventDefault=()=>{a.preventDefault()},this.id=h,this.interaction=y,this.feature=b}}class Sw{constructor(a){this.map=a,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(a,h){if(this.typeById.has(a))throw new Error(`Interaction id "${a}" already exists.`);const y=h.filter;let b=h.type;y&&this.filters.set(a,r.b5(y)),b==="mouseover"&&(b="mouseenter"),b==="mouseout"&&(b="mouseleave");const T=this.interactionsByType.get(b)||new Map;b==="mouseenter"||b==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(a,h)):T.size===0&&this.map.on(b,this.handleType),T.size===0&&this.interactionsByType.set(b,T),T.set(a,h),this.typeById.set(a,b)}get(a){const h=this.typeById.get(a);if(!h)return;const y=this.interactionsByType.get(h);return y?y.get(a):void 0}remove(a){const h=this.typeById.get(a);if(!h)return;this.typeById.delete(a),this.filters.delete(a);const y=this.interactionsByType.get(h);y&&(y.delete(a),h==="mouseenter"||h==="mouseleave"?(this.delegatedInteractions.delete(a),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):y.size===0&&this.map.off(h,this.handleType))}queryTargets(a,h){const y=[];for(const[b,T]of h)T.target&&y.push({targetId:b,target:T.target,filter:this.filters.get(b)});return this.map.style.queryRenderedTargets(a,y,this.map.transform)}handleMove(a){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const h=this.queryTargets(a.point,Array.from(this.delegatedInteractions).reverse());h.length&&(a.type="mouseenter",this.handleType(a,h));const y=new Map;for(const[b,{feature:T}]of this.prevHoveredFeatures)this.hoveredFeatures.has(b)||y.set(T.id,T);y.size&&(a.type="mouseleave",this.handleType(a,Array.from(y.values())))}handleOut(a){const h=Array.from(this.hoveredFeatures.values()).map(({feature:y})=>y);h.length&&(a.type="mouseleave",this.handleType(a,h)),this.hoveredFeatures.clear()}handleType(a,h){const y=a.type==="mouseenter";if(y&&!this.interactionsByType.has(a.type))return void r.w("mouseenter interaction required for mouseleave to work.");const b=Array.from(this.interactionsByType.get(a.type)).reverse(),T=!!h;h=h||this.queryTargets(a.point,b);let E=!1;const P=new Set;for(const M of h){for(const[L,O]of b){if(!O.target)continue;const H=M.variants?M.variants[L]:null;if(H){for(const F of H){if(hl(F,M,P,L))continue;const Z=new r.dw(M,F),Y=$c(F,M,L);T&&Z.id!==void 0&&(Z.state=this.map.getFeatureState(Z));const J=y?this.prevHoveredFeatures.get(Y):null,se=new D2(a,L,O,Z),ne=J?J.stop:O.handler(se);if(y&&this.hoveredFeatures.set(Y,{feature:M,stop:ne}),ne!==!1){E=!0;break}}if(E)break}}if(E)break}if(!E)for(const[M,L]of b){const{handler:O,target:H}=L;if(!H&&O(new D2(a,M,L,null))!==!1)break}}}function Tw(g,a){if(Array.isArray(g)&&Array.isArray(a)){const h=new Set(g),y=new Set(a);return h.size===y.size&&g.every(b=>y.has(b))}return r.bx(g,a)}const gx={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"},yx={showCompass:!0,showZoom:!0,visualizePitch:!1};class My{constructor(a,h,y=!1){this._clickTolerance=10,this.element=h,this.mouseRotate=new dx({clickTolerance:a.dragRotate._mouseRotate._clickTolerance}),this.map=a,y&&(this.mousePitch=new _w({clickTolerance:a.dragRotate._mousePitch._clickTolerance})),r.aX(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),h.addEventListener("mousedown",this.mousedown),h.addEventListener("touchstart",this.touchstart,{passive:!1}),h.addEventListener("touchmove",this.touchmove),h.addEventListener("touchend",this.touchend),h.addEventListener("touchcancel",this.reset)}down(a,h){this.mouseRotate.mousedown(a,h),this.mousePitch&&this.mousePitch.mousedown(a,h),ce()}move(a,h){const y=this.map,b=this.mouseRotate.mousemoveWindow(a,h),T=b&&b.bearingDelta;if(T&&y.setBearing(y.getBearing()+T),this.mousePitch){const E=this.mousePitch.mousemoveWindow(a,h),P=E&&E.pitchDelta;P&&y.setPitch(y.getPitch()+P)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){_e(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(a){this.down(Object.assign({},a,{ctrlKey:!0,preventDefault:()=>a.preventDefault()}),Ne(this.element,a)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,Ne(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){a.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=pe(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){a.targetTouches.length!==1?this.reset():(this._lastPos=pe(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){a.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 td(g,a,h){if(g=new r.aS(g.lng,g.lat),a){const y=new r.aS(g.lng-360,g.lat),b=new r.aS(g.lng+360,g.lat),T=360*Math.ceil(Math.abs(g.lng-h.center.lng)/360),E=h.locationPoint3D(g).distSqr(a),P=a.x<0||a.y<0||a.x>h.width||a.y>h.height;h.locationPoint3D(y).distSqr(a)<E&&(P||Math.abs(y.lng-h.center.lng)<T)?g=y:h.locationPoint3D(b).distSqr(a)<E&&(P||Math.abs(b.lng-h.center.lng)<T)&&(g=b)}for(;Math.abs(g.lng-h.center.lng)>180;){const y=h.locationPoint3D(g);if(y.x>=0&&y.y>=0&&y.x<=h.width&&y.y<=h.height)break;g.lng>h.center.lng?g.lng-=360:g.lng+=360}return g}const Hc={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%)"},ra={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class id extends r.E{constructor(a,h){super(),(a instanceof HTMLElement||h)&&(a=Object.assign({element:a},h)),r.aX(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:y="center",color:b="#3FB1CE",scale:T=1,draggable:E=!1,clickTolerance:P=0,rotation:M=ra.rotation,rotationAlignment:L=ra.rotationAlignment,pitchAlignment:O=ra.pitchAlignment,occludedOpacity:H=ra.occludedOpacity,altitude:F=ra.altitude}=a||{};this._anchor=y,this._color=b,this._scale=T,this._draggable=E,this._clickTolerance=P,this._rotation=M,this._rotationAlignment=L,this._pitchAlignment=O,this._occludedOpacity=H,this._altitude=F,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),a&&a.element?(this._element=a.element,this._offset=r.P.convert(a&&a.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=r.P.convert(a&&a.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",J=>{J.preventDefault()}),this._element.addEventListener("mousedown",J=>{J.preventDefault()});const Z=this._element.classList;for(const J in Hc)Z.remove(`mapboxgl-marker-anchor-${J}`);Z.add(`mapboxgl-marker-anchor-${this._anchor}`);const Y=a&&a.className?a.className.trim().split(/\s+/):[];Z.add(...Y),this._popup=null}_createDefaultMarker(){const a=B("div"),h=W("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},a);if(this._altitude===0){const y=W("radialGradient",{id:"shadowGradient"},W("defs",{},h));W("stop",{offset:"10%","stop-opacity":.4},y),W("stop",{offset:"100%","stop-opacity":.05},y),W("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},h)}return W("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"},h),W("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"},h),W("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},h),a}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),a.on("click",this._onMapClick)),this}remove(){const a=this._map;return a&&(a.off("click",this._onMapClick),a.off("move",this._updateMoving),a.off("moveend",this._update),a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler),a.off("mouseup",this._onUp),a.off("touchend",this._onUp),a.off("mousemove",this._onMove),a.off("touchmove",this._onMove),a.off("remove",this._clearFadeTimer),a._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=r.aS.convert(a),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(a){return a===this._altitude||(this._defaultMarker&&(this._altitude===0&&a!==0||this._altitude!==0&&a===0)&&(this._element=this._createDefaultMarker()),this._altitude=a||ra.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(a){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")),a){if(!("offset"in a.options)){const b=Math.sqrt(Math.pow(13.5,2)/2);a.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[b,-1*(38.1-13.5+b)],"bottom-right":[-b,-1*(38.1-13.5+b)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=a,a._marker=this,a._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(a){const h=a.code,y=a.charCode||a.keyCode;h!=="Space"&&h!=="Enter"&&y!==32&&y!==13||this.togglePopup()}_onMapClick(a){const h=a.originalEvent.target,y=this._element;this._popup&&(h===y||y.contains(h))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a?(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(a.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const a=this._map,h=this._pos;if(!a||!h)return!1;const y=a.unproject(h,this._altitude),b=a.getFreeCameraOptions();if(!b.position)return!1;const T=b.position.toLngLat();return T.distanceTo(y)<.9*T.distanceTo(this._lngLat)}_evaluateOpacity(){const a=this._map;if(!a)return;const h=this._pos;if(!h||h.x<0||h.x>a.transform.width||h.y<0||h.y>a.transform.height)return void this._clearFadeTimer();const y=a.unproject(h,this._altitude);let b;a._showingGlobe()&&r.f4(a.transform,this._lngLat)?b=0:(b=1-a._queryFogOpacity(y),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(b*=this._occludedOpacity)),this._element.style.opacity=`${b}`,this._element.style.pointerEvents=b>0?"auto":"none",this._popup&&this._popup._setOpacity(b),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const a=this._pos;if(!a||!this._map)return;const h=this._offset.mult(this._scale);this._element.style.transform=` 3705 translate(${a.x}px,${a.y}px) 3706 ${Hc[this._anchor]} 3707 ${this._calculateXYTransform()} ${this._calculateZTransform()} 3708 translate(${h.x}px,${h.y}px) 3709 `}_calculateXYTransform(){const a=this._pos,h=this._map,y=this.getPitchAlignment();if(!h||!a||y!=="map")return"";if(!h._showingGlobe()){const M=h.getPitch();return M?`rotateX(${M}deg)`:""}const b=r.cW(r.f5(h.transform,this._lngLat)),T=a.sub(r.f6(h.transform)),E=Math.abs(T.x)+Math.abs(T.y);if(E===0)return"";const P=b/E;return`rotateX(${-T.y*P}deg) rotateY(${T.x*P}deg)`}_calculateZTransform(){const a=this._pos,h=this._map;if(!h||!a)return"";let y=0;const b=this.getRotationAlignment();if(b==="map")if(h._showingGlobe()){const T=h.project(new r.aS(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),E=h.project(new r.aS(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(T);y=r.cW(Math.atan2(E.y,E.x))-90}else y=-h.getBearing();else if(b==="horizon"){const T=r.ah(4,6,h.getZoom()),E=r.f6(h.transform);E.y+=T*h.transform.height;const P=a.sub(E),M=r.cW(Math.atan2(P.y,P.x));y=(M>90?M-270:M+90)*(1-T)}return y+=this._rotation,y?`rotateZ(${y}deg)`:""}_update(a){cancelAnimationFrame(this._updateFrameId);const h=this._map;h&&(h.transform.renderWorldCopies&&(this._lngLat=td(this._lngLat,this._pos,h.transform)),this._pos=h.project(this._lngLat,this._altitude),a===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),h._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(h._showingGlobe()||h.getTerrain()||h.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(a){return this._offset=r.P.convert(a),this._update(),this}addClassName(a){return this._element.classList.add(a),this}removeClassName(a){return this._element.classList.remove(a),this}toggleClassName(a){return this._element.classList.toggle(a)}_onMove(a){const h=this._map;if(!h)return;const y=this._pointerdownPos,b=this._positionDelta;if(y&&b){if(!this._isDragging){const T=this._clickTolerance||h._clickTolerance;if(a.point.dist(y)<T)return;this._isDragging=!0}this._pos=a.point.sub(b),this._lngLat=h.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new r.z("dragstart"))),this.fire(new r.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const a=this._map;a&&(a.off("mousemove",this._onMove),a.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new r.z("dragend")),this._state="inactive"}_addDragHandler(a){const h=this._map,y=this._pos;h&&y&&this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(y),this._pointerdownPos=a.point,this._state="pending",h.on("mousemove",this._onMove),h.on("touchmove",this._onMove),h.once("mouseup",this._onUp),h.once("touchend",this._onUp))}setDraggable(a){this._draggable=!!a;const h=this._map;return h&&(a?(h.on("mousedown",this._addDragHandler),h.on("touchstart",this._addDragHandler)):(h.off("mousedown",this._addDragHandler),h.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||ra.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||ra.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a||ra.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(a){return this._occludedOpacity=a||ra.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Gc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},AD={maxWidth:100,unit:"metric"},ID={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},kD={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},PD=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Cw(g=new r.P(0,0),a="bottom"){if(typeof g=="number"){const h=Math.round(Math.sqrt(.5*Math.pow(g,2)));switch(a){case"top":return new r.P(0,g);case"top-left":return new r.P(h,h);case"top-right":return new r.P(-h,h);case"bottom":return new r.P(0,-g);case"bottom-left":return new r.P(h,-h);case"bottom-right":return new r.P(-h,-h);case"left":return new r.P(g,0);case"right":return new r.P(-g,0)}return new r.P(0,0)}return g instanceof r.P||Array.isArray(g)?r.P.convert(g):r.P.convert(g[a]||[0,0])}return{version:x,supported:V.supported,setRTLTextPlugin:r.fa,getRTLTextPluginStatus:r.f9,Map:class extends vu{constructor(g){C.mark(S.create);const a=g;if((g=Object.assign({},gx,g)).minZoom!=null&&g.maxZoom!=null&&g.minZoom>g.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(g.minPitch!=null&&g.maxPitch!=null&&g.minPitch>g.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(g.minPitch!=null&&g.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(g.maxPitch!=null&&g.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(g.antialias&&r.f2(window)&&(g.antialias=!1,r.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Sf(g.minZoom,g.maxZoom,g.minPitch,g.maxPitch,g.renderWorldCopies,null,null),g),this._repaint=!!g.repaint,this._interactive=g.interactive,this._minTileCacheSize=g.minTileCacheSize,this._maxTileC
3709acheSize=g.maxTileCacheSize,this._failIfMajorPerformanceCaveat=g.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=g.preserveDrawingBuffer,this._antialias=g.antialias,this._trackResize=g.trackResize,this._bearingSnap=g.bearingSnap,this._refreshExpiredTiles=g.refreshExpiredTiles,this._fadeDuration=g.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=g.crossSourceCollisions,this._collectResourceTiming=g.collectResourceTiming,this._language=this._parseLanguage(g.language),this._worldview=g.worldview,this._renderTaskQueue=new M2,this._domRenderTaskQueue=new M2,this._controls=[],this._markers=[],this._popups=[],this._mapId=r.b1(),this._locale=Object.assign({},ED,g.locale),this._clickTolerance=g.clickTolerance,this._cooperativeGestures=g.cooperativeGestures,this._performanceMetricsCollection=g.performanceMetricsCollection,this._tessellationStep=g.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=g.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ny(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=g.scaleFactor,this._requestManager=new At(g.transformRequest,g.accessToken,g.testMode),this._silenceAuthErrors=!!g.testMode,this._contextCreateOptions=g.contextCreateOptions?Object.assign({},g.contextCreateOptions):{},typeof g.container=="string"){const h=document.getElementById(g.container);if(!h)throw new Error(`Container '${g.container.toString()}' not found.`);this._container=h}else{if(!(g.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=g.container}if(this._container.childNodes.length>0&&r.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."),g.maxBounds&&this.setMaxBounds(g.maxBounds),this._spriteFormat=g.spriteFormat,r.aX(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new vD),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),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 mx(this,g),this._localFontFamily=g.localFontFamily,this._localIdeographFontFamily=g.localIdeographFontFamily,(g.style||!g.testMode)&&this.setStyle(g.style||r.e.DEFAULT_STYLE,{config:g.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),g.projection&&this.setProjection(g.projection),g.hash&&(this._hash=new ox(typeof g.hash=="string"&&g.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){a.center==null&&a.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch});const h=g.bounds;h&&(this.resize(),this.fitBounds(h,Object.assign({},g.fitBoundsOptions,{duration:0})))}this.resize(),g.attributionControl&&this.addControl(new Xf({customAttribution:g.customAttribution}
vendor: 9,380 bytes, line 3709
3709)),this._logoControl=new Py,this.addControl(this._logoControl,g.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",h=>{this._update(h.dataType==="style"),this.fire(new r.z(`${h.dataType}data`,h))}),this.on("dataloading",h=>{this.fire(new r.z(`${h.dataType}dataloading`,h))}),this._interactions=new Sw(this)}_getMapId(){return this._mapId}addControl(g,a){if(a===void 0&&(a=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g||!g.onAdd)return this.fire(new r.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=g.onAdd(this);this._controls.push(g);const y=this._controlPositions[a];return a.indexOf("bottom")!==-1?y.insertBefore(h,y.firstChild):y.appendChild(h),this}removeControl(g){if(!g||!g.onRemove)return this.fire(new r.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const a=this._controls.indexOf(g);return a>-1&&this._controls.splice(a,1),g.onRemove(this),this}hasControl(g){return this._controls.indexOf(g)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(g){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 a=!this._moving;return a&&this.fire(new r.z("movestart",g)).fire(new r.z("move",g)),this.fire(new r.z("resize",g)),a&&this.fire(new r.z("moveend",g)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(g){return this.transform.setMaxBounds(r.aI.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom)return this.transform.minZoom=g,this._update(),this.getZoom()<g?this.setZoom(g):this.fire(new r.z("zoomstart")).fire(new r.z("zoom")).fire(new r.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(g){if((g=g??22)>=this.transform.minZoom)return this.transform.maxZoom=g,this._update(),this.getZoom()>g?this.setZoom(g):this.fire(new r.z("zoomstart")).fire(new r.z("zoom")).fire(new r.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch)return this.transform.minPitch=g,this._update(),this.getPitch()<g?this.setPitch(g):this.fire(new r.z("pitchstart")).fire(new r.z("pitch")).fire(new r.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(g){if((g=g??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(g>=this.transform.minPitch)return this.transform.maxPitch=g,this._update(),this.getPitch()>g?this.setPitch(g):this.fire(new r.z("pitchstart")).fire(new r.z("pitch")).fire(new r.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(g){return this._scaleFactor=g,this.painter.scaleFactor=g,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(a=>a.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.renderWorldCopies=g,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(g){return g==="auto"?navigator.language:Array.isArray(g)?g.length===0?void 0:g.map(a=>a==="auto"?navigator.language:a):g}setLanguage(g){const a=this._parseLanguage(g);if(!this.style||a===this._language)return this;this._language=a,this.style.reloadSources();for(const h of this._controls)h._setLanguage&&h._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(g){return this.style&&g!==this._worldview?(this._worldview=g,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(g){return this._lazyInitEmptyStyle(),g?typeof g=="string"&&(g={name:g}):g=null,this._useExplicitProjection=!!g,this._prioritizeAndUpdateProjection(g,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const g=this.transform,a=g.projection.name;let h;a==="globe"&&g.zoom>=r.cK?(g.setMercatorFromTransition(),h=!0):a==="mercator"&&g.zoom<r.cK&&(g.setProjection({name:"globe"}),h=!0),h&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(g,a){return this._updateProjection(g||a||{name:"mercator"})}_updateProjection(g){let a;const h=this.transform.mercatorFromTransition;a=g.name==="globe"&&this.transform.zoom>=r.cK?this.transform.setMercatorFromTransition():this.transform.setProjection(g),this.style.applyProjectionUpdate();const y=this.transform.getProjection().name==="mercator"&&h!==this.transform.mercatorFromTransition;return(a||y)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(g,a){return this.transform.locationPoint3D(r.aS.convert(g),a)}unproject(g,a){return this.transform.pointLocation3D(r.P.convert(g),a)}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(g,a,h){const y=b=>{let T=[];if(Array.isArray(a)){const E=a.filter(P=>this.getLayer(P));T=E.length?this.queryRenderedFeatures(b,{layers:E}):[]}else T=this.queryRenderedFeatures(b,{target:a});return T};if(g==="mouseenter"||g==="mouseover"){let b=!1;return{listener:h,targets:a,delegates:{mousemove:E=>{const P=y(E.point);P.length?b||(b=!0,h.call(this,new Xr(g,this,E.originalEvent,{features:P}))):b=!1},mouseout:()=>{b=!1}}}}if(g==="mouseleave"||g==="mouseout"){let b=!1;return{listener:h,targets:a,delegates:{mousemove:P=>{y(P.point).length?b=!0:b&&(b=!1,h.call(this,new Xr(g,this,P.originalEvent)))},mouseout:P=>{b&&(b=!1,h.call(this,new Xr(g,this,P.originalEvent)))}}}}{const b=T=>{const E=y(T.point);E.length&&(T.features=E,h.call(this,T),delete T.features)};return{listener:h,targets:a,delegates:{[g]:b}}}}on(g,a,h){if(typeof a=="function"||h===void 0)return super.on(g,a);if(typeof a=="string"&&(a=[a]),!this._areTargetsValid(a))return this;const y=this._createDelegatedListener(g,a,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[g]=this._delegatedListeners[g]||[],this._delegatedListeners[g].push(y);for(const b in y.delegates)this.on(b,y.delegates[b]);return this}once(g,a,h){if(typeof a=="function"||h===void 0)return super.once(g,a);if(typeof a=="string"&&(a=[a]),!this._areTargetsValid(a))return this;const y=this._createDelegatedListener(g,a,h);for(const b in y.delegates)this.once(b,y.delegates[b]);return this}off(g,a,h){if(typeof a=="function"||h===void 0)return super.off(g,a);if(typeof a=="string"&&(a=[a]),!this._areTargetsValid(a))return this;const y=this._delegatedListeners?this._delegatedListeners[g]:void 0;return y&&(b=>{for(let T=0;T<b.length;T++){const E=b[T];if(E.listener===h&&Tw(E.targets,a)){for(const P in E.delegates)this.off(P,E.delegates[P]);return b.splice(T,1),this}}})(y),this}queryRenderedFeatures(g,a){if(!this.style)return[];if(g===void 0||g instanceof r.P||Array.isArray(g)||a!==void 0||(a=g,g=void 0),g=g||[[0,0],[this.transform.width,this.transform.height]],!a){const T=this.style.queryRenderedFeatures(g,void 0,this.transform),E=this.style.queryRenderedFeatureset(g,void 0,this.transform);return T.concat(E)}let h=!0;if(a.target&&(h=this._isTargetValid(a.target),h&&!a.layers))return this.style.queryRenderedFeatureset(g,a,this.transform);let y=!0;if(a.layers&&Array.isArray(a.layers)){for(const T of a.layers)if(!this._isValidId(T)){y=!1;break}if(y&&!a.target)return this.style.queryRenderedFeatures(g,a,this.transform)}let b=[];return y&&(b=b.concat(this.style.queryRenderedFeatures(g,a,this.transform))),h&&(b=b.concat(this.style.queryRenderedFeatureset(g,a,this.transform))),b}querySourceFeatures(g,a){return!g||typeof g=="string"&&!this._isValidId(g)?[]:this.style.querySourceFeatures(g,a)}queryRasterValue(g,a,h){return this._isValidId(g)?this.style.queryRasterValue(g,a,h):Promise.resolve(null)}isPointOnSurface(g){const{name:a}=this.transform.projection;return a!=="globe"&&a!=="mercator"&&r.w(`${a} projection does not support isPointOnSurface, this API may behave unex
3709pectedly.`),this.transform.isPointOnSurface(r.P.convert(g))}addInteraction(g,a){return this._interactions.add(g,a),this}removeInteraction(g){return this._interactions.remove(g),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(g){return this._cooperativeGestures=g,this}setStyle(g,a){return a=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},a),this.style&&g&&a.diff!==!1&&a.localFontFamily===this._localFontFamily&&a.localIdeographFontFamily===this._localIdeographFontFamily&&!a.config?(this.style._diffStyle(g,(h,y)=>{if(h){const b=typeof h=="string"?h:h instanceof Error?h.message:h.error;r.w(`Unable to perform style diff: ${b}. Rebuilding the style from scratch.`),this._updateStyle(g,a)}else y&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._updateStyle(g,a))}_getUIString(g){const a=this._locale[g];if(a==null)throw new Error(`Missing UI string '${g}'`);return a}_updateStyle(g,a){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),g){const h=Object.assign({},a);a&&a.config&&(h.initialConfig=a.config,delete h.config),this.style=new xc(this,h).load(g),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new xc(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():(r.w("There is no style added to the map."),!1)}_isValidId(g){return g==null?(this.fire(new r.y(new Error("IDs can't be empty."))),!1):!r.dq(g)||(this.fire(new r.y(new Error(`IDs can't contain special symbols: "${g}".`))),!1)}_isTargetValid(g){return"featuresetId"in g?this._isValidId("importId"in g?g.importId:g.featuresetId):"layerId"in g&&this._isValidId(g.layerId)}_areTargetsValid(g){if(Array.isArray(g)){for(const a of g)if(!this._isValidId(a))return!1;return!0}return this._isTargetValid(g)}addSource(g,a){return this._isValidId(g)?(this._lazyInitEmptyStyle(),this.style.addSource(g,a),this._update(!0)):this}isSourceLoaded(g){return!!this._isValidId(g)&&!!this.style&&this.style._isSourceCacheLoaded(g)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(g,a,h){this._lazyInitEmptyStyle(),this.style.addSourceType(g,a,h)}removeSource(g){return this._isValidId(g)?(this.style.removeSource(g),this._updateTerrain(),this._update(!0)):this}getSource(g){return this._isValidId(g)?this.style.getOwnSource(g):null}addImage(g,a,{pixelRatio:h=1,sdf:y=!1,stretchX:b,stretchY:T,content:E}={}){this._lazyInitEmptyStyle();const P=r.I.from(g);if(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap){const{width:M,height:L,data:O}=r.o.getImageData(a);this.style.addImage(P,{data:new r.q({width:M,height:L},O),pixelRatio:h,stretchX:b,stretchY:T,content:E,sdf:y,version:0,usvg:!1})}else if(a.width===void 0||a.height===void 0)this.fire(new r.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:M,height:L}=a,O=a;this.style.addImage(P,{data:new r.q({width:M,height:L},new Uint8Array(O.data)),pixelRatio:h,stretchX:b,stretchY:T,content:E,sdf:y,usvg:!1,version:0,userImage:O}),O.onAdd&&O.onAdd(this,g)}}updateImage(g,a){this._lazyInitEmptyStyle();const h=r.I.from(g),y=this.style.getImage(h);if(!y)return void this.fire(new r.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const b=a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap?r.o.getImageData(a):a,{width:T,height:E,data:P}=b;if(T===void 0||E===void 0)return void this.fire(new r.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(T!==(y.usvg?y.icon.usvg_tree.width:y.data.width)||E!==(y.usvg?y.icon.usvg_tree.height:y.data.height))return void this.fire(new r.y(new Error(`The width and height of the updated image (${T}, ${E}) 3710 must be that same as the previous version of the image 3711 (${y.data.width}, ${y.data.height})`)));const M=!(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap);let L=!1;y.usvg?(y.data=new r.q({width:T,height:E},new Uint8Array(P)),y.usvg=!1,y.icon=void 0,L=!0):y.data.replace(P,M),this.style.updateImage(h,y,L)}hasImage(g){return g?!!this.style&&!!this.style.getImage(r.I.from(g)):(this.fire(new r.y(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(r.I.from(g))}loadImage(g,a){r.n(this._requestManager.transformRequest(g,r.R.Image),(h,y)=>{a(h,y instanceof HTMLImageElement?r.o.getImageData(y):y)})}listImages(){return this.style.listImages().map(g=>g.name)}addModel(g,a){this._lazyInitEmptyStyle(),this.style.addModel(g,a)}hasModel(g){return g?this.style.hasModel(g):(this.fire(new r.y(new Error("Missing required model id"))),!1)}removeModel(g){this.style.removeModel(g)}listModels(){return this.style.listModels()}addLayer(g,a){return this._isValidId(g.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(g,a),this._update(!0)):this}getSlot(g){const a=this.getLayer(g);return a&&a.slot||null}setSlot(g,a){return this.style.setSlot(g,a),this.style.mergeLayers(),this._update(!0)}
vendor: 22,277 bytes, line 3711
3711addImport(g,a){return this.style.addImport(g,a).catch(h=>this.fire(new r.y(new Error("Failed to add import",h)))),this}updateImport(g,a){return typeof a!="string"&&a.id!==g?(this.removeImport(g),this.addImport(a)):(this.style.updateImport(g,a),this._update(!0))}removeImport(g){return this.style.removeImport(g),this}moveImport(g,a){return this.style.moveImport(g,a),this._update(!0)}moveLayer(g,a){return this._isValidId(g)?(this.style.moveLayer(g,a),this._update(!0)):this}removeLayer(g){return this._isValidId(g)?(this.style.removeLayer(g),this._update(!0)):this}getLayer(g){if(!this._isValidId(g))return null;const a=this.style.getOwnLayer(g);return a?a.type==="custom"?a.implementation:a.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(g,a,h){return this._isValidId(g)?(this.style.setLayerZoomRange(g,a,h),this._update(!0)):this}setFilter(g,a,h={}){return this._isValidId(g)?(this.style.setFilter(g,a,h),this._update(!0)):this}getFilter(g){return this._isValidId(g)?this.style.getFilter(g):null}setPaintProperty(g,a,h,y={}){return this._isValidId(g)?(this.style.setPaintProperty(g,a,h,y),this._update(!0)):this}getPaintProperty(g,a){return this._isValidId(g)?this.style.getPaintProperty(g,a):null}setLayoutProperty(g,a,h,y={}){return this._isValidId(g)?(this.style.setLayoutProperty(g,a,h,y),this._update(!0)):this}getLayoutProperty(g,a){return this._isValidId(g)?this.style.getLayoutProperty(g,a):null}setLayerProperty(g,a,h,y={}){return this._isValidId(g)?(this.style.setLayerProperty(g,a,h,y),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(g){return this.style.setGlyphsUrl(g),this._update(!0)}getSchema(g){return this.style.getSchema(g)}setSchema(g,a){return this.style.setSchema(g,a),this._update(!0)}getConfig(g){return this.style.getConfig(g)}setConfig(g,a){return this.style.setConfig(g,a),this._update(!0)}getConfigProperty(g,a){return this.style.getConfigProperty(g,a)}setConfigProperty(g,a,h){return this.style.setConfigProperty(g,a,h),this._update(!0)}getFeaturesetDescriptors(g){return this.style.getFeaturesetDescriptors(g)}setLights(g){if(this._lazyInitEmptyStyle(),g&&g.length===1&&g[0].type==="flat"){const a=g[0];a.properties?this.style.setFlatLight(a.properties,a.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(g),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const g=this.style.getLights()||[];return g.length===0&&g.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),g}setLight(g,a={}){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:g}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(g){return this._lazyInitEmptyStyle(),!g&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(g),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(g){return this._lazyInitEmptyStyle(),this.style.setFog(g),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(g){return this._lazyInitEmptyStyle(),this.style.setSnow(g),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(g){return this._lazyInitEmptyStyle(),this.style.setRain(g),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(g){return this._lazyInitEmptyStyle(),this.style.setColorTheme(g),this._update(!0)}setImportColorTheme(g,a){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(g,a),this._update(!0)}setCamera(g){return this.style.setCamera(g),this._triggerCameraUpdate(g)}_triggerCameraUpdate(g){return this._update(this.transform.setOrthographicProjectionAtLowPitch(g["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(g){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(r.aS.convert(g),this.transform):0}setFeatureState(g,a){return g.source&&!this._isValidId(g.source)?this:(this.style.setFeatureState(g,a),this._update())}removeFeatureState(g,a){return g.source&&!this._isValidId(g.source)?this:(this.style.removeFeatureState(g,a),this._update())}getFeatureState(g){return g.source&&!this._isValidId(g.source)?null:this.style.getFeatureState(g)}_selectIndoorFloor(g){this.indoor.selectFloor(g)}_setIndoorActiveFloorsVisibility(g){this.indoor.setActiveFloorsVisibility(g)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new ww),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const g=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300;let h,y,b,T=this._container;for(;T&&(!y||!b);){const E=window.getComputedStyle(T).transform;E&&E!=="none"&&(h=E.match(/matrix.*\((.+)\)/)[1].split(", "),h[0]&&h[0]!=="0"&&h[0]!=="1"&&(y=h[0]),h[3]&&h[3]!=="0"&&h[3]!=="1"&&(b=h[3])),T=T.parentElement}this._containerWidth=y?Math.abs(g/y):g,this._containerHeight=b?Math.abs(a/b):a}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&r.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 ap(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 g=this._container;g.classList.add("mapboxgl-map"),(this._missingCSSCanary=B("div","mapboxgl-canary",g)).style.visibility="hidden",this._detectMissingCSS();const a=this._canvasContainer=B("div","mapboxgl-canvas-container",g);this._canvas=B("canvas","mapboxgl-canvas",a),this._interactive&&(a.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 h=this._controlContainer=B("div","mapboxgl-control-container",g),y=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(b=>{y[b]=B("div",`mapboxgl-ctrl-${b}`,h)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(g,a){const h=r.o.devicePixelRatio||1;this._canvas.width=h*Math.ceil(g),this._canvas.height=h*Math.ceil(a),this._canvas.style.width=`${g}px`,this._canvas.style.height=`${a}px`}_addMarker(g){this._markers.push(g)}_removeMarker(g){const a=this._markers.indexOf(g);a!==-1&&this._markers.splice(a,1)}_addPopup(g){this._popups.push(g)}_removePopup(g){const a=this._popups.indexOf(g);a!==-1&&this._popups.splice(a,1)}_setupPainter(){const g=Object.assign({},V.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl2",g);a?(Gi(a,!0),this.painter=new sh(a,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",h=>{h.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),r.k.testSupport(a)):this.fire(new r.y(new Error("Failed to initialize WebGL")))}_contextLost(g){g.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new r.z("webglcontextlost",{originalEvent:g}))}_contextRestored(g){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 r.z("webglcontextrestored",{originalEvent:g}))}_onMapScroll(g){if(g.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(g){return this.style?(this._styleDirty=this._styleDirty||g,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_requestDomTask(g){!this.loaded()||this.loaded()&&!this.isMoving()?g():this._domRenderTaskQueue.add(g)}_render(g){let a;this.fire(new r.z("renderstart")),++this._frameId;const h=this.painter.context.extTimerQuery,y=r.o.now(),b=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(a=b.createQuery(),b.beginQuery(h.TIME_ELAPSED_EXT,a)),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(g),this._domRenderTaskQueue.run(g),this._removed)return;this._updateProjectionTransition();const T=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const L=this.transform.zoom,O=this.transform.pitch,H=r.o.now(),F=new r.ac(L,{now:H,fadeDuration:T,pitch:O,transition:this.style.transition,worldview:this._worldview});this.style.update(F)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let E=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),E=this._updateAverageElevation(y),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):E=this._updateAverageElevation(y);const P=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,T,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),P&&(this._placementDirty=P.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:T,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 r.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,C.mark(S.load),this.fire(new r.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(),a){const L=r.o.now()-y;b.endQuery(h.TIME_ELAPSED_EXT),setTimeout(()=>{const O=b.getQueryParameter(a,b.QUERY_RESULT)/1e6;b.deleteQuery(a),this.fire(new r.z("gpu-timing-frame",{cpuTime:L,gpuTime:O}))},50)}if(this.listens("gpu-timing-layer")){const L=this.painter.collectGpuTimers();setTimeout(()=>{const O=this.painter.queryGpuTimers(L);this.fire(new r.z("gpu-timing-layer",{layerTimes:O}))},50)}if(this.listens("gpu-timing-deferred-render")){const L=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const O=this.painter.queryGpuTimeDeferredRender(L);this.fire(new r.z("gpu-timing-deferred-render",{gpuTime:O}))},50)}const M=this._sourcesDirty||this._styleDirty||this._placementDirty||E;if(M||this._repaint)this.triggerRepaint();else{const L=this.idle();if(L&&(E=this._updateAverageElevation(y,!0)),E)this.triggerRepaint();else if(this._triggerFrame(!1),L&&(this.fire(new r.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const O=this._calculateSpeedIndex();this.fire(new r.z("speedindexcompleted",{speedIndex:O})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,C.mark(S.fullLoad),this._performanceMetricsCollection&&Ai(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(g){for(const a of this._markers)g&&!this.getRenderWorldCopies()&&(a._lngLat=a._lngLat.wrap()),a._update();for(const a of this._popups)!g||this.getRenderWorldCopies()||a._trackPointer||(a._lngLat=a._lngLat.wrap()),a._update()}_updateAverageElevation(g,a=!1){const h=b=>(this.transform.averageElevation=b,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&h(0);const y=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(y||(a||g-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(g)){const b=this.transform.averageElevation;let T=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(T)?T=0:this._averageElevationLastSampledAt=g;const E=Math.abs(b-T);if(E>1){if(this._isInitialLoad||y)return this._averageElevation.jumpTo(T),h(T);this._averageElevation.easeTo(T,g,300)}else if(E>1e-4)return this._averageElevation.jumpTo(T),h(T)}return!!this._averageElevation.isEasing(g)&&h(this._averageElevation.getValue(g))}_authenticate(){Nn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,g=>{if(g&&(g.message===dt||g.status===401)){const a=this.painter.context.gl;Gi(a,!1),this._logoControl instanceof Py&&this._logoControl._updateLogo(),a&&a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new r.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/")))}}),Ci(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&ei(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Oi(this._requestManager._customAccessToken)}_updateTerrain(){const g=this._isDragging();this.painter.updateTerrain(this.style,g)}_calculateSpeedIndex(){const g=this.painter.canvasCopy(),a=this.painter.getCanvasCopiesAndTimestamps();a.timeStamps.push(performance.now());const h=this.painter.context.gl,y=h.createFramebuffer();function b(T){h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,T,0);const E=new Uint8Array(h.drawingBufferWidth*h.drawingBufferHeight*4);return h.readPixels(0,0,h.drawingBufferWidth,h.drawingBufferHeight,h.RGBA,h.UNSIGNED_BYTE,E),E}return h.bindFramebuffer(h.FRAMEBUFFER,y),this._canvasPixelComparison(b(g),a.canvasCopies.map(b),a.timeStamps)}_canvasPixelComparison(g,a,h){let y=h[1]-h[0];const b=g.length/4;for(let T=0;T<a.length;T++){const E=a[T];let P=0;for(let M=0;M<E.length;M+=4)E[M]===g[M]&&E[M+1]===g[M+1]&&E[M+2]===g[M+2]&&E[M+3]===g[M+3]&&(P+=1);y+=(h[T+2]-h[T+1])*(1-P/b)}return y}remove(){this._hash&&this._hash.remove();for(const a of this._controls)a.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 g=this.painter.context.gl.getExtension("WEBGL_lose_context");g&&g.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),zi.delete(this.painter.context.gl),Xi.remove(),Ot.remove(),this._removed=!0,this.fire(new r.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(g){this._renderNextFrame=this._renderNextFrame||g,this.style&&!this._frame&&(this._frame=r.o.frame(a=>{const h=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,h&&this._render(a)}))}_preloadTiles(g){const a=this.style?this.style.getSourceCaches():[];return r.bv(a,(h,y)=>h._preloadTiles(g,y),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(g){this._trackResize&&this.resize({originalEvent:g})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(g){this._showParseStatus!==g&&(this._showParseStatus=g,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(g){this._showTerrainWireframe!==g&&(this._showTerrainWireframe=g,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(g){this._showLayers2DWireframe!==g&&(this._showLayers2DWireframe=g,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(g){this._showLayers3DWireframe!==g&&(this._showLayers3DWireframe=g,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(g){this._speedIndexTiming!==g&&(this._speedIndexTiming=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,this._tp.refreshUI(),g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(g){this._showTileAABBs!==g&&(this._showTileAABBs=g,this._tp.refreshUI(),g&&this._update())}_setCacheLimits(g,a){r.f3(g,a)}get version(){return x}},NavigationControl:class{constructor(g={}){this.options=Object.assign({},yx,g),this._container=B("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(r.aX(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>{this._map&&this._map.zoomIn({},{originalEvent:a})}),B("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>{this._map&&this._map.zoomOut({},{originalEvent:a})}),B("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(r.aX(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{const h=this._map;h&&(this.options.visualizePitch?h.resetNorthPitch({},{originalEvent:a}):h.resetNorth({},{originalEvent:a}))}),this._compassIcon=B("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const g=this._map;if(!g)return;const a=g.getZoom(),h=a===g.getMaxZoom(),y=a===g.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=y,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",y.toString())}_rotateCompassArrow(){const g=this._map;if(!g)return;const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(g.transform.pitch*(Math.PI/180)
3711),.5)}) rotateX(${g.transform.pitch}deg) rotateZ(${g.transform.angle*(180/Math.PI)}deg)`:`rotate(${g.transform.angle*(180/Math.PI)}deg)`;g._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(g){return this._map=g,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),g.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&g.on("pitch",this._rotateCompassArrow),g.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new My(g,this._compass,this.options.visualizePitch)),this._container}onRemove(){const g=this._map;g&&(this._container.remove(),this.options.showZoom&&g.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&g.off("pitch",this._rotateCompassArrow),g.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(g,a){const h=B("button",g,this._container);return h.type="button",h.addEventListener("click",a),h}_setButtonTitle(g,a){if(!this._map)return;const h=this._map._getUIString(`NavigationControl.${a}`);g.setAttribute("aria-label",h),g.firstElementChild&&g.firstElementChild.setAttribute("title",h)}},GeolocateControl:class extends r.E{constructor(g={}){super();const a=navigator.geolocation;this.options=Object.assign({geolocation:a},Gc,g),r.aX(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=gp(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(g){return this._map=g,this._container=B("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(g){const a=(h=!!this.options.geolocation)=>{this._supportsGeolocation=h,g(h)};this._supportsGeolocation!==void 0?g(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(h=>a(h.state!=="denied")).catch(()=>a()):a()}_isOutOfMapMaxBounds(g){const a=this._map.getMaxBounds(),h=g.coords;return!!a&&(h.longitude<a.getWest()||h.longitude>a.getEast()||h.latitude<a.getSouth()||h.latitude>a.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(g){if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new r.z("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,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(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new r.z("geolocate",Object.assign({coords:g.coords,timestamp:g.timestamp},g.toJSON?{toJSON:g.toJSON.bind(g)}:{}))),this._finish()}}_updateCamera(g){const a=new r.aS(g.coords.longitude,g.coords.latitude),h=g.coords.accuracy,y=this._map.getBearing(),b=Object.assign({bearing:y},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(h),b,{geolocateSource:!0})}_updateMarker(g){if(g){const a=new r.aS(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=g.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const g=this._map.transform,a=r.ce(1,g._center.lat)*g.worldSize,h=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}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(g){if(this._map){if(this.options.trackUserLocation)if(g.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 a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new r.z("error",g)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(g){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=B("button","mapboxgl-ctrl-geolocate",this._container),B("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",g===!1){r.w("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",a),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3711se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=B("div","mapboxgl-user-location"),this._dotElement.appendChild(B("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(B("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new id({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=B("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new id({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",a=>{a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||a.originalEvent&&a.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 r.z("trackuserlocationend")))})}}_onDeviceOrientation(g){this._userLocationDotMarker&&(g.webkitCompassHeading?this._heading=g.webkitCompassHeading:g.absolute===!0&&(this._heading=-1*g.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return r.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 r.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 r.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 r.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 g;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(g={maximumAge:6e5,timeout:0},this._noTimeout=!0):(g=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,g),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 g=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(a=>{a==="granted"&&g()}).catch(console.error):g()}_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","fal
3711se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Xf,ScaleControl:class{constructor(g={}){this.options=Object.assign({},AD,g),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),r.aX(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const g=this.options.maxWidth||100,a=this._map,h=a._containerHeight/2,y=a._containerWidth/2-g/2,b=a.unproject([y,h]),T=a.unproject([y+g,h]),E=b.distanceTo(T);if(this.options.unit==="imperial"){const P=3.2808*E;P>5280?this._setScale(g,P/5280,"mile"):this._setScale(g,P,"foot")}else this.options.unit==="nautical"?this._setScale(g,E/1852,"nautical-mile"):E>=1e3?this._setScale(g,E/1e3,"kilometer"):this._setScale(g,E,"meter")}_setScale(g,a,h){this._map._requestDomTask(()=>{const y=function(T){const E=Math.pow(10,`${Math.floor(T)}`.length-1);let P=T/E;return P=P>=10?10:P>=5?5:P>=3?3:P>=2?2:P>=1?1:function(M){const L=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*L)/L}(P),E*P}(a),b=y/a;this._container.innerHTML=this._isNumberFormatSupported&&h!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:h}).format(y):`${y} ${ID[h]}`,this._container.style.width=g*b+"px"})}onAdd(g){return this._map=g,this._language=g.getLanguage(),this._container=B("div","mapboxgl-ctrl mapboxgl-ctrl-scale",g.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(g){this._language=g,this._update()}setUnit(g){this.options.unit=g,this._update()}},FullscreenControl:class{constructor(g={}){this._fullscreen=!1,g&&g.container&&(g.container instanceof HTMLElement?this._container=g.container:r.w("Full screen control 'container' must be a DOM element.")),r.aX(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=B("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",r.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 g=this._fullscreenButton=B("button","mapboxgl-ctrl-fullscreen",this._controlContainer);B("span","mapboxgl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",g)}_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:ww,Popup:class extends r.E{constructor(g){super(),this.options=Object.assign(Object.create(kD),g),this._altitude=this.options.altitude,r.aX(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(g&&g.className?g.className.trim().split(/\s+/):[])}addTo(g){return this._map&&this.remove(),this._map=g,this.options.closeOnClick&&g.on("preclick",this._onClose),this.options.closeOnMove&&g.on("move",this._onClose),g.on("remove",this.remove),this._update(),g._addPopup(this),this._focusFirstElement(),this._trackPointer?(g.on("mousemove",this._onMouseEvent),g.on("mouseup",this._onMouseEvent),g._canvasContainer.classList.add("mapboxgl-track-pointer")):g.on("move",this._update),this.fire(new r.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const g=this._map;return g&&(g.off("move",this._update),g.off("move",this._onClose),g.off("preclick",this._onClose),g.off("click",this._onClose),g.off("remove",this.remove),g.off("mousemove",this._onMouseEvent),g.off("mouseup",this._onMouseEvent),g.off("drag",this._onMouseEvent),g._canvasContainer&&g._canvasContainer.classList.remove("mapboxgl-track-pointer"),g._removePopup(this),this._map=void 0),this.fire(new r.z("close")),this}getLngLat(){return this._lngLat}
vendor: 6,059 bytes, line 3711
3711setLngLat(g){this._lngLat=r.aS.convert(g),this._pos=null,this._trackPointer=!1,this._update();const a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(g){return this._altitude=g,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const g=this._map;return g&&(g.off("move",this._update),g.on("mousemove",this._onMouseEvent),g.on("drag",this._onMouseEvent),g._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){const a=document.createDocumentFragment(),h=document.createElement("body");let y;for(h.innerHTML=g;y=h.firstChild,y;)a.appendChild(y);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){let a=this._content;if(a)for(;a.hasChildNodes();)a.firstChild&&a.removeChild(a.firstChild);else a=this._content=B("div","mapboxgl-popup-content",this._container||void 0);if(a.appendChild(g),this.options.closeButton){const h=this._closeButton=B("button","mapboxgl-popup-close-button",a);h.type="button",h.setAttribute("aria-label","Close popup"),h.innerHTML='<span aria-hidden="true">×</span>',h.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(g){return this._classList.add(g),this._updateClassList(),this}removeClassName(g){return this._classList.delete(g),this._updateClassList(),this}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){let a;return this._classList.delete(g)?a=!1:(this._classList.add(g),a=!0),this._updateClassList(),a}_onMouseEvent(g){this._update(g.point)}_getAnchor(g){if(this.options.anchor)return this.options.anchor;const a=this._map,h=this._container,y=this._pos;if(!a||!h||!y)return"bottom";const b=h.offsetWidth,T=h.offsetHeight,E=y.x<b/2,P=y.x>a.transform.width-b/2;if(y.y+g<T)return E?"top-left":P?"top-right":"top";if(y.y>a.transform.height-T){if(E)return"bottom-left";if(P)return"bottom-right"}return E?"left":P?"right":"bottom"}_updateClassList(){const g=this._container;if(!g)return;const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),g.className=a.join(" ")}_update(g){const a=this._map,h=this._content;if(!a||!this._lngLat&&!this._trackPointer||!h)return;let y=this._container;if(y||(y=this._container=B("div","mapboxgl-popup",a.getContainer()),this._tip=B("div","mapboxgl-popup-tip",y),y.appendChild(h)),this.options.maxWidth&&y.style.maxWidth!==this.options.maxWidth&&(y.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=td(this._lngLat,this._pos,a.transform)),!this._trackPointer||g){const b=this._pos=this._trackPointer&&g instanceof r.P?g:a.project(this._lngLat,this._altitude),T=Cw(this.options.offset),E=this._anchor=this._getAnchor(T.y),P=Cw(this.options.offset,E),M=b.add(P).round();a._requestDomTask(()=>{this._container&&E&&(this._container.style.transform=`${Hc[E]} translate(${M.x}px,${M.y}px)`)})}if(!this._marker&&a._showingGlobe()){const b=r.f4(a.transform,this._lngLat)?0:1;this._setOpacity(b)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const g=this._container.querySelector(PD);g&&g.focus()}_onClose(){this.remove()}_setOpacity(g){this._container&&(this._container.style.opacity=`${g}`),this._content&&(this._content.style.pointerEvents=g?"auto":"none")}},Marker:id,Style:xc,LngLat:r.aS,LngLatBounds:r.aI,Point:r.P,MercatorCoordinate:r.ae,FreeCameraOptions:gu,Evented:r.E,config:r.e,prewarm:r.f8,clearPrewarmedResources:r.f7,get accessToken(){return r.e.ACCESS_TOKEN},set accessToken(g){r.e.ACCESS_TOKEN=g},get baseApiUrl(){return r.e.API_URL},set baseApiUrl(g){r.e.API_URL=g},get workerCount(){return r.fh.workerCount},set workerCount(g){r.fh.workerCount=g},get maxParallelImageRequests(){return r.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(g){r.e.MAX_PARALLEL_IMAGE_REQUESTS=g},clearStorage(g){r.fg(g)},get workerUrl(){return r.ff.workerUrl},set workerUrl(g){r.ff.workerUrl=g},get workerClass(){return r.ff.workerClass},set workerClass(g){r.ff.workerClass=g},get workerParams(){return r.ff.workerParams},set workerParams(g){r.ff.workerParams=g},get dracoUrl(){return r.fe()},set dracoUrl(g){r.fd(g)},get meshoptUrl(){return r.fc()},set meshoptUrl(g){r.fb(g)},setNow:r.o.setNow,restoreNow:r.o.restoreNow}});var f=o;return f})})(Rne);var W2e=Rne.exports;const Tp=Xh(W2e),K2e=f4,Z2e=m4,zne=K.forwardRef(({className:t,...e},i)=>d.jsx(yE,{className:nn("fixed inset-0 z-[1000] 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,ref:i}));zne.displayName=yE.displayName;const X2e=Xb("fixed z-[1001] gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Lne=K.forwardRef(({side:t="right",className:e,children:i,...n},o)=>d.jsxs(Z2e,{children:[d.jsx(zne,{}),d.jsxs(_E,{ref:o,className:nn(X2e({side:t}),e),...n,children:[i,d.jsxs(hM,{className:"absolute right-4 top-4 roun
3711ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[d.jsx(Fa,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lne.displayName=_E.displayName;const One=({className:t,...e})=>d.jsx("div",{className:nn("flex flex-col space-y-2 text-center sm:text-left",t),...e});One.displayName="SheetHeader";const Fne=K.forwardRef(({className:t,...e},i)=>d.jsx(vE,{ref:i,className:nn("text-lg font-semibold text-foreground",t),...e}));Fne.displayName=vE.displayName;const Bne=K.forwardRef(({className:t,...e},i)=>d.jsx(xE,{ref:i,className:nn("text-sm text-muted-foreground",t),...e}));Bne.displayName=xE.displayName;function Y2e(){const{t}=pr(),{toast:e}=ks(),[,i]=$o(),n=K.useRef(null),o=K.useRef(null),c=K.useRef([]),f=K.useRef([]),[r,x]=K.useState(null),[S,C]=K.useState(!1),[I,N]=K.useState(!1),[D,V]=K.useState(""),[B,W]=K.useState(!1),[$,G]=K.useState(!1),[te,ce]=K.useState(!0),Te=new URLSearchParams(window.location.search).get("userId"),{data:we=[],isLoading:Ne}=Xn({queryKey:["/api/users-with-location"],staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0}),{data:pe,isLoading:Pe}=Xn({queryKey:["/api/auth/user"]}),{data:De=[]}=Xn({queryKey:["/api/map-points"]}),{data:Je}=Xn({queryKey:["/api/users/count"],staleTime:6e4}),{data:dt=[],isLoading:At}=Xn({queryKey:["/api/users",r==null?void 0:r.id,"listings"],enabled:!!r&&S}),qt=Ne,kt=K.useMemo(()=>we.filter(Ge=>Ge.latitude!=null&&Ge.longitude!=null&&!isNaN(Number(Ge.latitude))&&!isNaN(Number(Ge.longitude))&&(Ge.firstName||Ge.lastName)).sort((Ge,Rt)=>{const Ot=(Ge.lastName||"").toLowerCase(),Ci=(Rt.lastName||"").toLowerCase();return Ot!==Ci?Ot.localeCompare(Ci):(Ge.firstName||"").toLowerCase().localeCompare((Rt.firstName||"").toLowerCase())}),[we]),Vt=K.useMemo(()=>{if(!D.trim())return[];const Ge=D.toLowerCase().trim();return kt.filter(Rt=>{const Ot=`${Rt.firstName||""} ${Rt.lastName||""}`.toLowerCase(),Ci=`${Rt.lastName||""} ${Rt.firstName||""}`.toLowerCase();return Ot.includes(Ge)||Ci.includes(Ge)}).slice(0,10)},[D,kt]),Fe=Ge=>{if(!o.current)return;const Rt=Number(Ge.longitude),Ot=Number(Ge.latitude);!Number.isFinite(Rt)||!Number.isFinite(Ot)||(o.current.flyTo({center:[Rt,Ot],zoom:15,bearing:0,pitch:0,essential:!0}),V(""),W(!1),x(Ge))};K.useEffect(()=>{if(!I||!Te||$||we.length===0)return;const Ge=we.find(Rt=>Rt.id===Te);if(Ge&&Ge.latitude&&Ge.longitude){const Rt=Number(Ge.longitude),Ot=Number(Ge.latitude);Number.isFinite(Rt)&&Number.isFinite(Ot)&&o.current&&setTimeout(()=>{var Ci;(Ci=o.current)==null||Ci.flyTo({center:[Rt,Ot],zoom:15,bearing:0,pitch:0,essential:!0}),x(Ge)},500)}G(!0)},[I,Te,we,$]);const lt="pk.eyJ1IjoiY2VpbWFwIiwiYSI6ImNtaTRseHF5YzE2Nmwya3NmM2ZobmY2aGsifQ.4jIw7xJ2iOpibQfJ9CthhQ";K.useEffect(()=>{if(!(!n.current||!lt||o.current))return Tp.accessToken=lt,o.current=new Tp.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",center:[9.19,45.46],zoom:6,touchZoomRotate:!0,touchPitch:!0,dragRotate:!1,pitchWithRotate:!1}),o.current.addControl(new Tp.NavigationControl({showCompass:!1}),"top-right"),o.current.addControl(new Tp.FullscreenControl,"top-right"),o.current.scrollZoom.enable(),o.current.touchZoomRotate.enable(),o.current.dragPan.enable(),o.current.on("load",()=>{N(!0)}),()=>{var Ge;(Ge=o.current)==null||Ge.remove(),o.current=null,N(!1)}},[lt]),K.useEffect(()=>{if(!o.current||!I)return;c.current.forEach(si=>si.remove()),c.current=[];const Ge=new Tp.LngLatBounds;let Rt=!1;const Ot=we.filter(si=>si.latitude!=null&&si.longitude!=null&&!isNaN(Number(si.latitude))&&!isNaN(Number(si.longitude)));console.log("[MAP] Valid users for markers:",Ot.length);const Ci=[...Ot].sort((si,Oi)=>{const Ei=si.isProfessional||si.isAdmin?1:0,Ai=Oi.isProfessional||Oi.isAdmin?1:0;return Ei-Ai}),Hi=new Map;Ci.forEach(si=>{const Oi=`${Number(si.latitude).toFixed(5)}_${Number(si.longitude).toFixed(5)}`;Hi.set(Oi,(Hi.get(Oi)||0)+1)});const ei=new Map;if(Ci.forEach(si=>{const Oi=document.createElement("div");Oi.style.cursor="pointer",Oi.style.zIndex=si.isProfessional||si.isAdmin?"2":"1",Oi.setAttribute("data-testid",`marker-user-${si.id}`);const Ei=document.createElementNS("http://www.w3.org/2000/svg","svg");Ei.setAttribute("width","40"),Ei.setAttribute("height","40"),Ei.setAttribute("viewBox","0 0 24 24"),Ei.style.filter="drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5))",Ei.style.display="block";const Ai=document.createElementNS("http://www.w3.org/2000/svg","path");Ai.setAttribute("stroke","#000"),Ai.setAttribute("stroke-width","0.5"),si.isProfessional||si.isAdmin?(Ai.setAttribute("fill","#FFD700"),Ai.setAttribute("d","M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z")):(Ai.setAttribute("fill","#4A90E2"),Ai.setAttribute("d","M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z")),Ei.appendChild(Ai),Oi.appendChild(Ei),Oi.setAttribute("data-user-id",si.id),Oi.addEventListener("click",Kr=>{Kr.stopPropagation();const rs=Kr.currentTarget.getAttribute("data-user-id"),Yn=we.find(Ys=>Ys.id===rs);
3711Yn&&(x(Yn),C(!1))});let Xi=Number(si.latitude),Nn=Number(si.longitude);const zi=`${Xi.toFixed(5)}_${Nn.toFixed(5)}`,Gi=Hi.get(zi)||1;if(Gi>1){const Kr=ei.get(zi)||0;ei.set(zi,Kr+1);const rs=2*Math.PI*Kr/Gi,Yn=4e-4;Xi+=Math.sin(rs)*Yn,Nn+=Math.cos(rs)*Yn}const Sr=new Tp.Marker({element:Oi}).setLngLat([Nn,Xi]).addTo(o.current);c.current.push(Sr),Ge.extend([Nn,Xi]),Rt=!0}),Rt)if(Ot.length===1){const si=Ot[0];o.current.setCenter([Number(si.longitude),Number(si.latitude)]),o.current.setZoom(13)}else o.current.fitBounds(Ge,{padding:50,maxZoom:12})},[we,I]),K.useEffect(()=>{!o.current||!I||(f.current.forEach(Ge=>Ge.remove()),f.current=[],De.forEach(Ge=>{const Rt=Number(Ge.latitude),Ot=Number(Ge.longitude);if(!Number.isFinite(Rt)||!Number.isFinite(Ot))return;const Ci=document.createElement("div");if(Ci.style.cursor="pointer",Ci.setAttribute("data-testid",`marker-poi-${Ge.id}`),Ge.logoUrl){const zi=document.createElement("img");zi.src=Ge.logoUrl,zi.alt=Ge.name,zi.style.width="38px",zi.style.height="38px",zi.style.borderRadius="50%",zi.style.border="2.5px solid white",zi.style.boxShadow="0 4px 12px rgba(0,0,0,0.5)",zi.style.objectFit="cover",zi.style.display="block",zi.style.transition="transform 0.15s ease",Ci.appendChild(zi)}else{const zi=document.createElementNS("http://www.w3.org/2000/svg","svg");zi.setAttribute("width","36"),zi.setAttribute("height","36"),zi.setAttribute("viewBox","0 0 24 24"),zi.style.filter="drop-shadow(0 4px 6px rgba(0,0,0,0.5))";const Gi=document.createElementNS("http://www.w3.org/2000/svg","path");Gi.setAttribute("fill","#E53E3E"),Gi.setAttribute("stroke","#000"),Gi.setAttribute("stroke-width","0.5"),Gi.setAttribute("d","M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"),zi.appendChild(Gi),Ci.appendChild(zi)}const Hi=zi=>zi.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),ei=Hi(Ge.name),si=Ge.city?Hi(Ge.city):"",Oi=Ge.phone?Hi(Ge.phone):"",Ei=si?`${ei} â ${si}`:ei,Ai=new Tp.Popup({offset:24,closeButton:!0,closeOnClick:!1,maxWidth:"240px"}).setHTML(` 3712 <div style="padding:10px 12px;min-width:160px;"> 3713 <div style="font-weight:700;font-size:13px;margin-bottom:${Oi?"6px":"0"};color:#111;line-height:1.35;">${Ei}</div> 3714 ${Oi?` 3715 <div style="display:flex;align-items:center;gap:5px;font-size:12px;color:#444;"> 3716 <svg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='#888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' style='flex-shrink:0'><path d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07A19.5 19.5 0 0 1 4.15 12a19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 3.06 1.18h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L7.09 8.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7a2 2 0 0 1 1.72 2.01z'/></svg> 3717 <a href="tel:${Oi}" style="color:#444;text-decoration:none;">${Oi}</a> 3718 </div> 3719 `:""} 3720 </div> 3721 `);let Xi=!1;Ci.addEventListener("click",zi=>{zi.stopPropagation(),Xi?(Ai.remove(),Xi=!1):(Ai.setLngLat([Ot,Rt]).addTo(o.current),Xi=!0)}),Ai.on("close",()=>{Xi=!1});const Nn=new Tp.Marker({element:Ci}).setLngLat([Ot,Rt]).addTo(o.current);Ci.style.zIndex="100",f.current.push(Nn)}))},[De,we,I]);const pt=we.filter(Ge=>Ge.latitude!=null&&Ge.longitude!=null&&!isNaN(Number(Ge.latitude))&&!isNaN(Number(Ge.longitude))).length;return d.jsxs("div",{className:"h-screen w-full relative overflow-hidden",style:{minHeight:"100vh",height:"100dvh",isolation:"isolate"},children:[d.jsx("div",{ref:n,className:"absolute inset-0 touch-pan-x touch-pan-y",style:{width:"100%",height:"100%",minHeight:"100vh"}}),qt&&d.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-50",children:d.jsx(Ti,{className:"p-6",children:d.jsx("p",{className:"text-muted-foreground",children:t("marketplace.loading")})})}),d.jsxs("div",{className:"absolute top-4 left-4 z-10 flex flex-col gap-2",children:[d.jsx(tt,{variant:"secondary",size:"icon","data-testid":"button-toggle-control
3721s",onClick:()=>ce(!te),className:"touch-manipulation",children:te?d.jsx(vJ,{className:"w-4 h-4"}):d.jsx(Qb,{className:"w-4 h-4"})}),te&&d.jsxs(d.Fragment,{children:[d.jsxs(tt,{variant:"default",size:"default","data-testid":"button-back-dashboard",onClick:()=>i("/dashboard"),className:"touch-manipulation",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),t("common.backToDashboard")]}),d.jsxs(Ti,{className:"p-2 bg-background/95 backdrop-blur-sm relative z-30",children:[d.jsxs("div",{className:"relative",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{type:"text",placeholder:t("map.searchUser","Cerca utente..."),value:D,onChange:Ge=>{V(Ge.target.value),W(!0)},onFocus:()=>W(!0),className:"pl-9 pr-8 h-9","data-testid":"input-search-user"}),D&&d.jsx(tt,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:()=>{V(""),W(!1)},"data-testid":"button-clear-search",children:d.jsx(Fa,{className:"w-3 h-3"})})]}),B&&D.trim()&&d.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 bg-background border rounded-md shadow-lg max-h-60 overflow-y-auto z-50",children:Vt.length>0?Vt.map(Ge=>d.jsx(tt,{variant:"ghost",className:"w-full justify-start h-auto py-2 px-3 rounded-none border-b last:border-b-0",onClick:()=>Fe(Ge),"data-testid":`search-result-${Ge.id}`,children:d.jsxs("div",{className:"flex items-center gap-2",children:[Ge.isProfessional&&d.jsx(Ru,{className:"w-4 h-4 text-yellow-500 fill-yellow-500 flex-shrink-0"}),d.jsxs("div",{className:"text-left",children:[d.jsxs("p",{className:"font-medium",children:[Ge.firstName," ",Ge.lastName]}),Ge.city&&d.jsx("p",{className:"text-xs text-muted-foreground",children:Ge.city})]})]})},Ge.id)):d.jsx("p",{className:"p-3 text-sm text-muted-foreground text-center",children:t("map.noSearchResults","Nessun utente trovato")})})]}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs(tt,{variant:"secondary",size:"default","data-testid":"button-view-all",onClick:()=>{if(!o.current)return;const Ge=we.filter(Ot=>Ot.latitude!=null&&Ot.longitude!=null&&!isNaN(Number(Ot.latitude))&&!isNaN(Number(Ot.longitude)));if(Ge.length===0){e({title:t("map.noUsers"),description:t("map.noUsersDescription"),variant:"destructive"});return}const Rt=new Tp.LngLatBounds;Ge.forEach(Ot=>{Rt.extend([Number(Ot.longitude),Number(Ot.latitude)])}),Ge.length===1?o.current.flyTo({center:[Number(Ge[0].longitude),Number(Ge[0].latitude)],zoom:13,bearing:0,pitch:0,essential:!0}):o.current.fitBounds(Rt,{padding:50,maxZoom:12,essential:!0})},children:[d.jsx(YN,{className:"w-4 h-4 mr-2"}),t("map.viewAll")]}),!Pe&&pe&&d.jsxs("div",{className:"flex flex-col gap-1",children:[d.jsxs(tt,{variant:"secondary",size:"default","data-testid":"button-center-on-me","aria-disabled":pe.latitude===null||pe.latitude===void 0||pe.longitude===null||pe.longitude===void 0,"data-state":pe.latitude===null||pe.latitude===void 0||pe.longitude===null||pe.longitude===void 0?"disabled":"enabled",className:pe.latitude===null||pe.latitude===void 0||pe.longitude===null||pe.longitude===void 0?"opacity-50 cursor-not-allowed":"",onClick:()=>{if(pe.latitude===null||pe.latitude===void 0||pe.longitude===null||pe.longitude===void 0){e({title:t("map.noLocationTitle"),description:t("map.noLocationDesc"),variant:"destructive"});return}if(!o.current)return;const Ge=Number(pe.longitude),Rt=Number(pe.latitude);if(!Number.isFinite(Ge)||!Number.isFinite(Rt)){e({title:t("map.invalidCoordsTitle"),description:t("map.invalidCoordsDesc"),variant:"destructive"}),console.error("[MAP] Invalid coordinates:",{lat:pe.latitude,lon:pe.longitude});return}o.current.flyTo({center:[Ge,Rt],zoom:15,bearing:0,pitch:0,essential:!0})},children:[d.jsx(fo,{className:"w-4 h-4 mr-2"}),t("map.centerOnMe")]}),(pe.latitude===null||pe.latitude===void 0||pe.longitude===null||pe.longitude===void 0)&&d.jsx("p",{className:"text-xs text-muted-foreground px-1","data-testid":"text-center-helper",children:t("map.completeProfileFirst")})]})]}),d.jsx(Ti,{className:"p-3 bg-background/90 backdrop-blur-sm",children:d.jsxs("div",{className:"flex flex-col gap-0.5","data-testid":"text-total-markers",children:[d.jsxs("p",{className:"text-sm font-medium",children:[pt," ",t(pt===1?"map.user":"map.users")," ",t("map.onMap")||"in mappa"]}),Je&&d.jsxs("p",{className:"text-xs text-muted-foreground",children:[Je.count," ",t("map.totalMembers")||"iscritti totali"]}
3721)]})}),d.jsxs(Ti,{className:"p-3 bg-background/90 backdrop-blur-sm","data-testid":"card-legend",children:[d.jsx("p",{className:"text-xs font-medium mb-2",children:t("map.legend")}),d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("svg",{width:"16",height:"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d.jsx("path",{fill:"#FFD700",stroke:"#000","stroke-width":"0.5",d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t("map.professionalUser")})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("svg",{width:"16",height:"16",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:d.jsx("path",{fill:"#4A90E2",stroke:"#000","stroke-width":"0.5",d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t("map.privateUser")})]})]})]})]})]}),!qt&&pt===0&&d.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10",children:d.jsxs(Ti,{className:"p-8 max-w-md text-center bg-background/90 backdrop-blur-sm",children:[d.jsx(Bc,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),d.jsx("h3",{className:"text-xl font-semibold mb-2","data-testid":"text-no-users",children:t("map.noUsers")}),d.jsx("p",{className:"text-muted-foreground mb-4",children:t("map.noUsersDescription")}),d.jsx(tt,{"data-testid":"button-browse-marketplace",onClick:()=>i("/"),className:"touch-manipulation",children:t("marketplace.browseMarketplace")})]})}),r&&d.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[500] max-w-sm w-full mx-4",children:d.jsxs(Ti,{className:"shadow-2xl",children:[d.jsxs("div",{className:"relative",children:[d.jsx(tt,{size:"icon",variant:"ghost",className:"absolute top-2 right-2 z-10 bg-background/80 backdrop-blur-sm",onClick:()=>x(null),"data-testid":"button-close-user-popup",children:d.jsx(Fa,{className:"w-4 h-4"})}),d.jsx("div",{className:"w-full h-48 bg-gradient-to-br from-blue-500/20 to-blue-600/20 rounded-t-lg flex items-center justify-center",children:r.profileImageUrl?d.jsx("img",{src:r.profileImageUrl,alt:`${r.firstName} ${r.lastName}`,className:"w-24 h-24 rounded-full object-cover border-4 border-background","data-testid":"img-user-avatar"}):d.jsx(Bc,{className:"w-24 h-24 text-blue-500"})})]}),d.jsxs("div",{className:"p-6 space-y-3",children:[(r.isProfessional||r.isAdmin)&&d.jsxs(En,{variant:"default",className:"w-fit","data-testid":"badge-user-professional",children:[d.jsx(Ru,{className:"w-3 h-3 mr-1 fill-current"}),r.isAdmin?"Admin":"Professional"]}),d.jsxs("h3",{className:"font-semibold text-xl","data-testid":"text-user-name",children:[r.firstName," ",r.lastName]}),r.profession&&d.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"text-user-profession",children:r.profession}),r.city&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{"data-testid":"text-user-city",children:r.city})]}),r.website&&d.jsx("a",{href:r.website,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline block","data-testid":"link-user-website",children:r.website}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs(tt,{variant:"default",className:"w-full",onClick:()=>i(r.isProfessional||r.isAdmin?`/store/${r.id}?from=map`:`/user/${r.id}?from=map`),"data-testid":"button-view-profile",children:[d.jsx(ju,{className:"w-4 h-4 mr-2"}),r.isProfessional||r.isAdmin?t("map.viewStore","Vedi Negozio"):t("map.viewProfile")]}),d.jsxs(tt,{variant:"outline",className:"w-full",onClick:()=>C(!0),"data-testid":"button-view-listings",children:[d.jsx(Tb,{className:"w-4 h-4 mr-2"}),t("map.viewListings")]}),pe&&r.id!==pe.id&&d.jsxs(tt,{variant:"outline",className:"w-full touch-manipulation","data-testid":"button-send-message",onClick:()=>i(`/messages?userId=${r.id}`),children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("map.sendMessage")]})]})]})]})}),d.jsx(K2e,{open:S,onOpenChange:C,children:d.jsxs(Lne,{side:"right",className:"w-full sm:max-w-lg overflow-y-auto",children:[d.jsxs(One,{children:[d.jsx(Fne,{"data-testid":"text-sheet-title",children:r?`${t("map.viewListings")} - ${r.firstName} ${r.lastName}`:t("map.viewListings")}),d.jsx(Bne,{"data-testid":"text-sheet-description",children:At?t("marketplace.loading"):dt.length===0?t("marketplace.noListingsDesc"):`${dt.length} ${dt.length===1?t("map.listing"):t("map.listings")}`})]}),d.jsx("div",{className:"mt-6 space-y-4",children:At?d.jsx("div",{className:"flex items-center justify-center py-12",children:d.jsx("p",{className:"text-muted-foreground",children:t("marketplace.loading")})}):dt.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[d.jsx(fo,{className:"w-12 h-12 mb-4 text-muted-foreground"}),d.jsx("h3",{className:"font-semibold mb-2","data-testid":"text-no-listings",children:t("marketplace.noListingsTitle")}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t("marketplace.noListingsDesc")})]}):dt.map(Ge=>{var Rt,Ot;return d.jsxs(Ti,{className:"overflow-hidden","data-testid":`card-listing-${Ge.id}`,children:[Ge.images&&Ge.images.length>0&&d.jsx("img",{src:Ge.images[0],alt:Ge.title,className:"w-full h-48 object-cover","data-testid":`img-listing-${Ge.id}`}),d.jsxs("div",{className:"p-4 space-y-2",children:[(((Rt=Ge.user)==null?void 0:Rt.isProfessional)||((Ot=Ge.user)==null?void 0:Ot.isAdmin))&&d.jsxs(En,{variant:"default",className:"w-fit","data-testid":`badge-professional-${Ge.id}`,children:[d.jsx(Ru,{className:"w-3 h-3 mr-1 fill-current"}),"Professional"]}),d.jsx("h4",{className:"font-semibold line-clamp-2","data-testid":`text-title-${Ge.id}`,children:Ge.title}),Ge.category&&d.jsx(En,{variant:"outline",className:"w-fit","data-testid":`badge-category-${Ge.id}`,children:t(`categories.${Ge.category.name}`,Ge.category.name)}),d.jsx(T4,{priceEuros:Ge.priceEuros,priceCredits:Ge.priceCredits,size:"sm"}),Ge.city&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{"data-testid":`text-city-${Ge.id}`,children:Ge.city})]}),d.jsx(tt,{className:"w-full",size:"sm","data-testid":`button-view-details-${Ge.id}`,onClick:()=>{C(!1),x(null),window.location.href=`/listings/${Ge.id}`},children:t("marketplace.viewDetails")})]})]},Ge.id)})})]})})]})}function Iq(){const{t}=pr();return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-8",children:[d.jsx("div",{className:"flex items-center gap-4 mb-8",children:d.jsx(yr,{href:"/","data-testid":"link-back-home",children:d.jsxs(tt,{variant:"ghost",size:"sm","data-testid":"button-back-home",children:[d.jsx(Ao,{className:"h-4 w-4 mr-2","data-testid":"icon-back-arrow"}),d.jsx("span",{"data-testid":"text-back-home",children:t("about.backToHome")})]})})}),d.jsxs("div",{className:"text-center mb-12",children:[d.jsx("h1",{className:"text-4xl font-bold mb-4","data-testid":"text-about-hero-title",children:t("about.heroTitle")}),d.jsx("p",{className:"text-xl text-muted-foreground","data-testid":"text-about-hero-subtitle",children:t("about.heroSubtitle")})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-philosophy",children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2","data-testid":"text-philosophy-title",children:[d.jsx(e1,{className:"h-6 w-6 text-primary"}),t("about.philosophyTitle")]})}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsx("p",{className:"text-muted-foreground","data-testid":"text-philosophy-1",children:t("about.philosophyText1")}),d.jsx("p",{className:"text-muted-foreground","data-testid":"text-philosophy-2",children:t("about.philosophyText2")})]})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-features",children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2","data-testid":"text-features-title",children:[d.jsx(j8,{className:"h-6 w-6 text-primary"}),t("about.featuresTitle")]})}),d.jsx(Ji,{children:d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"font-semibold mb-3","data-testid":"text-free-users-title",children:t("about.freeUsersTitle")}),d.jsxs("ul",{className:"space-y-2",children:[d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-1",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-1"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-1",children:t("about.freeFeature1")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-2",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-2"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-2",children:t("about.freeFeature2")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-3",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-3"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-3",children:t("about.freeFeature3")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-4",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-4"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-4",children:t("about.freeFeature4")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-5",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-5"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-5",children:t("about.freeFeature5")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-free-feature-6",children:[d.jsx(Cd,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-check-free-6"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-free-feature-6",children:t("about.freeFeature6")})]})]})]}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-semibold mb-3","data-testid":"text-pro-users-title",children:t("about.proUsersTitle")}),d.jsxs("ul",{className:"space-y-2",children:[d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-pro-feature-1",children:[d.jsx(Ru,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-star-pro-1"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-pro-feature-1",children:t("about.proFeature1")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-pro-feature-2",children:[d.jsx(Ru,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-star-pro-2"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-pro-feature-2",children:t("about.proFeature2")})]}),d.jsxs("li",{className:"flex items-start gap-2","data-testid":"item-pro-feature-3",children:[d.jsx(Ru,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-star-pro-3"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-pro-feature-3",children:t("about.proFeature3")})]})]})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-benefits",children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2","data-testid":"text-benefits-title",children:[d.jsx(ig,{className:"h-6 w-6 text-primary"}),t("about.benefitsTitle")]})}),d.jsxs(Ji,{children:[d.jsx("p",{className:"text-muted-foreground mb-4","data-testid":"text-benefits-intro",children:t("about.benefitsIntro")}),d.jsxs("ul",{className:"space-y-3",children:[d.jsxs("li",{className:"flex items-start gap-3","data-testid":"item-benefit-1",children:[d.jsx(Bc,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-users-benefit-1"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-benefit-1",children:t("about.benefit1")})]}),d.jsxs("li",{className:"flex items-start gap-3","data-testid":"item-benefit-2",children:[d.jsx(YN,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-globe-benefit-2"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-benefit-2",children:t("about.benefit2")})]}),d.jsxs("li",{className:"flex items-start gap-3","data-testid":"item-benefit-3",children:[d.jsx(i1,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-shield-benefit-3"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-benefit-3",children:t("about.benefit3")})]}),d.jsxs("li",{className:"flex items-start gap-3","data-testid":"item-benefit-4",children:[d.jsx(j8,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-trending-benefit-4"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-benefit-4",children:t("about.benefit4")})]}),d.jsxs("li",{className:"flex items-start gap-3","data-testid":"item-benefit-5",children:[d.jsx(ig,{className:"h-5 w-5 text-primary mt-0.5 flex-shrink-0","data-testid":"icon-heart-benefit-5"}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-benefit-5",children:t("about.benefit5")})]})]})]})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-getting-started",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-getting-started-title",children:t("about.gettingStartedTitle")})}),d.jsx(Ji,{children:d.jsxs("ol",{className:"space-y-3",children:[d.jsxs("li",{className:"flex gap-3","data-testid":"item-step-1",children:[d.jsx("span",{className:"font-bold text-primary flex-shrink-0","data-testid":"text-step-number-1",children:"1."}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-step-desc-1",children:t("about.step1")})]}),d.jsxs("li",{className:"flex gap-3","data-testid":"item-step-2",children:[d.jsx("span",{className:"font-bold text-primary flex-shrink-0","data-testid":"text-step-number-2",children:"2."}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-step-desc-2",children:t("about.step2")})]}),d.jsxs("li",{className:"flex gap-3","data-testid":"item-step-3",children:[d.jsx("span",{className:"font-bold text-primary flex-shrink-0","data-testid":"text-step-number-3",children:"3."}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-step-desc-3",children:t("about.step3")})]}),d.jsxs("li",{className:"flex gap-3","data-testid":"item-step-4",children:[d.jsx("span",{className:"font-bold text-primary flex-shrink-0","data-testid":"text-step-number-4",children:"4."}),d.jsx("span",{className:"text-muted-foreground","data-testid":"text-step-desc-4",children:t("about.step4")})]})]})})]}),d.jsx(Ti,{className:"mb-8 border-primary","data-testid":"card-closing",children:d.jsx(Ji,{className:"pt-6",children:d.jsx("p",{className:"text-center text-lg font-medium","data-testid":"text-closing-statement",children:t("about.closingStatement")})})}),d.jsx("div",{className:"text-center",children:d.jsx(yr,{href:"/auth/login","data-testid":"link-get-started",children:d.jsx(tt,{size:"lg","data-testid":"button-get-started",children:d.jsx("span",{"data-testid":"text-get-started-button",children:t("about.getStartedButton")})})})})]})})}var R4="Collapsible",[Q2e,Une]=Wa(R4),[J2e,j4]=Q2e(R4),Vne=K.forwardRef((t,e)=>{const{__scopeCollapsible:i,open:n,defaultOpen:o,disabled:c,onOpenChange:f,...r}=t,[x=!1,S]=lu({prop:n,defaultProp:o,onChange:f});
3721return d.jsx(J2e,{scope:i,disabled:c,contentId:nu(),open:x,onOpenToggle:K.useCallback(()=>S(C=>!C),[S]),children:d.jsx(vn.div,{"data-state":L4(x),"data-disabled":c?"":void 0,...r,ref:e})})});Vne.displayName=R4;var $ne="CollapsibleTrigger",qne=K.forwardRef((t,e)=>{const{__scopeCollapsible:i,...n}=t,o=j4($ne,i);return d.jsx(vn.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":L4(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:Ni(t.onClick,o.onOpenToggle)})});qne.displayName=$ne;var z4="CollapsibleContent",Hne=K.forwardRef((t,e)=>{const{forceMount:i,...n}=t,o=j4(z4,t.__scopeCollapsible);return d.jsx(Ea,{present:i||o.open,children:({present:c})=>d.jsx(eAe,{...n,ref:e,present:c})})});Hne.displayName=z4;var eAe=K.forwardRef((t,e)=>{const{__scopeCollapsible:i,present:n,children:o,...c}=t,f=j4(z4,i),[r,x]=K.useState(n),S=K.useRef(null),C=wr(e,S),I=K.useRef(0),N=I.current,D=K.useRef(0),V=D.current,B=f.open||r,W=K.useRef(B),$=K.useRef(void 0);return K.useEffect(()=>{const G=requestAnimationFrame(()=>W.current=!1);return()=>cancelAnimationFrame(G)},[]),Jo(()=>{const G=S.current;if(G){$.current=$.current||{transitionDuration:G.style.transitionDuration,animationName:G.style.animationName},G.style.transitionDuration="0s",G.style.animationName="none";const te=G.getBoundingClientRect();I.current=te.height,D.current=te.width,W.current||(G.style.transitionDuration=$.current.transitionDuration,G.style.animationName=$.current.animationName),x(n)}},[f.open,n]),d.jsx(vn.div,{"data-state":L4(f.open),"data-disabled":f.disabled?"":void 0,id:f.contentId,hidden:!B,...c,ref:C,style:{"--radix-collapsible-content-height":N?`${N}px`:void 0,"--radix-collapsible-content-width":V?`${V}px`:void 0,...t.style},children:B&&o})});function L4(t){return t?"open":"closed"}var tAe=Vne,iAe=qne,nAe=Hne,pf="Accordion",rAe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[O4,sAe,oAe]=dE(pf),[wM,j8e]=Wa(pf,[oAe,Une]),F4=Une(),Gne=Tn.forwardRef((t,e)=>{const{type:i,...n}=t,o=n,c=n;return d.jsx(O4.Provider,{scope:t.__scopeAccordion,children:i==="multiple"?d.jsx(uAe,{...c,ref:e}):d.jsx(cAe,{...o,ref:e})})});Gne.displayName=pf;var[Wne,aAe]=wM(pf),[Kne,lAe]=wM(pf,{collapsible:!1}),cAe=Tn.forwardRef((t,e)=>{const{value:i,defaultValue:n,onValueChange:o=()=>{},collapsible:c=!1,...f}=t,[r,x]=lu({prop:i,defaultProp:n,onChange:o});return d.jsx(Wne,{scope:t.__scopeAccordion,value:r?[r]:[],onItemOpen:x,onItemClose:Tn.useCallback(()=>c&&x(""),[c,x]),children:d.jsx(Kne,{scope:t.__scopeAccordion,collapsible:c,children:d.jsx(Zne,{...f,ref:e})})})}),uAe=Tn.forwardRef((t,e)=>{const{value:i,defaultValue:n,onValueChange:o=()=>{},...c}=t,[f=[],r]=lu({prop:i,defaultProp:n,onChange:o}),x=Tn.useCallback(C=>r((I=[])=>[...I,C]),[r]),S=Tn.useCallback(C=>r((I=[])=>I.filter(N=>N!==C)),[r]);return d.jsx(Wne,{scope:t.__scopeAccordion,value:f,onItemOpen:x,onItemClose:S,children:d.jsx(Kne,{scope:t.__scopeAccordion,collapsible:!0,children:d.jsx(Zne,{...c,ref:e})})})}),[dAe,SM]=wM(pf),Zne=Tn.forwardRef((t,e)=>{const{__scopeAccordion:i,disabled:n,dir:o,orientation:c="vertical",...f}=t,r=Tn.useRef(null),x=wr(r,e),S=sAe(i),I=o1(o)==="ltr",N=Ni(t.onKeyDown,D=>{var Ne;if(!rAe.includes(D.key))return;const V=D.target,B=S().filter(pe=>{var Pe;return!((Pe=pe.ref.current)!=null&&Pe.disabled)}),W=B.findIndex(pe=>pe.ref.current===V),$=B.length;if(W===-1)return;D.preventDefault();let G=W;const te=0,ce=$-1,_e=()=>{G=W+1,G>ce&&(G=te)},Te=()=>{G=W-1,G<te&&(G=ce)};switch(D.key){case"Home":G=te;break;case"End":G=ce;break;case"ArrowRight":c==="horizontal"&&(I?_e():Te());break;case"ArrowDown":c==="vertical"&&_e();break;case"ArrowLeft":c==="horizontal"&&(I?Te():_e());break;case"ArrowUp":c==="vertical"&&Te();break}const we=G%$;(Ne=B[we].ref.current)==null||Ne.focus()});return d.jsx(dAe,{scope:i,disabled:n,direction:o,orientation:c,children:d.jsx(O4.Slot,{scope:i,children:d.jsx(vn.div,{...f,"data-orientation":c,ref:x,onKeyDown:n?void 0:N})})})}),Jk="AccordionItem",[hAe,B4]=wM(Jk),Xne=Tn.forwardRef((t,e)=>{const{__scopeAccordion:i,value:n,...o}=t,c=SM(Jk,i),f=aAe(Jk,i),r=F4(i),x=nu(),S=n&&f.value.includes(n)||!1,C=c.disabled||t.disabled;return d.jsx(hAe,{scope:i,open:S,disabled:C,triggerId:x,children:d.jsx(tAe,{"data-orientation":c.orientation,"data-state":ire(S),...r,...o,ref:e,disabled:C,open:S,onOpenChange:I=>{I?f.onItemOpen(n):f.onItemClose(n)}})})});Xne.displayName=Jk;var Yne="AccordionHeader",Qne=Tn.forwardRef((t,e)=>{const{__scopeAccordion:i,...n}=t,o=SM(pf,i),c=B4(Yne,i);return d.jsx(vn.h3,{"data-orientation":o.orientation,"data-state":ire(c.open),"data-disabled":c.disabled?"":void 0,...n,ref:e})});Qne.displayName=Yne;var SO="AccordionTrigger",Jne=Tn.forwardRef((t,e)=>{const{__scopeAccordion:i,...n}=t,o=SM(pf,i),c=B4(SO,i),f=lAe(SO,i),r=F4(i);return d.jsx(O4.ItemSlot,{scope:i,children:d.jsx(iAe,{"aria-disabled":c.open&&!f.collapsible||void 0,"data-orientation":o.orientation,id:c.triggerId,...r,...n,ref:e})})});Jne.displayName=SO;var ere="AccordionContent",tre=Tn.forwardRef((t,e)=>{const{__scopeAccordion:i,...n}=t,o=SM(pf,i),c=B4(ere,i),f=F4(i);return d.jsx(nAe,{role:"region","aria-labelledby":c.triggerId,"data-orientation":o.orientation,...f,...n,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});tre.displayName=ere;function ire(t){return t?"open":"closed"}var pAe=Gne,fAe=Xne,mAe=Qne,nre=Jne,rre=tre;const fh=pAe,Ss=K.forwardRef(({className:t,...e},i)=>d.jsx(fAe,{ref:i,className:nn("border-b",t),...e}));Ss.displayName="AccordionItem";const Ts=K.forwardRef(({className:t,children:e,...i},n)=>d.jsx(mAe,{className:"flex",children:d.jsxs(nre,{ref:n,className:nn("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...i,children:[e,d.jsx(Qb,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ts.displayName=nre.displayName;const Cs=K.forwardRef(({className:t,children:e,...i},n)=>d.jsx(rre,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...i,children:d.jsx("div",{className:nn("pb-4 pt-0",t),children:e})}));Cs.displayName=rre.displayName;function kq(){const{t}=pr();return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-8",children:[d.jsx("div",{className:"flex items-center gap-4 mb-8",children:d.jsx(yr,{href:"/","data-testid":"link-back-marketplace",children:d.jsxs(tt,{variant:"ghost",size:"sm","data-testid":"button-back-marketplace",children:[d.jsx(Ao,{className:"h-4 w-4 mr-2","data-testid":"icon-back-arrow-faq"}),d.jsx("span",{"data-testid":"text-back-marketplace",children:t("faq.backToMarketplace")})]})})}),d.jsxs("div",{className:"text-center mb-12",children:[d.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[d.jsx(xJ,{className:"h-10 w-10 text-primary","data-testid":"icon-faq-hero"}),d.jsx("h1",{className:"text-4xl font-bold","data-testid":"text-faq-hero-title",children:t("faq.heroTitle")})]}),d.jsx("p",{className:"text-xl text-muted-foreground","data-testid":"text-faq-hero-subtitle",children:t("faq.heroSubtitle")})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-getting-started",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-getting-started-title",children:t("faq.gettingStartedTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-1","data-testid":"accordion-item-1",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-1",children:t("faq.q1")}),d.jsx(Cs,{"data-testid":"accordion-content-1",children:t("faq.a1")})]}),d.jsxs(Ss,{value:"item-2","data-testid":"accordion-item-2",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-2",children:t("faq.q2")}),d.jsx(Cs,{"data-testid":"accordion-content-2",children:t("faq.a2")})]}),d.jsxs(Ss,{value:"item-3","data-testid":"accordion-item-3",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-3",children:t("faq.q3")}),d.jsx(Cs,{"data-testid":"accordion-content-3",children:t("faq.a3")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-listings",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-listings-title",children:t("faq.listingsTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-4","data-testid":"accordion-item-4",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-4",children:t("faq.q4")}),d.jsx(Cs,{"data-testid":"accordion-content-4",children:t("faq.a4")}
3721)]}),d.jsxs(Ss,{value:"item-5","data-testid":"accordion-item-5",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-5",children:t("faq.q5")}),d.jsx(Cs,{"data-testid":"accordion-content-5",children:t("faq.a5")})]}),d.jsxs(Ss,{value:"item-6","data-testid":"accordion-item-6",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-6",children:t("faq.q6")}),d.jsx(Cs,{"data-testid":"accordion-content-6",children:t("faq.a6")})]}),d.jsxs(Ss,{value:"item-7","data-testid":"accordion-item-7",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-7",children:t("faq.q7")}),d.jsx(Cs,{"data-testid":"accordion-content-7",children:t("faq.a7")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-credits",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-credits-title",children:t("faq.creditsTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-8","data-testid":"accordion-item-8",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-8",children:t("faq.q8")}),d.jsx(Cs,{"data-testid":"accordion-content-8",children:t("faq.a8")})]}),d.jsxs(Ss,{value:"item-9","data-testid":"accordion-item-9",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-9",children:t("faq.q9")}),d.jsx(Cs,{"data-testid":"accordion-content-9",children:t("faq.a9")})]}),d.jsxs(Ss,{value:"item-10","data-testid":"accordion-item-10",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-10",children:t("faq.q10")}),d.jsx(Cs,{"data-testid":"accordion-content-10",children:t("faq.a10")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-professional",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-professional-title",children:t("faq.professionalTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-11","data-testid":"accordion-item-11",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-11",children:t("faq.q11")}),d.jsx(Cs,{"data-testid":"accordion-content-11",children:t("faq.a11")})]}),d.jsxs(Ss,{value:"item-12","data-testid":"accordion-item-12",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-12",children:t("faq.q12")}),d.jsx(Cs,{"data-testid":"accordion-content-12",children:t("faq.a12")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-store",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-store-title",children:t("faq.storeTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-24","data-testid":"accordion-item-24",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-24",children:t("faq.q24")}),d.jsx(Cs,{"data-testid":"accordion-content-24",children:t("faq.a24")})]}),d.jsxs(Ss,{value:"item-25","data-testid":"accordion-item-25",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-25",children:t("faq.q25")}),d.jsx(Cs,{"data-testid":"accordion-content-25",children:t("faq.a25")})]}),d.jsxs(Ss,{value:"item-26","data-testid":"accordion-item-26",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-26",children:t("faq.q26")}),d.jsx(Cs,{"data-testid":"accordion-content-26",children:t("faq.a26")})]}),d.jsxs(Ss,{value:"item-27","data-testid":"accordion-item-27",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-27",children:t("faq.q27")}),d.jsx(Cs,{"data-testid":"accordion-content-27",children:t("faq.a27")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-safety",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-safety-title",children:t("faq.safetyTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-13","data-testid":"accordion-item-13",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-13",children:t("faq.q13")}),d.jsx(Cs,{"data-testid":"accordion-content-13",children:t("faq.a13")})]}),d.jsxs(Ss,{value:"item-14","data-testid":"accordion-item-14",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-14",children:t("faq.q14")}),d.jsx(Cs,{"data-testid":"accordion-content-14",children:t("faq.a14")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-referral",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-referral-title",children:t("faq.referralTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-15","data-testid":"accordion-item-15",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-15",children:t("faq.q15")}),d.jsx(Cs,{"data-testid":"accordion-content-15",children:t("faq.a15")})]}),d.jsxs(Ss,{value:"item-16","data-testid":"accordion-item-16",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-16",children:t("faq.q16")}),d.jsx(Cs,{"data-testid":"accordion-content-16",children:t("faq.a16")})]}),d.jsxs(Ss,{value:"item-17","data-testid":"accordion-item-17",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-1
37217",children:t("faq.q17")}),d.jsx(Cs,{"data-testid":"accordion-content-17",children:t("faq.a17")})]}),d.jsxs(Ss,{value:"item-18","data-testid":"accordion-item-18",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-18",children:t("faq.q18")}),d.jsx(Cs,{"data-testid":"accordion-content-18",children:t("faq.a18")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-volunteer",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-volunteer-title",children:t("faq.volunteerTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-19","data-testid":"accordion-item-19",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-19",children:t("faq.q19")}),d.jsx(Cs,{"data-testid":"accordion-content-19",children:t("faq.a19")})]}),d.jsxs(Ss,{value:"item-20","data-testid":"accordion-item-20",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-20",children:t("faq.q20")}),d.jsx(Cs,{"data-testid":"accordion-content-20",children:t("faq.a20")})]}),d.jsxs(Ss,{value:"item-21","data-testid":"accordion-item-21",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-21",children:t("faq.q21")}),d.jsx(Cs,{"data-testid":"accordion-content-21",children:t("faq.a21")})]}),d.jsxs(Ss,{value:"item-22","data-testid":"accordion-item-22",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-22",children:t("faq.q22")}),d.jsx(Cs,{"data-testid":"accordion-content-22",children:t("faq.a22")})]}),d.jsxs(Ss,{value:"item-23","data-testid":"accordion-item-23",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-23",children:t("faq.q23")}),d.jsx(Cs,{"data-testid":"accordion-content-23",children:t("faq.a23")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-voucher",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-voucher-title",children:t("faq.voucherTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-28","data-testid":"accordion-item-28",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-28",children:t("faq.q28")}),d.jsx(Cs,{"data-testid":"accordion-content-28",children:t("faq.a28")})]}),d.jsxs(Ss,{value:"item-29","data-testid":"accordion-item-29",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-29",children:t("faq.q29")}),d.jsx(Cs,{"data-testid":"accordion-content-29",children:t("faq.a29")})]}),d.jsxs(Ss,{value:"item-30","data-testid":"accordion-item-30",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-30",children:t("faq.q30")}),d.jsx(Cs,{"data-testid":"accordion-content-30",children:t("faq.a30")})]})]})})]}),d.jsxs(Ti,{className:"mb-8","data-testid":"card-faq-map",children:[d.jsx(In,{children:d.jsx(kn,{"data-testid":"text-faq-map-title",children:t("faq.mapTitle")})}),d.jsx(Ji,{children:d.jsxs(fh,{type:"single",collapsible:!0,className:"w-full",children:[d.jsxs(Ss,{value:"item-31","data-testid":"accordion-item-31",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-31",children:t("faq.q31")}),d.jsx(Cs,{"data-testid":"accordion-content-31",children:t("faq.a31")})]}),d.jsxs(Ss,{value:"item-32","data-testid":"accordion-item-32",children:[d.jsx(Ts,{"data-testid":"accordion-trigger-32",children:t("faq.q32")}),d.jsx(Cs,{"data-testid":"accordion-content-32",children:t("faq.a32")})]})]})})]}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-muted-foreground mb-4","data-testid":"text-faq-cta",children:t("faq.stillNeedHelp")}),d.jsx(yr,{href:"/messages","data-testid":"link-contact-support",children:d.jsx(tt,{size:"lg","data-testid":"button-contact-support",children:d.jsx("span",{"data-testid":"text-contact-support-button",children:t("faq.contactSupport")})})})]})]})})}var gAe="Separator",Pq="horizontal",yAe=["horizontal","vertical"],sre=K.forwardRef((t,e)=>{const{decorative:i,orientation:n=Pq,...o}=t,c=_Ae(n)?n:Pq,r=i?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return d.jsx(vn.div,{"data-orientation":c,...r,...o,ref:e})});sre.displayName=gAe;function _Ae(t){return yAe.includes(t)}var ore=sre;const mm=K.forwardRef(({className:t,orientation:e="horizontal",decorative:i=!0,...n},o)=>d.jsx(ore,{ref:o,decorative:i,orientation:e,className:nn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));mm.displayName=ore.displayName;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:are,setPrototypeOf:Nq,isFrozen:vAe,getPrototypeOf:xAe,getOwnPropertyDescriptor:bAe}=Object;let{freeze:oc,seal:Vu,create:TO}=Object,{apply:CO,construct:EO}=typeof Reflect<"u"&&Reflect;oc||(oc=function(e){return e});Vu||(Vu=function(e){return e});CO||(CO=function(e,i){for(var n=arguments.length,o=new Array(n>2?n-2:0),c=2;c<n;c++)o[c-2]=arguments[c];return e.apply(i,o)});EO||(EO=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return new e(...n)});const rI=ac(Array.prototype.forEach),wAe=ac(Array.prototype.lastIndexOf),Mq=ac(Array.prototype.pop),SS=ac(Array.prototype.push),SAe=ac(Array.prototype.splice),XI=ac(String.prototype.toLowerCase),Hj=ac(String.prototype.toString),Gj=ac(String.prototype.match),TS=ac(String.prototype.replace),TAe=ac(String.prototype.indexOf),CAe=ac(String.prototype.trim),dd=ac(Object.prototype.hasOwnProperty),Kl=ac(RegExp.prototype.test),CS=EAe(TypeError);function ac(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return CO(t,e,n)}}function EAe(t){return function(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return EO(t,i)}}function Wr(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:XI;Nq&&Nq(t,null);let n=e.length;for(;n--;){let o=e[n];
vendor: 6,872 bytes, line 3721
3721if(typeof o=="string"){const c=i(o);c!==o&&(vAe(e)||(e[n]=c),o=c)}t[o]=!0}return t}function AAe(t){for(let e=0;e<t.length;e++)dd(t,e)||(t[e]=null);return t}function gh(t){const e=TO(null);for(const[i,n]of are(t))dd(t,i)&&(Array.isArray(n)?e[i]=AAe(n):n&&typeof n=="object"&&n.constructor===Object?e[i]=gh(n):e[i]=n);return e}function ES(t,e){for(;t!==null;){const n=bAe(t,e);if(n){if(n.get)return ac(n.get);if(typeof n.value=="function")return ac(n.value)}t=xAe(t)}function i(){return null}return i}const Dq=oc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Wj=oc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Kj=oc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),IAe=oc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Zj=oc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),kAe=oc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rq=oc(["#text"]),jq=oc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xj=oc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),zq=oc(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","
3721subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),sI=oc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),PAe=Vu(/\{\{[\w\W]*|[\w\W]*\}\}/gm),NAe=Vu(/<%[\w\W]*|[\w\W]*%>/gm),MAe=Vu(/\$\{[\w\W]*/gm),DAe=Vu(/^data-[\-\w.\u00B7-\uFFFF]+$/),RAe=Vu(/^aria-[\-\w]+$/),lre=Vu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jAe=Vu(/^(?:\w+script|data):/i),zAe=Vu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cre=Vu(/^html$/i),LAe=Vu(/^[a-z][.\w]*(-[.\w]+)+$/i);var Lq=Object.freeze({__proto__:null,ARIA_ATTR:RAe,ATTR_WHITESPACE:zAe,CUSTOM_ELEMENT:LAe,DATA_ATTR:DAe,DOCTYPE_NAME:cre,ERB_EXPR:NAe,IS_ALLOWED_URI:lre,IS_SCRIPT_OR_DATA:jAe,MUSTACHE_EXPR:PAe,TMPLIT_EXPR:MAe});const AS={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},OAe=function(){return typeof window>"u"?null:window},FAe=function(e,i){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(n=i.getAttribute(o));const c="dompurify"+(n?"#"+n:"");try{return e.createPolicy(c,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Oq=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ure(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:OAe();const e=Ve=>ure(Ve);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==AS.document||!t.Element)return e.isSupported=!1,e;let{document:i}=t;const n=i,o=n.currentScript,{DocumentFragment:c,HTMLTemplateElement:f,Node:r,Element:x,NodeFilter:S,NamedNodeMap:C=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:I,DOMParser:N,trustedTypes:D}=t,V=x.prototype,B=ES(V,"cloneNode"),W=ES(V,"remove"),$=ES(V,"nextSibling"),G=ES(V,"childNodes"),te=ES(V,"parentNode");if(typeof f=="function"){const Ve=i.createElement("template");Ve.content&&Ve.content.ownerDocument&&(i=Ve.content.ownerDocument)}let ce,_e="";const{implementation:Te,createNodeIterator:we,createDocumentFragment:Ne,getElementsByTagName:pe}=i,{importNode:Pe}=n;let De=Oq();e.isSupported=typeof are=="function"&&typeof te=="function"&&Te&&Te.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Je,ERB_EXPR:dt,TMPLIT_EXPR:At,DATA_ATTR:qt,ARIA_ATTR:kt,IS_SCRIPT_OR_DATA:Vt,ATTR_WHITESPACE:Fe,CUSTOM_ELEMENT:lt}=Lq;let{IS_ALLOWED_URI:pt}=Lq,Ge=null;const Rt=Wr({},[...Dq,...Wj,...Kj,...Zj,...Rq]);let Ot=null;const Ci=Wr({},[...jq,...Xj,...zq,...sI]);let Hi=Object.seal(TO(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ei=null,si=null;const Oi=Object.seal(TO(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ei=!0,Ai=!0,Xi=!1,Nn=!0,zi=!1,Gi=!0,Sr=!1,Kr=!1,rs=!1,Yn=!1,Ys=!1,Ia=!1,Qs=!0,ot=!1;const Pt="user-content-";let $t=!0,Li=!1,wi={},pi=null;const en=Wr({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let jn=null;const ss=Wr({},["audio","video","img","source","image","track"]);let es=null;const dl=Wr({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ta="http://www.w3.org/1998/Math/MathML",Fr="http://www.w3.org/2000/svg",co="http://www.w3.org/1999/xhtml";let qo=co,ia=!1,Qe=null;const Di=Wr({},[ta,Fr,co],Hj);let bn=Wr({},["mi","mo","mn","ms","mtext"]),Br=Wr({},["annotation-xml"]);const na=Wr({},["title","style","font","a","script"]);let yo=null;const Mo=["application/xhtml+xml","text/html"],hu="text/html";let qs=null,pu=null;const Hd=i.createElement("form"),Tt=function(Ee){return Ee instanceof RegExp||Ee instanceof Function},Nl=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pu&&pu===Ee)){if((!Ee||typeof Ee!="object")&&(Ee={}
vendor: 6,216 bytes, line 3721
3721),Ee=gh(Ee),yo=Mo.indexOf(Ee.PARSER_MEDIA_TYPE)===-1?hu:Ee.PARSER_MEDIA_TYPE,qs=yo==="application/xhtml+xml"?Hj:XI,Ge=dd(Ee,"ALLOWED_TAGS")?Wr({},Ee.ALLOWED_TAGS,qs):Rt,Ot=dd(Ee,"ALLOWED_ATTR")?Wr({},Ee.ALLOWED_ATTR,qs):Ci,Qe=dd(Ee,"ALLOWED_NAMESPACES")?Wr({},Ee.ALLOWED_NAMESPACES,Hj):Di,es=dd(Ee,"ADD_URI_SAFE_ATTR")?Wr(gh(dl),Ee.ADD_URI_SAFE_ATTR,qs):dl,jn=dd(Ee,"ADD_DATA_URI_TAGS")?Wr(gh(ss),Ee.ADD_DATA_URI_TAGS,qs):ss,pi=dd(Ee,"FORBID_CONTENTS")?Wr({},Ee.FORBID_CONTENTS,qs):en,ei=dd(Ee,"FORBID_TAGS")?Wr({},Ee.FORBID_TAGS,qs):gh({}),si=dd(Ee,"FORBID_ATTR")?Wr({},Ee.FORBID_ATTR,qs):gh({}),wi=dd(Ee,"USE_PROFILES")?Ee.USE_PROFILES:!1,Ei=Ee.ALLOW_ARIA_ATTR!==!1,Ai=Ee.ALLOW_DATA_ATTR!==!1,Xi=Ee.ALLOW_UNKNOWN_PROTOCOLS||!1,Nn=Ee.ALLOW_SELF_CLOSE_IN_ATTR!==!1,zi=Ee.SAFE_FOR_TEMPLATES||!1,Gi=Ee.SAFE_FOR_XML!==!1,Sr=Ee.WHOLE_DOCUMENT||!1,Yn=Ee.RETURN_DOM||!1,Ys=Ee.RETURN_DOM_FRAGMENT||!1,Ia=Ee.RETURN_TRUSTED_TYPE||!1,rs=Ee.FORCE_BODY||!1,Qs=Ee.SANITIZE_DOM!==!1,ot=Ee.SANITIZE_NAMED_PROPS||!1,$t=Ee.KEEP_CONTENT!==!1,Li=Ee.IN_PLACE||!1,pt=Ee.ALLOWED_URI_REGEXP||lre,qo=Ee.NAMESPACE||co,bn=Ee.MATHML_TEXT_INTEGRATION_POINTS||bn,Br=Ee.HTML_INTEGRATION_POINTS||Br,Hi=Ee.CUSTOM_ELEMENT_HANDLING||{},Ee.CUSTOM_ELEMENT_HANDLING&&Tt(Ee.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Hi.tagNameCheck=Ee.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ee.CUSTOM_ELEMENT_HANDLING&&Tt(Ee.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Hi.attributeNameCheck=Ee.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ee.CUSTOM_ELEMENT_HANDLING&&typeof Ee.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Hi.allowCustomizedBuiltInElements=Ee.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),zi&&(Ai=!1),Ys&&(Yn=!0),wi&&(Ge=Wr({},Rq),Ot=[],wi.html===!0&&(Wr(Ge,Dq),Wr(Ot,jq)),wi.svg===!0&&(Wr(Ge,Wj),Wr(Ot,Xj),Wr(Ot,sI)),wi.svgFilters===!0&&(Wr(Ge,Kj),Wr(Ot,Xj),Wr(Ot,sI)),wi.mathMl===!0&&(Wr(Ge,Zj),Wr(Ot,zq),Wr(Ot,sI))),Ee.ADD_TAGS&&(typeof Ee.ADD_TAGS=="function"?Oi.tagCheck=Ee.ADD_TAGS:(Ge===Rt&&(Ge=gh(Ge)),Wr(Ge,Ee.ADD_TAGS,qs))),Ee.ADD_ATTR&&(typeof Ee.ADD_ATTR=="function"?Oi.attributeCheck=Ee.ADD_ATTR:(Ot===Ci&&(Ot=gh(Ot)),Wr(Ot,Ee.ADD_ATTR,qs))),Ee.ADD_URI_SAFE_ATTR&&Wr(es,Ee.ADD_URI_SAFE_ATTR,qs),Ee.FORBID_CONTENTS&&(pi===en&&(pi=gh(pi)),Wr(pi,Ee.FORBID_CONTENTS,qs)),Ee.ADD_FORBID_CONTENTS&&(pi===en&&(pi=gh(pi)),Wr(pi,Ee.ADD_FORBID_CONTENTS,qs)),$t&&(Ge["#text"]=!0),Sr&&Wr(Ge,["html","head","body"]),Ge.table&&(Wr(Ge,["tbody"]),delete ei.tbody),Ee.TRUSTED_TYPES_POLICY){if(typeof Ee.TRUSTED_TYPES_POLICY.createHTML!="function")throw CS('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ee.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw CS('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ce=Ee.TRUSTED_TYPES_POLICY,_e=ce.createHTML("")}else ce===void 0&&(ce=FAe(D,o)),ce!==null&&typeof _e=="string"&&(_e=ce.createHTML(""));oc&&oc(Ee),pu=Ee}},Gd=Wr({},[...Wj,...Kj,...IAe]),Wd=Wr({},[...Zj,...kAe]),Pn=function(Ee){let Ye=te(Ee);(!Ye||!Ye.tagName)&&(Ye={namespaceURI:qo,tagName:"template"});const It=XI(Ee.tagName),vi=XI(Ye.tagName);return Qe[Ee.namespaceURI]?Ee.namespaceURI===Fr?Ye.namespaceURI===co?It==="svg":Ye.namespaceURI===ta?It==="svg"&&(vi==="annotation-xml"||bn[vi]):!!Gd[It]:Ee.namespaceURI===ta?Ye.namespaceURI===co?It==="math":Ye.namespaceURI===Fr?It==="math"&&Br[vi]:!!Wd[It]:Ee.namespaceURI===co?Ye.namespaceURI===Fr&&!Br[vi]||Ye.namespaceURI===ta&&!bn[vi]?!1:!Wd[It]&&(na[It]||!Gd[It]):!!(yo==="application/xhtml+xml"&&Qe[Ee.namespaceURI]):!1},Ms=function(Ee){SS(e.removed,{element:Ee});try{te(Ee).removeChild(Ee)}catch{W(Ee)}},Vc=function(Ee,Ye){try{SS(e.removed,{attribute:Ye.getAttributeNode(Ee),from:Ye})}catch{SS(e.removed,{attribute:null,from:Ye})}if(Ye.removeAttribute(Ee),Ee==="is")if(Yn||Ys)try{Ms(Ye)}catch{}else try{Ye.setAttribute(Ee,"")}catch{}},Kd=function(Ee){let Ye=null,It=null;if(rs)Ee="<remove></remove>"+Ee;else{const di=Gj(Ee,/^[\r\n\t ]+/);It=di&&di[0]}yo==="application/xhtml+xml"&&qo===co&&(Ee='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ee+"</body></html>");const vi=ce?ce.createHTML(Ee):Ee;if(qo===co)try{Ye=new N().parseFromString(vi,yo)}catch{}if(!Ye||!Ye.documentElement){Ye=Te.createDocument(qo,"template",null);try{Ye.documentElement.innerHTML=ia?_e:vi}catch{}}const bi=Ye.body||Ye.documentElement;return Ee&&It&&bi.insertBefore(i.createTextNode(It),bi.childNodes[0]||null),qo===co?pe.call(Ye,Sr?"html":"body")[0]:Sr?Ye.documentElement:bi},We=function(Ee){return we.call(Ee.ownerDocument||Ee,Ee,S.SHOW_ELEMENT|S.SHOW_COMMENT|S.SHOW_TEXT|S.SHOW_PROCESSING_INSTRUCTION|S.SHOW_CDATA_SECTION,null)},ie=function(Ee){return Ee instanceof I&&(typeof Ee.nodeName!="string"||typeof Ee.textContent!="string"||typeof Ee.removeChild!="function"||!(Ee.attributes instanceof C)||typeof Ee.removeAttribute!="function"||typeof Ee.setAttribute!="function"||typeof Ee.namespaceURI!="string"||typeof Ee.insertBefore!="function"||typeof Ee.hasChildNodes!="function")},re=function(Ee){return typeof r=="function"&&Ee instanceof r};function ge(Ve,Ee,Ye){rI(Ve,It=>{It.call(e,Ee,Ye,pu)})}const ze=function(Ee){let Ye=null;if(ge(De.beforeSanitizeElements,Ee,null),ie(Ee))return Ms(Ee),!0;const It=qs(Ee.nodeName);if(ge(De.uponSanitizeElement,Ee,{tagName:It,allowedTags:Ge}),Gi&&Ee.hasChildNodes()&&!re(Ee.firstElementChild)&&Kl(/<[/\w!]/g,Ee.innerHTML)&&Kl(/<[/\w!]/g,Ee.textContent)||Ee.nodeType===AS.progressingInstruction||Gi&&Ee.nodeType===AS.comment&&Kl(/<[/\w]/g,Ee.data))return Ms(Ee),!0;if(!(Oi.tagCheck instanceof Function&&Oi.tagCheck(It))&&(!Ge[It]||ei[It])){if(!ei[It]&&Ue(It)&&(Hi.tagNameCheck instanceof RegExp&&Kl(Hi.tagNameCheck,It)||Hi.tagNameCheck instanceof Function&&Hi.tagNameCheck(It)))return!1;if($t&&!pi[It]){const vi=te(Ee)||Ee.parentNode,bi=G(Ee)||Ee.childNodes;if(bi&&vi){const di=bi.length;for(let Wi=di-1;Wi>=0;--Wi){const ln=B(bi[Wi],!0);ln.__removalCount=(Ee.__removalCount||0)+1,vi.insertBefore(ln,$(Ee))}}}return Ms(Ee),!0}return Ee instanceof x&&!Pn(Ee)||(It==="noscript"||It==="noembed"||It==="noframes")&&Kl(/<\/no(script|embed|frames)/i,Ee.innerHTML)?(Ms(Ee),!0):(zi&&Ee.nodeType===AS.text&&(Ye=Ee.textContent,rI([Je,dt,At],vi=>{Ye=TS(Ye,vi," ")}
3721),Ee.textContent!==Ye&&(SS(e.removed,{element:Ee.cloneNode()}),Ee.textContent=Ye)),ge(De.afterSanitizeElements,Ee,null),!1)},Re=function(Ee,Ye,It){if(Qs&&(Ye==="id"||Ye==="name")&&(It in i||It in Hd))return!1;if(!(Ai&&!si[Ye]&&Kl(qt,Ye))){if(!(Ei&&Kl(kt,Ye))){if(!(Oi.attributeCheck instanceof Function&&Oi.attributeCheck(Ye,Ee))){if(!Ot[Ye]||si[Ye]){if(!(Ue(Ee)&&(Hi.tagNameCheck instanceof RegExp&&Kl(Hi.tagNameCheck,Ee)||Hi.tagNameCheck instanceof Function&&Hi.tagNameCheck(Ee))&&(Hi.attributeNameCheck instanceof RegExp&&Kl(Hi.attributeNameCheck,Ye)||Hi.attributeNameCheck instanceof Function&&Hi.attributeNameCheck(Ye,Ee))||Ye==="is"&&Hi.allowCustomizedBuiltInElements&&(Hi.tagNameCheck instanceof RegExp&&Kl(Hi.tagNameCheck,It)||Hi.tagNameCheck instanceof Function&&Hi.tagNameCheck(It))))return!1}else if(!es[Ye]){if(!Kl(pt,TS(It,Fe,""))){if(!((Ye==="src"||Ye==="xlink:href"||Ye==="href")&&Ee!=="script"&&TAe(It,"data:")===0&&jn[Ee])){if(!(Xi&&!Kl(Vt,TS(It,Fe,"")))){if(It)return!1}}}}}}}return!0},Ue=function(Ee){return Ee!=="annotation-xml"&&Gj(Ee,lt)},rt=function(Ee){ge(De.beforeSanitizeAttributes,Ee,null);const{attributes:Ye}=Ee;if(!Ye||ie(Ee))return;const It={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ot,forceKeepAttr:void 0};let vi=Ye.length;for(;vi--;){const bi=Ye[vi],{name:di,namespaceURI:Wi,value:ln}=bi,Hn=qs(di),Zr=ln;let _r=di==="value"?Zr:CAe(Zr);if(It.attrName=Hn,It.attrValue=_r,It.keepAttr=!0,It.forceKeepAttr=void 0,ge(De.uponSanitizeAttribute,Ee,It),_r=It.attrValue,ot&&(Hn==="id"||Hn==="name")&&(Vc(di,Ee),_r=Pt+_r),Gi&&Kl(/((--!?|])>)|<\/(style|title|textarea)/i,_r)){Vc(di,Ee);continue}if(Hn==="attributename"&&Gj(_r,"href")){Vc(di,Ee);continue}if(It.forceKeepAttr)continue;if(!It.keepAttr){Vc(di,Ee);continue}if(!Nn&&Kl(/\/>/i,_r)){Vc(di,Ee);continue}zi&&rI([Je,dt,At],ps=>{_r=TS(_r,ps," ")});const xs=qs(Ee.nodeName);if(!Re(xs,Hn,_r)){Vc(di,Ee);continue}if(ce&&typeof D=="object"&&typeof D.getAttributeType=="function"&&!Wi)switch(D.getAttributeType(xs,Hn)){case"TrustedHTML":{_r=ce.createHTML(_r);break}case"TrustedScriptURL":{_r=ce.createScriptURL(_r);break}}if(_r!==Zr)try{Wi?Ee.setAttributeNS(Wi,di,_r):Ee.setAttribute(di,_r),ie(Ee)?Ms(Ee):Mq(e.removed)}catch{Vc(di,Ee)}}ge(De.afterSanitizeAttributes,Ee,null)},He=function Ve(Ee){let Ye=null;const It=We(Ee);for(ge(De.beforeSanitizeShadowDOM,Ee,null);Ye=It.nextNode();)ge(De.uponSanitizeShadowNode,Ye,null),ze(Ye),rt(Ye),Ye.content instanceof c&&Ve(Ye.content);ge(De.afterSanitizeShadowDOM,Ee,null)};return e.sanitize=function(Ve){let Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ye=null,It=null,vi=null,bi=null;if(ia=!Ve,ia&&(Ve="<!-->"),typeof Ve!="string"&&!re(Ve))if(typeof Ve.toString=="function"){if(Ve=Ve.toString(),typeof Ve!="string")throw CS("dirty is not a string, aborting")}else throw CS("toString is not a function");if(!e.isSupported)return Ve;if(Kr||Nl(Ee),e.removed=[],typeof Ve=="string"&&(Li=!1),Li){if(Ve.nodeName){const ln=qs(Ve.nodeName);if(!Ge[ln]||ei[ln])throw CS("root node is forbidden and cannot be sanitized in-place")}}else if(Ve instanceof r)Ye=Kd("<!---->"),It=Ye.ownerDocument.importNode(Ve,!0),It.nodeType===AS.element&&It.nodeName==="BODY"||It.nodeName==="HTML"?Ye=It:Ye.appendChild(It);else{if(!Yn&&!zi&&!Sr&&Ve.indexOf("<")===-1)return ce&&Ia?ce.createHTML(Ve):Ve;if(Ye=Kd(Ve),!Ye)return Yn?null:Ia?_e:""}Ye&&rs&&Ms(Ye.firstChild);const di=We(Li?Ve:Ye);for(;vi=di.nextNode();)ze(vi),rt(vi),vi.content instanceof c&&He(vi.content);if(Li)return Ve;if(Yn){if(Ys)for(bi=Ne.call(Ye.ownerDocument);Ye.firstChild;)bi.appendChild(Ye.firstChild);else bi=Ye;return(Ot.shadowroot||Ot.shadowrootmode)&&(bi=Pe.call(n,bi,!0)),bi}let Wi=Sr?Ye.outerHTML:Ye.innerHTML;return Sr&&Ge["!doctype"]&&Ye.ownerDocument&&Ye.ownerDocument.doctype&&Ye.ownerDocument.doctype.name&&Kl(cre,Ye.ownerDocument.doctype.name)&&(Wi="<!DOCTYPE "+Ye.ownerDocument.doctype.name+`> 3722`+Wi),zi&&rI([Je,dt,At],ln=>{Wi=TS(Wi,ln," ")}),ce&&Ia?ce.createHTML(Wi):Wi},e.setConfig=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Nl(Ve),Kr=!0},e.clearConfig=function(){pu=null,Kr=!1},e.isValidAttribute=function(Ve,Ee,Ye){pu||Nl({});const It=qs(Ve),vi=qs(Ee);return Re(It,vi,Ye)},e.addHook=function(Ve,Ee){typeof Ee=="function"&&SS(De[Ve],Ee)},e.removeHook=function(Ve,Ee){if(Ee!==void 0){const Ye=wAe(De[Ve],Ee);return Ye===-1?void 0:SAe(De[Ve],Ye,1)[0]}return Mq(De[Ve])},e.removeHooks=function(Ve){De[Ve]=[]},e.removeAllHooks=function(){De=Oq()},e}var eP=ure();const BAe=new Set(["color","text-align","font-size"]),Fq=48;let Bq=!1;Bq||(Bq=!0,eP.addHook("uponSanitizeAttribute",(t,e)=>{if(e.attrName==="style"){const n=t.style,o=[];for(let c=0;c<n.length;c++){const f=n[c];if(BAe.has(f)){let r=n.getPropertyValue(f);if(f==="font-size"){const x=parseFloat(r);(isNaN(x)||x>Fq)&&(r=`${Fq}px`)}o.push(`${f}: ${r}`)}}o.length>0?e.attrValue=o.join("; "):(e.attrValue="",e.keepAttr=!1)}}));function UAe(t){return!/<[a-z][\s\S]*>/i.test(t)}function tP(t){if(!t)return"";const e=document.createElement("div");return e.innerHTML=eP.sanitize(t),e.textContent||e.innerText||""}function VAe({html:t,className:e="",dataTestId:i}){const n=K.useMemo(()=>t?UAe(t)?t.split(` 3723`).map(o=>{const c=eP.sanitize(o);return c?`<p>${c}</p>`:"<p><br></p>"}).join(""):eP.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","u","span","ul","ol","li"],ALLOWED_ATTR:["style"]}):"",[t]);return d.jsx("div",{className:`prose prose-sm max-w-none dark:prose-invert ${e}`,dangerouslySetInnerHTML:{__html:n},"data-testid":i})}function $Ae(){var Fe,lt,pt,Ge,Rt,Ot,Ci,Hi,ei,si,Oi,Ei,Ai,Xi,Nn,zi;const{t}=pr(),[,e]=uE("/listings/:id"),[,i]=$o(),{isAuthenticated:n,user:o}=Ka(),{toast:c}=ks(),[f,r]=K.useState(""),[x,S]=K.useState(""),[C,I]=K.useState(0),N=e==null?void 0:e.id,{data:D,isLoading:V}=Xn({queryKey:["/api/listings",N],queryFn:async()=>{const Gi=await fetch(`/api/listings/${N}`);if(!Gi.ok){if(Gi.status===404)return null;throw new Error(`${Gi.status}: ${Gi.statusText}`)}return Gi.json()},enabled:!!N}),{data:B}
3723=Xn({queryKey:["/api/wallets/my-wallet"],enabled:n}),W=(Fe=D==null?void 0:D.user)==null?void 0:Fe.id,{data:$,refetch:G}=Xn({queryKey:["/api/recommendations",W],queryFn:async()=>{const Gi=await fetch(`/api/recommendations/${W}`);if(!Gi.ok)throw new Error("Failed to fetch");return Gi.json()},enabled:!!W}),te=$n({mutationFn:async()=>$!=null&&$.hasRecommended?xn("DELETE",`/api/recommendations/${W}`):xn("POST",`/api/recommendations/${W}`),onSuccess:()=>{G()},onError:Gi=>{c({title:t("common.error","Errore"),description:Gi.message,variant:"destructive"})}}),ce=(D==null?void 0:D.serviceType)==="volunteer_request",{data:_e}=Xn({queryKey:["/api/volunteer/reward"],enabled:ce}),Te=D!=null&&D.priceCredits&&parseFloat(D.priceCredits)>0?D.priceCredits:(_e==null?void 0:_e.amount)??"50",we=ce?"/volunteer":"/",Ne=$n({mutationFn:Gi=>xn("POST","/api/orders",Gi),onSuccess:()=>{c({title:t("listingDetail.orderPlaced"),description:t("listingDetail.orderPlacedDesc")}),Qi.invalidateQueries({queryKey:["/api/wallets/my-wallet"]}),Qi.invalidateQueries({queryKey:["/api/orders"]}),i("/dashboard")},onError:Gi=>{c({title:t("listingDetail.orderFailed"),description:Gi.message||t("listingDetail.orderError"),variant:"destructive"})}}),pe=$n({mutationFn:Gi=>xn("POST","/api/messages",Gi),onSuccess:()=>{i("/messages")},onError:Gi=>{c({title:"Error",description:Gi.message||"Could not send message. Please try again.",variant:"destructive"})}}),Pe=$n({mutationFn:Gi=>xn("POST","/api/volunteer/apply",Gi),onSuccess:()=>{c({title:t("volunteer.applicationSent","Candidatura inviata"),description:t("volunteer.applicationSentDesc","Il richiedente esaminerà la tua candidatura")}),i("/volunteer/my-applications")},onError:Gi=>{c({title:t("common.error","Errore"),description:Gi.message||t("volunteer.applicationError","Impossibile inviare la candidatura"),variant:"destructive"})}}),De=()=>{if(!n){window.location.href="/api/auth/login";return}if(!N)return;const Gi=parseFloat((D==null?void 0:D.priceCredits)||"0"),Sr=parseFloat((B==null?void 0:B.balance)||"0");if(Gi>0&&Sr<Gi){c({title:t("listingDetail.insufficientCredits"),description:t("listingDetail.insufficientCreditsDesc"),variant:"destructive"});return}Ne.mutate({listingId:N,buyerNotes:f||void 0})},Je=()=>{if(!n){window.location.href="/api/auth/login";return}!(D!=null&&D.userId)||!N||pe.mutate({toUserId:D.userId,content:t("listingDetail.interestedMessage",{title:D.title}),listingId:N})},dt=()=>{if(!n){window.location.href="/api/auth/login";return}N&&Pe.mutate({listingId:N,volunteerNotes:x||void 0})},At=$n({mutationFn:async()=>{await xn("DELETE",`/api/listings/${N}`)},onSuccess:()=>{c({title:t("common.success","Successo"),description:t("listing.deleted","Annuncio eliminato con successo")}),Qi.invalidateQueries({queryKey:["/api/listings"]}),i(we)},onError:()=>{c({title:t("common.error","Errore"),description:t("listing.deleteFailed","Errore durante l'eliminazione"),variant:"destructive"})}});if(V)return d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsx("div",{className:"text-muted-foreground",children:t("common.loading")})});if(!D)return d.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center gap-4",children:[d.jsx("div",{className:"text-muted-foreground",children:t("listingDetail.notFound")}),d.jsx(tt,{asChild:!0,"data-testid":"button-back-home",children:d.jsxs(yr,{href:we,children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("listingDetail.backToListings")]})})]});const qt=(o==null?void 0:o.id)===D.userId,kt=(o==null?void 0:o.isAdmin)===!0,Vt=`${((pt=(lt=D.user)==null?void 0:lt.firstName)==null?void 0:pt[0])||""}${((Rt=(Ge=D.user)==null?void 0:Ge.lastName)==null?void 0:Rt[0])||""}`;return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b sticky top-0 z-10 bg-background",children:d.jsxs("div",{className:"container mx-auto px-4 py-4 flex items-center justify-between gap-4",children:[d.jsx(tt,{variant:"ghost",asChild:!0,"data-testid":"button-back",children:d.jsxs(yr,{href:we,children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("listingDetail.backToListings")]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[(qt||kt)&&d.jsxs(tt,{variant:"destructive",size:"sm",onClick:()=>{window.confirm(t("listing.confirmDelete","Sei sicuro di voler eliminare questo annuncio?"))&&At.mutate()},disabled:At.isPending,"data-testid":"button-delete-listing",children:[d.jsx(Ld,{className:"w-4 h-4 mr-2"}),t("common.delete","Elimina")]}),n&&d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-dashboard",children:d.jsx(yr,{href:"/dashboard",children:t("common.dashboard")})})]})]})}),d.jsx("div",{className:"container mx-auto px-4 py-8",children:d.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[d.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[D.images&&D.images.length>0&&d.jsxs("div",{className:"space-y-3",children:[d.jsxs(Ti,{className:"p-0 overflow-hidden bg-black relative",children:[d.jsx("img",{src:D.images[C],alt:`${D.title} - ${C+1}`,className:"w-full h-auto max-h-[600px] object-contain mx-auto","data-testid":"img-listing-main"}),D.images.length>1&&d.jsxs(d.Fragment,{children:[d.jsx(tt,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:()=>I(Gi=>Gi===0?D.images.length-1:Gi-1),"data-testid":"button-prev-image",children:d.jsx(Hve,{className:"h-6 w-6"})}),d.jsx(tt,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:()=>I(Gi=>Gi===D.images.length-1?0:Gi+1),"data-testid":"button-next-image",children:d.jsx(_J,{className:"h-6 w-6"})}),d.jsxs("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 bg-background/80 px-3 py-1 rounded-full text-sm",children:[C+1," / ",D.images.length]})]})]}),D.images.length>1&&d.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:D.images.map((Gi,Sr)=>d.jsx("button",{onClick:()=>I(Sr),className:`flex-shrink-0 w-20 h-20 rounded-lg overflow-hidden border-2 transition-all ${Sr===C?"border-primary ring-2 ring-primary/30":"border-transparent hover:border-muted-foreground
3723/50"}`,"data-testid":`button-thumbnail-${Sr}`,children:d.jsx("img",{src:Gi,alt:`${D.title} - ${Sr+1}`,className:"w-full h-full object-cover"})},Sr))})]}),D.videoUrl&&d.jsx(Ti,{className:"p-0 overflow-hidden bg-black",children:d.jsx("video",{src:D.videoUrl,controls:!0,className:"w-full h-auto max-h-[600px] object-contain mx-auto","data-testid":"video-listing-main",preload:"metadata",children:"Your browser does not support the video tag."})}),d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[d.jsx("h1",{className:"text-3xl font-bold","data-testid":"text-listing-title",children:D.title}),D.category&&d.jsx(En,{variant:"secondary","data-testid":"badge-category",children:t(`categories.${D.category.name}`,D.category.name)})]}),D.city&&d.jsxs("div",{className:"flex items-center justify-between gap-2 mt-2",children:[d.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[d.jsx(fo,{className:"h-4 w-4"}),d.jsxs("span",{"data-testid":"text-location",children:[D.city,D.country?`, ${D.country}`:""]})]}),d.jsx(tt,{variant:"ghost",size:"icon",className:"h-7 w-7 flex-shrink-0",onClick:()=>{var Gi;return i(`/map?userId=${(Gi=D.user)==null?void 0:Gi.id}`)},title:t("listing.viewOnMap","Vedi su mappa"),"data-testid":"button-view-on-map",children:d.jsx(X3,{className:"w-4 h-4"})})]})]}),d.jsx(mm,{}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold mb-3",children:t("listingDetail.description")}),d.jsx(VAe,{html:D.description,className:"text-foreground",dataTestId:"text-description"})]}),d.jsx(mm,{}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:t("listingDetail.aboutSeller")}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsxs(Nc,{className:"h-16 w-16",children:[d.jsx(Rd,{src:((Ot=D.user)==null?void 0:Ot.profileImageUrl)||void 0}),d.jsx(Mc,{children:Vt})]}),d.jsxs("div",{className:"flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("span",{className:"font-medium","data-testid":"text-seller-name",children:[((Ci=D.user)==null?void 0:Ci.firstName)||"Unknown"," ",((Hi=D.user)==null?void 0:Hi.lastName)||""]}),(((ei=D.user)==null?void 0:ei.isProfessional)||((si=D.user)==null?void 0:si.isAdmin))&&d.jsxs(En,{variant:"default",className:"gap-1","data-testid":"badge-professional",children:[d.jsx(GI,{className:"h-3 w-3"}),t("listingDetail.professional")]})]}),((Oi=D.user)==null?void 0:Oi.profession)&&d.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"text-seller-profession",children:D.user.profession})]})]}),((Ei=D.user)==null?void 0:Ei.id)&&!qt&&d.jsxs("div",{className:"flex flex-wrap gap-2 mt-4",children:[d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>i(`/user/${D.user.id}`),"data-testid":"button-view-seller-profile",children:[d.jsx(ju,{className:"h-4 w-4 mr-2"}),t("listingDetail.viewProfile")]}),(((Ai=D.user)==null?void 0:Ai.isProfessional)||((Xi=D.user)==null?void 0:Xi.isAdmin))&&d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>i(`/store/${D.user.id}`),"data-testid":"button-view-seller-store",children:[d.jsx(Bc,{className:"h-4 w-4 mr-2"}),t("listingDetail.viewStore")]}),n&&d.jsxs(tt,{variant:$!=null&&$.hasRecommended?"default":"outline",size:"sm",onClick:()=>te.mutate(),disabled:te.isPending,"data-testid":"button-recommend-seller",children:[d.jsx(R8,{className:"h-4 w-4 mr-2"}),$!=null&&$.hasRecommended?t("listingDetail.recommended","Consigliato"):t("listingDetail.recommend","Consiglio questo inserzionista"),$&&$.count>0&&d.jsx("span",{className:"ml-2 bg-background/20 rounded-full px-1.5 py-0.5 text-xs font-semibold",children:$.count})]}),!n&&$&&$.count>0&&d.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[d.jsx(R8,{className:"h-4 w-4"}),d.jsxs("span",{"data-testid":"text-rec-count",children:[$.count," ",t("listingDetail.recommendations","consigli")]})]})]})]})]}),d.jsx("div",{className:"lg:col-span-1",children:d.jsx(Ti,{className:"p-6 sticky top-24 space-y-6",children:ce?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"bg-primary/10 rounded-lg p-4 border border-primary/20",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(pT,{className:"w-5 h-5 text-primary"}),d.jsx("span",{className:"font-semibold",children:t("volunteer.reward","Compenso")})]}),d.jsxs(En,{variant:"default",className:"text-lg font-bold",children:[Te," CEI"]})]}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("volunteer.platformPays","Pagato automaticamente dalla piattaforma")})]}),d.jsx(mm,{}),D.maxVolunteers&&D.maxVolunteers>1&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d.jsx(Bc,{className:"w-4 h-4 text-primary"}),d.jsx("span",{children:t("volunteer.maxVolunteers","Fino a {{count}} volontari",{count:D.maxVolunteers})})]}),d.jsx(mm,{})]}),D.isRecurring&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d.jsx(Yb,{className:"w-4 h-4 text-primary"}),d.jsx("span",{children:t("volunteer.recurring","Opportunità ricorrente")})]}),d.jsx(mm,{})]}),!qt&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("volunteer.whyVolunteer","Perché vuoi candidarti?")}),d.jsx(Uc,{placeholder:t("volunteer.notesPlaceholder","Raccontaci le tue motivazioni..."),value:x,onChange:Gi=>S(Gi.target.value),rows:4,"data-testid":"input-volunteer-notes"})]}),d.jsx(tt,{className:"w-full",onClick:dt,disabled:Pe.isPending||!D.isActive,"data-testid":"button-apply-volunteer",children:Pe.isPending?t("listingDetail.submitting","Invio..."):d.jsxs(d.Fragment,{children:[d.jsx(pT,{className:"mr-2 h-4 w-4"}),t("volunteer.applyNow","Candidati Ora")]})}),d.jsxs("div",{className:"text-xs text-muted-foreground bg-muted p-3 rounded-md flex gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 shrink-0 mt-0.5 text-primary"}),d.jsx("span",{children:t("volunteer.applicationInfoDynamic",{defaultValue:"Il richiedente valuterà la tua candidatura e potrebbe accettarla. Al completamento del servizio riceverai automaticamente {{amount}} CEI.",amount:Te})})]})]}),qt&&d.jsxs("div",{className:"text-center py-4",children:[d.jsx(pT,{className:"h-12 w-12 mx-auto mb-3 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("volunteer.
3723yourRequest","Questa è la tua richiesta di volontariato")}),d.jsx(tt,{variant:"outline",className:"w-full",asChild:!0,"data-testid":"button-view-applications",children:d.jsx(yr,{href:"/volunteer/my-requests",children:t("volunteer.viewApplications","Vedi Candidature")})})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t("listingDetail.price")}),d.jsx(T4,{priceEuros:D.priceEuros,priceCredits:D.priceCredits,size:"lg"})]}),d.jsx(mm,{}),D.priceCredits&&n&&B&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:t("listingDetail.yourBalance")}),d.jsxs("div",{className:"text-2xl font-bold text-primary","data-testid":"text-wallet-balance",children:[parseFloat(B.balance).toFixed(2)," CEI"]})]}),d.jsx(mm,{})]}),!qt&&!((Nn=D.category)!=null&&Nn.priceOptional)&&d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("listingDetail.notesLabel")}),d.jsx(Uc,{placeholder:t("listingDetail.notesPlaceholder"),value:f,onChange:Gi=>r(Gi.target.value),rows:4,"data-testid":"input-buyer-notes"})]}),!qt&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-3",children:[!((zi=D.category)!=null&&zi.priceOptional)&&!D.requiresContact&&d.jsx(tt,{className:"w-full",onClick:De,disabled:Ne.isPending||!D.isActive,"data-testid":"button-place-order",children:Ne.isPending?t("listingDetail.submitting"):d.jsxs(d.Fragment,{children:[d.jsx(pxe,{className:"mr-2 h-4 w-4"}),t("listingDetail.placeOrder")]})}),D.requiresContact&&d.jsx("div",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-md text-center",children:t("listingDetail.requiresContactInfo")}),d.jsx(tt,{variant:"outline",className:"w-full",onClick:Je,disabled:pe.isPending||!D.isActive,"data-testid":"button-contact-seller",children:pe.isPending?t("listingDetail.submitting"):d.jsxs(d.Fragment,{children:[d.jsx(Cb,{className:"mr-2 h-4 w-4"}),t("listingDetail.contactSeller")]})})]}),D.priceEuros&&d.jsxs("div",{className:"text-xs text-muted-foreground bg-muted p-3 rounded-md",children:[d.jsxs("strong",{children:[t("listingDetail.noteLabel"),":"]})," ",t("listingDetail.euroNote")]}),D.priceCredits&&d.jsxs("div",{className:"text-xs text-muted-foreground bg-muted p-3 rounded-md flex gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 shrink-0 mt-0.5 text-primary"}),d.jsx("span",{children:t("listingDetail.creditsNote")})]})]}),qt&&d.jsxs("div",{className:"text-center py-4",children:[d.jsx(ju,{className:"h-12 w-12 mx-auto mb-3 text-muted-foreground"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t("listingDetail.ownListing")}),d.jsx(tt,{variant:"outline",className:"mt-4 w-full",asChild:!0,"data-testid":"button-edit-listing",children:d.jsx(yr,{href:`/listings/${N}/edit`,children:t("listingDetail.editListing")})})]}),!D.isActive&&!qt&&d.jsx("div",{className:"text-center py-4 bg-destructive/10 rounded-md",children:d.jsx("p",{className:"text-sm text-destructive",children:t("listingDetail.inactive")})})]})})})]})})]})}function dv(){const{user:t,isLoading:e}=Ka(),[i,n]=$o(),o=K.useRef(!1);K.useEffect(()=>{!e&&t&&!t.profileCompleted&&i!=="/profile"&&!o.current&&(o.current=!0,n("/profile")),(t!=null&&t.profileCompleted||!t)&&(o.current=!1)},[t,e,i,n])}var CE=t=>t.type==="checkbox",t_=t=>t instanceof Date,tc=t=>t==null;const dre=t=>typeof t=="object";var Qo=t=>!tc(t)&&!Array.isArray(t)&&dre(t)&&!t_(t),hre=t=>Qo(t)&&t.target?CE(t.target)?t.target.checked:t.target.value:t,qAe=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,pre=(t,e)=>t.has(qAe(e)),HAe=t=>{const e=t.constructor&&t.constructor.prototype;return Qo(e)&&e.hasOwnProperty("isPrototypeOf")},U4=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function tl(t){let e;const i=Array.isArray(t),n=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(U4&&(t instanceof Blob||n))&&(i||Qo(t)))if(e=i?[]:{},!i&&!HAe(t))e=t;else for(const o in t)t.hasOwnProperty(o)&&(e[o]=tl(t[o]));else return t;return e}var TM=t=>Array.isArray(t)?t.filter(Boolean):[],Zo=t=>
3723t===void 0,rn=(t,e,i)=>{if(!e||!Qo(t))return i;const n=TM(e.split(/[,[\].]+?/)).reduce((o,c)=>tc(o)?o:o[c],t);return Zo(n)||n===t?Zo(t[e])?i:t[e]:n},Qc=t=>typeof t=="boolean",V4=t=>/^\w*$/.test(t),fre=t=>TM(t.replace(/["|']|\]/g,"").split(/\.|\[/)),zs=(t,e,i)=>{let n=-1;const o=V4(e)?[e]:fre(e),c=o.length,f=c-1;for(;++n<c;){const r=o[n];let x=i;if(n!==f){const S=t[r];x=Qo(S)||Array.isArray(S)?S:isNaN(+o[n+1])?{}:[]}if(r==="__proto__"||r==="constructor"||r==="prototype")return;t[r]=x,t=t[r]}};const iP={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Ed={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Cp={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},mre=Tn.createContext(null),CM=()=>Tn.useContext(mre),GAe=t=>{const{children:e,...i}=t;return Tn.createElement(mre.Provider,{value:i},e)};var gre=(t,e,i,n=!0)=>{const o={defaultValues:e._defaultValues};for(const c in t)Object.defineProperty(o,c,{get:()=>{const f=c;return e._proxyFormState[f]!==Ed.all&&(e._proxyFormState[f]=!n||Ed.all),i&&(i[f]=!0),t[f]}});return o};function WAe(t){const e=CM(),{control:i=e.control,disabled:n,name:o,exact:c}=t||{},[f,r]=Tn.useState(i._formState),x=Tn.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),S=Tn.useRef(o);return S.current=o,Tn.useEffect(()=>i._subscribe({name:S.current,formState:x.current,exact:c,callback:C=>{!n&&r({...i._formState,...C})}}),[i,n,c]),Tn.useEffect(()=>{x.current.isValid&&i._setValid(!0)},[i]),Tn.useMemo(()=>gre(f,i,x.current,!1),[f,i])}var Lh=t=>typeof t=="string",yre=(t,e,i,n,o)=>Lh(t)?(n&&e.watch.add(t),rn(i,t,o)):Array.isArray(t)?t.map(c=>(n&&e.watch.add(c),rn(i,c))):(n&&(e.watchAll=!0),i);function KAe(t){const e=CM(),{control:i=e.control,name:n,defaultValue:o,disabled:c,exact:f}=t||{},r=Tn.useRef(n),x=Tn.useRef(o);r.current=n,Tn.useEffect(()=>i._subscribe({name:r.current,formState:{values:!0},exact:f,callback:I=>!c&&C(yre(r.current,i._names,I.values||i._formValues,!1,x.current))}),[i,c,f]);const[S,C]=Tn.useState(i._getWatch(n,o));return Tn.useEffect(()=>i._removeUnmounted()),S}function ZAe(t){const e=CM(),{name:i,disabled:n,control:o=e.control,shouldUnregister:c}=t,f=pre(o._names.array,i),r=KAe({control:o,name:i,defaultValue:rn(o._formValues,i,rn(o._defaultValues,i,t.defaultValue)),exact:!0}),x=WAe({control:o,name:i,exact:!0}),S=Tn.useRef(t),C=Tn.useRef(o.register(i,{...t.rules,value:r,...Qc(t.disabled)?{disabled:t.disabled}:{}})),I=Tn.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!rn(x.errors,i)},isDirty:{enumerable:!0,get:()=>!!rn(x.dirtyFields,i)},isTouched:{enumerable:!0,get:()=>!!rn(x.touchedFields,i)},isValidating:{enumerable:!0,get:()=>!!rn(x.validatingFields,i)},error:{enumerable:!0,get:()=>rn(x.errors,i)}}),[x,i]),N=Tn.useCallback(W=>C.current.onChange({target:{value:hre(W),name:i},type:iP.CHANGE}),[i]),D=Tn.useCallback(()=>C.current.onBlur({target:{value:rn(o._formValues,i),name:i},type:iP.BLUR}),[i,o._formValues]),V=Tn.useCallback(W=>{const $=rn(o._fields,i);$&&W&&($._f.ref={focus:()=>W.focus(),select:()=>W.select(),setCustomValidity:G=>W.setCustomValidity(G),reportValidity:()=>W.reportValidity()})},[o._fields,i]),B=Tn.useMemo(()=>({name:i,value:r,...Qc(n)||x.disabled?{disabled:x.disabled||n}:{},onChange:N,onBlur:D,ref:V}),[i,n,x.disabled,N,D,V,r]);return Tn.useEffect(()=>{const W=o._options.shouldUnregister||c;o.register(i,{...S.current.rules,...Qc(S.current.disabled)?{disabled:S.current.disabled}:{}});const $=(G,te)=>{const ce=rn(o._fields,G);ce&&ce._f&&(ce._f.mount=te)};if($(i,!0),W){const G=tl(rn(o._options.defaultValues,i));zs(o._defaultValues,i,G),Zo(rn(o._formValues,i))&&zs(o._formValues,i,G)}return!f&&o.register(i),()=>{(f?W&&!o._state.action:W)?o.unregister(i):$(i,!1)}},[i,o,f,c]),Tn.useEffect(()=>{o._setDisabledField({disabled:n,name:i})},[n,i,o]),Tn.useMemo(()=>({field:B,formState:x,fieldState:I}),[B,x,I])}const XAe=t=>t.render(ZAe(t));var _re=(t,e,i,n,o)=>e?{...i[t],types:{...i[t]&&i[t].types?i[t].types:{},[n]:o||!0}}:{},_T=t=>Array.isArray(t)?t:[t],Uq=()=>{let t=[];return{get observers(){return t},next:o=>{for(const c of t)c.next&&c.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(c=>c!==o)}}),unsubscribe:()=>{t=[]}}},AO=t=>tc(t)||!dre(t);function Em(t,e){if(AO(t)||AO(e))return t===e;if(t_(t)&&t_(e))return t.getTime()===e.getTime();const i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;
vendor: 10,679 bytes, line 3723
3723for(const o of i){const c=t[o];if(!n.includes(o))return!1;if(o!=="ref"){const f=e[o];if(t_(c)&&t_(f)||Qo(c)&&Qo(f)||Array.isArray(c)&&Array.isArray(f)?!Em(c,f):c!==f)return!1}}return!0}var Jl=t=>Qo(t)&&!Object.keys(t).length,$4=t=>t.type==="file",Ad=t=>typeof t=="function",nP=t=>{if(!U4)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},vre=t=>t.type==="select-multiple",q4=t=>t.type==="radio",YAe=t=>q4(t)||CE(t),Yj=t=>nP(t)&&t.isConnected;function QAe(t,e){const i=e.slice(0,-1).length;let n=0;for(;n<i;)t=Zo(t)?n++:t[e[n++]];return t}function JAe(t){for(const e in t)if(t.hasOwnProperty(e)&&!Zo(t[e]))return!1;return!0}function va(t,e){const i=Array.isArray(e)?e:V4(e)?[e]:fre(e),n=i.length===1?t:QAe(t,i),o=i.length-1,c=i[o];return n&&delete n[c],o!==0&&(Qo(n)&&Jl(n)||Array.isArray(n)&&JAe(n))&&va(t,i.slice(0,-1)),t}var xre=t=>{for(const e in t)if(Ad(t[e]))return!0;return!1};function rP(t,e={}){const i=Array.isArray(t);if(Qo(t)||i)for(const n in t)Array.isArray(t[n])||Qo(t[n])&&!xre(t[n])?(e[n]=Array.isArray(t[n])?[]:{},rP(t[n],e[n])):tc(t[n])||(e[n]=!0);return e}function bre(t,e,i){const n=Array.isArray(t);if(Qo(t)||n)for(const o in t)Array.isArray(t[o])||Qo(t[o])&&!xre(t[o])?Zo(e)||AO(i[o])?i[o]=Array.isArray(t[o])?rP(t[o],[]):{...rP(t[o])}:bre(t[o],tc(e)?{}:e[o],i[o]):i[o]=!Em(t[o],e[o]);return i}var IS=(t,e)=>bre(t,e,rP(e));const Vq={value:!1,isValid:!1},$q={value:!0,isValid:!0};var wre=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(i=>i&&i.checked&&!i.disabled).map(i=>i.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Zo(t[0].attributes.value)?Zo(t[0].value)||t[0].value===""?$q:{value:t[0].value,isValid:!0}:$q:Vq}return Vq},Sre=(t,{valueAsNumber:e,valueAsDate:i,setValueAs:n})=>Zo(t)?t:e?t===""?NaN:t&&+t:i&&Lh(t)?new Date(t):n?n(t):t;const qq={isValid:!1,value:null};var Tre=t=>Array.isArray(t)?t.reduce((e,i)=>i&&i.checked&&!i.disabled?{isValid:!0,value:i.value}:e,qq):qq;function Hq(t){const e=t.ref;return $4(e)?e.files:q4(e)?Tre(t.refs).value:vre(e)?[...e.selectedOptions].map(({value:i})=>i):CE(e)?wre(t.refs).value:Sre(Zo(e.value)?t.ref.value:e.value,t)}var eIe=(t,e,i,n)=>{const o={};for(const c of t){const f=rn(e,c);f&&zs(o,c,f._f)}return{criteriaMode:i,names:[...t],fields:o,shouldUseNativeValidation:n}},sP=t=>t instanceof RegExp,kS=t=>Zo(t)?t:sP(t)?t.source:Qo(t)?sP(t.value)?t.value.source:t.value:t,Gq=t=>({isOnSubmit:!t||t===Ed.onSubmit,isOnBlur:t===Ed.onBlur,isOnChange:t===Ed.onChange,isOnAll:t===Ed.all,isOnTouch:t===Ed.onTouched});const Wq="AsyncFunction";var tIe=t=>!!t&&!!t.validate&&!!(Ad(t.validate)&&t.validate.constructor.name===Wq||Qo(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Wq)),iIe=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Kq=(t,e,i)=>!i&&(e.watchAll||e.watch.has(t)||[...e.watch].some(n=>t.startsWith(n)&&/^\.\w+/.test(t.slice(n.length))));const vT=(t,e,i,n)=>{for(const o of i||Object.keys(t)){const c=rn(t,o);if(c){const{_f:f,...r}=c;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],o)&&!n)return!0;if(f.ref&&e(f.ref,f.name)&&!n)return!0;if(vT(r,e))break}else if(Qo(r)&&vT(r,e))break}}};function Zq(t,e,i){const n=rn(t,i);if(n||V4(i))return{error:n,name:i};const o=i.split(".");for(;o.length;){const c=o.join("."),f=rn(e,c),r=rn(t,c);if(f&&!Array.isArray(f)&&i!==c)return{name:i};if(r&&r.type)return{name:c,error:r};o.pop()}return{name:i}}var nIe=(t,e,i,n)=>{i(t);const{name:o,...c}=t;return Jl(c)||Object.keys(c).length>=Object.keys(e).length||Object.keys(c).find(f=>e[f]===(!n||Ed.all))},rIe=(t,e,i)=>!t||!e||t===e||_T(t).some(n=>n&&(i?n===e:n.startsWith(e)||e.startsWith(n))),sIe=(t,e,i,n,o)=>o.isOnAll?!1:!i&&o.isOnTouch?!(e||t):(i?n.isOnBlur:o.isOnBlur)?!t:(i?n.isOnChange:o.isOnChange)?t:!0,oIe=(t,e)=>!TM(rn(t,e)).length&&va(t,e),aIe=(t,e,i)=>{const n=_T(rn(t,i));return zs(n,"root",e[i]),zs(t,i,n),t},YI=t=>Lh(t);function Xq(t,e,i="validate"){if(YI(t)||Array.isArray(t)&&t.every(YI)||Qc(t)&&!t)return{type:i,message:YI(t)?t:"",ref:e}}var Gx=t=>Qo(t)&&!sP(t)?t:{value:t,message:""},Yq=async(t,e,i,n,o,c)=>{const{ref:f,refs:r,required:x,maxLength:S,minLength:C,min:I,max:N,pattern:D,validate:V,name:B,valueAsNumber:W,mount:$}=t._f,G=rn(i,B);if(!$||e.has(B))return{};const te=r?r[0]:f,ce=Je=>{o&&te.reportValidity&&(te.setCustomValidity(Qc(Je)?"":Je||""),te.reportValidity())},_e={},Te=q4(f),we=CE(f),Ne=Te||we,pe=(W||$4(f))&&Zo(f.value)&&Zo(G)||nP(f)&&f.value===""||G===""||Array.isArray(G)&&!G.length,Pe=_re.bind(null,B,n,_e),De=(Je,dt,At,qt=Cp.maxLength,kt=Cp.minLength)=>{const Vt=Je?dt:At;_e[B]={type:Je?qt:kt,message:Vt,ref:f,...Pe(Je?qt:kt,Vt)}};if(c?!Array.isArray(G)||!G.length:x&&(!Ne&&(pe||tc(G))||Qc(G)&&!G||we&&!wre(r).isValid||Te&&!Tre(r).isValid)){const{value:Je,message:dt}=YI(x)?{value:!!x,message:x}:Gx(x);if(Je&&(_e[B]={type:Cp.required,message:dt,ref:te,...Pe(Cp.required,dt)},!n))return ce(dt),_e}if(!pe&&(!tc(I)||!tc(N))){let Je,dt;const At=Gx(N),qt=Gx(I);if(!tc(G)&&!isNaN(G)){const kt=f.valueAsNumber||G&&+G;tc(At.value)||(Je=kt>At.value),tc(qt.value)||(dt=kt<qt.value)}else{const kt=f.valueAsDate||new Date(G),Vt=pt=>new Date(new Date().toDateString()+" "+pt),Fe=f.type=="time",lt=f.type=="week";Lh(At.value)&&G&&(Je=Fe?Vt(G)>Vt(At.value):lt?G>At.value:kt>new Date(At.value)),Lh(qt.value)&&G&&(dt=Fe?Vt(G)<Vt(qt.value):lt?G<qt.value:kt<new Date(qt.value))}if((Je||dt)&&(De(!!Je,At.message,qt.message,Cp.max,Cp.min),!n))return ce(_e[B].message),_e}if((S||C)&&!pe&&(Lh(G)||c&&Array.isArray(G))){const Je=Gx(S),dt=Gx(C),At=!tc(Je.value)&&G.length>+Je.value,qt=!tc(dt.value)&&G.length<+dt.value;if((At||qt)&&(De(At,Je.message,dt.message),!n))return ce(_e[B].message),_e}if(D&&!pe&&Lh(G)){const{value:Je,message:dt}=Gx(D);if(sP(Je)&&!G.match(Je)&&(_e[B]={type:Cp.pattern,message:dt,ref:f,...Pe(Cp.pattern,dt)},!n))return ce(dt),_e}if(V){if(Ad(V)){const Je=await V(G,i),dt=Xq(Je,te);if(dt&&(_e[B]={...dt,...Pe(Cp.validate,dt.message)},!n))return ce(dt.message),_e}else if(Qo(V)){let Je={};for(const dt in V){if(!Jl(Je)&&!n)break;const At=Xq(await V[dt](G,i),te,dt);At&&(Je={...At,...Pe(dt,At.message)},ce(At.message),n&&(_e[B]=Je))}if(!Jl(Je)&&(_e[B]={ref:te,...Je},!n))return _e}}return ce(!0),_e};const lIe={mode:Ed.onSubmit,reValidateMode:Ed.onChange,shouldFocusError:!0};function cIe(t={}){let e={...lIe,...t},i={submitCount:0,isDirty:!1,isLoading:Ad(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const n={};let o=Qo(e.defaultValues)||Qo(e.values)?tl(e.values||e.defaultValues)||{}:{},c=e.shouldUnregister?{}:tl(o),f={action:!1,mount:!1,watch:!1},r={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},x,S=0;const C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let I={...C};const N={array:Uq(),state:Uq()},D=Gq(e.mode),V=Gq(e.reValidateMode),B=e.criteriaMode===Ed.all,W=ot=>Pt=>{clearTimeout(S),S=setTimeout(ot,Pt)},$=async ot=>{if(!e.disabled&&(C.isValid||I.isValid||ot)){const Pt=e.resolver?Jl((await pe()).errors):await De(n,!0);Pt!==i.isValid&&N.state.next({isValid:Pt})}},G=(ot,Pt)=>{!e.disabled&&(C.isValidating||C.validatingFields||I.isValidating||I.validatingFields)&&((ot||Array.from(r.mount)).forEach($t=>{$t&&(Pt?zs(i.validatingFields,$t,Pt):va(i.validatingFields,$t))}),N.state.next({validatingFields:i.validatingFields,isValidating:!Jl(i.validatingFields)}))},te=(ot,Pt=[],$t,Li,wi=!0,pi=!0)=>{if(Li&&$t&&!e.disabled){if(f.action=!0,pi&&Array.isArray(rn(n,ot))){const en=$t(rn(n,ot),Li.argA,Li.argB);wi&&zs(n,ot,en)}if(pi&&Array.isArray(rn(i.errors,ot))){const en=$t(rn(i.errors,ot),Li.argA,Li.argB);wi&&zs(i.errors,ot,en),oIe(i.errors,ot)}if((C.touchedFields||I.touchedFields)&&pi&&Array.isArray(rn(i.touchedFields,ot))){const en=$t(rn(i.touchedFields,ot),Li.argA,Li.argB);wi&&zs(i.touchedFields,ot,en)}(C.dirtyFields||I.dirtyFields)&&(i.dirtyFields=IS(o,c)),N.state.next({name:ot,isDirty:dt(ot,Pt),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else zs(c,ot,Pt)},ce=(ot,Pt)=>{zs(i.errors,ot,Pt),N.state.next({errors:i.errors})},_e=ot=>{i.errors=ot,N.state.next({errors:i.errors,isValid:!1})},Te=(ot,Pt,$t,Li)=>{const wi=rn(n,ot);if(wi){const pi=rn(c,ot,Zo($t)?rn(o,ot):$t);Zo(pi)||Li&&Li.defaultChecked||Pt?zs(c,ot,Pt?pi:Hq(wi._f)):kt(ot,pi),f.mount&&$()}},we=(ot,Pt,$t,Li,wi)=>{let pi=!1,en=!1;const jn={name:ot};if(!e.disabled){if(!$t||Li){(C.isDirty||I.isDirty)&&(en=i.isDirty,i.isDirty=jn.isDirty=dt(),pi=en!==jn.isDirty);const ss=Em(rn(o,ot),Pt);en=!!rn(i.dirtyFields,ot),ss?va(i.dirtyFields,ot):zs(i.dirtyFields,ot,!0),jn.dirtyFields=i.dirtyFields,pi=pi||(C.dirtyFields||I.dirtyFields)&&en!==!ss}if($t){const ss=rn(i.touchedFields,ot);ss||(zs(i.touchedFields,ot,$t),jn.touchedFields=i.touchedFields,pi=pi||(C.touchedFields||I.touchedFields)&&ss!==$t)}pi&&wi&&N.state.next(jn)}return pi?jn:{}},Ne=(ot,Pt,$t,Li)=>{const wi=rn(i.errors,ot),pi=(C.isValid||I.isValid)&&Qc(Pt)&&i.isValid!==Pt;if(e.delayError&&$t?(x=W(()=>ce(ot,$t)),x(e.delayError)):(clearTimeout(S),x=null,$t?zs(i.errors,ot,$t):va(i.errors,ot)),($t?!Em(wi,$t):wi)||!Jl(Li)||pi){const en={...Li,...pi&&Qc(Pt)?{isValid:Pt}:{},errors:i.errors,name:ot};i={...i,...en},N.state.next(en)}},pe=async ot=>{G(ot,!0);const Pt=await e.resolver(c,e.context,eIe(ot||r.mount,n,e.criteriaMode,e.shouldUseNativeValidation));return G(ot),Pt},Pe=async ot=>{const{errors:Pt}=await pe(ot);if(ot)for(const $t of ot){const Li=rn(Pt,$t);Li?zs(i.errors,$t,Li):va(i.errors,$t)}else i.errors=Pt;return Pt},De=async(ot,Pt,$t={valid:!0})=>{for(const Li in ot){const wi=ot[Li];if(wi){const{_f:pi,...en}=wi;if(pi){const jn=r.array.has(pi.name),ss=wi._f&&tIe(wi._f);ss&&C.validatingFields&&G([Li],!0);const es=await Yq(wi,r.disabled,c,B,e.shouldUseNativeValidation&&!Pt,jn);if(ss&&C.validatingFields&&G([Li]),es[pi.name]&&($t.valid=!1,Pt))break;!Pt&&(rn(es,pi.name)?jn?aIe(i.errors,es,pi.name):zs(i.errors,pi.name,es[pi.name]):va(i.errors,pi.name))}!Jl(en)&&await De(en,Pt,$t)}}return $t.valid},Je=()=>{for(const ot of r.unMount){const Pt=rn(n,ot);Pt&&(Pt._f.refs?Pt._f.refs.every($t=>!Yj($t)):!Yj(Pt._f.ref))&&Ei(ot)}r.unMount=new Set},dt=(ot,Pt)=>!e.disabled&&(ot&&Pt&&zs(c,ot,Pt),!Em(Rt(),o)),At=(ot,Pt,$t)=>yre(ot,r,{...f.mount?c:Zo(Pt)?o:Lh(ot)?{[ot]:Pt}:Pt},$t,Pt),qt=ot=>TM(rn(f.mount?c:o,ot,e.shouldUnregister?rn(o,ot,[]):[])),kt=(ot,Pt,$t={})=>{const Li=rn(n,ot);let wi=Pt;if(Li){const pi=Li._f;pi&&(!pi.disabled&&zs(c,ot,Sre(Pt,pi)),wi=nP(pi.ref)&&tc(Pt)?"":Pt,vre(pi.ref)?[...pi.ref.options].forEac
vendor: 9,407 bytes, line 3723
3723h(en=>en.selected=wi.includes(en.value)):pi.refs?CE(pi.ref)?pi.refs.length>1?pi.refs.forEach(en=>(!en.defaultChecked||!en.disabled)&&(en.checked=Array.isArray(wi)?!!wi.find(jn=>jn===en.value):wi===en.value)):pi.refs[0]&&(pi.refs[0].checked=!!wi):pi.refs.forEach(en=>en.checked=en.value===wi):$4(pi.ref)?pi.ref.value="":(pi.ref.value=wi,pi.ref.type||N.state.next({name:ot,values:tl(c)})))}($t.shouldDirty||$t.shouldTouch)&&we(ot,wi,$t.shouldTouch,$t.shouldDirty,!0),$t.shouldValidate&&Ge(ot)},Vt=(ot,Pt,$t)=>{for(const Li in Pt){const wi=Pt[Li],pi=`${ot}.${Li}`,en=rn(n,pi);(r.array.has(ot)||Qo(wi)||en&&!en._f)&&!t_(wi)?Vt(pi,wi,$t):kt(pi,wi,$t)}},Fe=(ot,Pt,$t={})=>{const Li=rn(n,ot),wi=r.array.has(ot),pi=tl(Pt);zs(c,ot,pi),wi?(N.array.next({name:ot,values:tl(c)}),(C.isDirty||C.dirtyFields||I.isDirty||I.dirtyFields)&&$t.shouldDirty&&N.state.next({name:ot,dirtyFields:IS(o,c),isDirty:dt(ot,pi)})):Li&&!Li._f&&!tc(pi)?Vt(ot,pi,$t):kt(ot,pi,$t),Kq(ot,r)&&N.state.next({...i}),N.state.next({name:f.mount?ot:void 0,values:tl(c)})},lt=async ot=>{f.mount=!0;const Pt=ot.target;let $t=Pt.name,Li=!0;const wi=rn(n,$t),pi=en=>{Li=Number.isNaN(en)||t_(en)&&isNaN(en.getTime())||Em(en,rn(c,$t,en))};if(wi){let en,jn;const ss=Pt.type?Hq(wi._f):hre(ot),es=ot.type===iP.BLUR||ot.type===iP.FOCUS_OUT,dl=!iIe(wi._f)&&!e.resolver&&!rn(i.errors,$t)&&!wi._f.deps||sIe(es,rn(i.touchedFields,$t),i.isSubmitted,V,D),ta=Kq($t,r,es);zs(c,$t,ss),es?(wi._f.onBlur&&wi._f.onBlur(ot),x&&x(0)):wi._f.onChange&&wi._f.onChange(ot);const Fr=we($t,ss,es),co=!Jl(Fr)||ta;if(!es&&N.state.next({name:$t,type:ot.type,values:tl(c)}),dl)return(C.isValid||I.isValid)&&(e.mode==="onBlur"?es&&$():es||$()),co&&N.state.next({name:$t,...ta?{}:Fr});if(!es&&ta&&N.state.next({...i}),e.resolver){const{errors:qo}=await pe([$t]);if(pi(ss),Li){const ia=Zq(i.errors,n,$t),Qe=Zq(qo,n,ia.name||$t);en=Qe.error,$t=Qe.name,jn=Jl(qo)}}else G([$t],!0),en=(await Yq(wi,r.disabled,c,B,e.shouldUseNativeValidation))[$t],G([$t]),pi(ss),Li&&(en?jn=!1:(C.isValid||I.isValid)&&(jn=await De(n,!0)));Li&&(wi._f.deps&&Ge(wi._f.deps),Ne($t,jn,en,Fr))}},pt=(ot,Pt)=>{if(rn(i.errors,Pt)&&ot.focus)return ot.focus(),1},Ge=async(ot,Pt={})=>{let $t,Li;const wi=_T(ot);if(e.resolver){const pi=await Pe(Zo(ot)?ot:wi);$t=Jl(pi),Li=ot?!wi.some(en=>rn(pi,en)):$t}else ot?(Li=(await Promise.all(wi.map(async pi=>{const en=rn(n,pi);return await De(en&&en._f?{[pi]:en}:en)}))).every(Boolean),!(!Li&&!i.isValid)&&$()):Li=$t=await De(n);return N.state.next({...!Lh(ot)||(C.isValid||I.isValid)&&$t!==i.isValid?{}:{name:ot},...e.resolver||!ot?{isValid:$t}:{},errors:i.errors}),Pt.shouldFocus&&!Li&&vT(n,pt,ot?wi:r.mount),Li},Rt=ot=>{const Pt={...f.mount?c:o};return Zo(ot)?Pt:Lh(ot)?rn(Pt,ot):ot.map($t=>rn(Pt,$t))},Ot=(ot,Pt)=>({invalid:!!rn((Pt||i).errors,ot),isDirty:!!rn((Pt||i).dirtyFields,ot),error:rn((Pt||i).errors,ot),isValidating:!!rn(i.validatingFields,ot),isTouched:!!rn((Pt||i).touchedFields,ot)}),Ci=ot=>{ot&&_T(ot).forEach(Pt=>va(i.errors,Pt)),N.state.next({errors:ot?i.errors:{}})},Hi=(ot,Pt,$t)=>{const Li=(rn(n,ot,{_f:{}})._f||{}).ref,wi=rn(i.errors,ot)||{},{ref:pi,message:en,type:jn,...ss}=wi;zs(i.errors,ot,{...ss,...Pt,ref:Li}),N.state.next({name:ot,errors:i.errors,isValid:!1}),$t&&$t.shouldFocus&&Li&&Li.focus&&Li.focus()},ei=(ot,Pt)=>Ad(ot)?N.state.subscribe({next:$t=>ot(At(void 0,Pt),$t)}):At(ot,Pt,!0),si=ot=>N.state.subscribe({next:Pt=>{rIe(ot.name,Pt.name,ot.exact)&&nIe(Pt,ot.formState||C,Ys,ot.reRenderRoot)&&ot.callback({values:{...c},...i,...Pt})}}).unsubscribe,Oi=ot=>(f.mount=!0,I={...I,...ot.formState},si({...ot,formState:I})),Ei=(ot,Pt={})=>{for(const $t of ot?_T(ot):r.mount)r.mount.delete($t),r.array.delete($t),Pt.keepValue||(va(n,$t),va(c,$t)),!Pt.keepError&&va(i.errors,$t),!Pt.keepDirty&&va(i.dirtyFields,$t),!Pt.keepTouched&&va(i.touchedFields,$t),!Pt.keepIsValidating&&va(i.validatingFields,$t),!e.shouldUnregister&&!Pt.keepDefaultValue&&va(o,$t);N.state.next({values:tl(c)}),N.state.next({...i,...Pt.keepDirty?{isDirty:dt()}:{}}),!Pt.keepIsValid&&$()},Ai=({disabled:ot,name:Pt})=>{(Qc(ot)&&f.mount||ot||r.disabled.has(Pt))&&(ot?r.disabled.add(Pt):r.disabled.delete(Pt))},Xi=(ot,Pt={})=>{let $t=rn(n,ot);const Li=Qc(Pt.disabled)||Qc(e.disabled);return zs(n,ot,{...$t||{},_f:{...$t&&$t._f?$t._f:{ref:{name:ot}},name:ot,mount:!0,...Pt}}),r.mount.add(ot),$t?Ai({disabled:Qc(Pt.disabled)?Pt.disabled:e.disabled,name:ot}):Te(ot,!0,Pt.value),{...Li?{disabled:Pt.disabled||e.disabled}:{},...e.progressive?{required:!!Pt.required,min:kS(Pt.min),max:kS(Pt.max),minLength:kS(Pt.minLength),maxLength:kS(Pt.maxLength),pattern:kS(Pt.pattern)}:{},name:ot,onChange:lt,onBlur:lt,ref:wi=>{if(wi){Xi(ot,Pt),$t=rn(n,ot);const pi=Zo(wi.value)&&wi.querySelectorAll&&wi.querySelectorAll("input,select,textarea")[0]||wi,en=YAe(pi),jn=$t._f.refs||[];if(en?jn.find(ss=>ss===pi):pi===$t._f.ref)return;zs(n,ot,{_f:{...$t._f,...en?{refs:[...jn.filter(Yj),pi,...Array.isArray(rn(o,ot))?[{}]:[]],ref:{type:pi.type,name:ot}}:{ref:pi}}}),Te(ot,!1,void 0,pi)}else $t=rn(n,ot,{}),$t._f&&($t._f.mount=!1),(e.shouldUnregister||Pt.shouldUnregister)&&!(pre(r.array,ot)&&f.action)&&r.unMount.add(ot)}}},Nn=()=>e.shouldFocusError&&vT(n,pt,r.mount),zi=ot=>{Qc(ot)&&(N.state.next({disabled:ot}),vT(n,(Pt,$t)=>{const Li=rn(n,$t);Li&&(Pt.disabled=Li._f.disabled||ot,Array.isArray(Li._f.refs)&&Li._f.refs.forEach(wi=>{wi.disabled=Li._f.disabled||ot}))},0,!1))},Gi=(ot,Pt)=>async $t=>{let Li;$t&&($t.preventDefault&&$t.preventDefault(),$t.persist&&$t.persist());let wi=tl(c);if(N.state.next({isSubmitting:!0}),e.resolver){const{errors:pi,values:en}=await pe();i.errors=pi,wi=en}else await De(n);if(r.disabled.size)for(const pi of r.disabled)zs(wi,pi,void 0);if(va(i.errors,"root"),Jl(i.errors)){N.state.next({errors:{}});try{await ot(wi,$t)}catch(pi){Li=pi}}else Pt&&await Pt({...i.errors},$t),Nn(),setTimeout(Nn);if(N.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Jl(i.errors)&&!Li,submitCount:i.submitCount+1,errors:i.errors}),Li)throw Li},Sr=(ot,Pt={})=>{rn(n,ot)&&(Zo(Pt.defaultValue)?Fe(ot,tl(rn(o,ot))):(Fe(ot,Pt.defaultValue),zs(o,ot,tl(Pt.defaultValue))),Pt.keepTouched||va(i.touchedFields,ot),Pt.keepDirty||(va(i.dirtyFields,ot),i.isDirty=Pt.defaultValue?dt(ot,tl(rn(o,ot))):dt()),Pt.keepError||(va(i.errors,ot),C.isValid&&$()),N.state.next({...i}))},Kr=(ot,Pt={})=>{const $t=ot?tl(ot):o,Li=tl($t),wi=Jl(ot),pi=wi?o:Li;if(Pt.keepDefaultValues||(o=$t),!Pt.keepValues){if(Pt.keepDirtyValues){const en=new Set([...r.mount,...Object.keys(IS(o,c))]);for(const jn of Array.from(en))rn(i.dirtyFields,jn)?zs(pi,jn,rn(c,jn)):Fe(jn,rn(pi,jn))}else{if(U4&&Zo(ot))for(const en of r.mount){const jn=rn(n,en);if(jn&&jn._f){const ss=Array.isArray(jn._f.refs)?jn._f.refs[0]:jn._f.ref;if(nP(ss)){const es=ss.closest("form");if(es){es.reset();break}}}}for(const en of r.mount)Fe(en,rn(pi,en))}c=tl(pi),N.array.next({values:{...pi}}),N.state.next({values:{...pi}})}r={mount:Pt.keepDirtyValues?r.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!C.isValid||!!Pt.keepIsValid||!!Pt.keepDirtyValues,f.watch=!!e.shouldUnregister,N.state.next({submitCount:Pt.keepSubmitCount?i.submitCount:0,isDirty:wi?!1:Pt.keepDirty?i.isDirty:!!(Pt.keepDefaultValues&&!Em(ot,o)),isSubmitted:Pt.keepIsSubmitted?i.isSubmitted:!1,dirtyFields:wi?{}:Pt.keepDirtyValues?Pt.keepDefaultValues&&c?IS(o,c):i.dirtyFields:Pt.keepDefaultValues&&ot?IS(o,ot):Pt.keepDirty?i.dirtyFields:{},touchedFields:Pt.keepTouched?i.touchedFields:{},errors:Pt.keepErrors?i.errors:{},isSubmitSuccessful:Pt.keepIsSubmitSuccessful?i.isSubmitSuccessful:!1,isSubmitting:!1})},rs=(ot,Pt)=>Kr(Ad(ot)?ot(c):ot,Pt),Yn=(ot,Pt={})=>{const $t=rn(n,ot),Li=$t&&$t._f;if(Li){const wi=Li.refs?Li.refs[0]:Li.ref;wi.focus&&(wi.focus(),Pt.shouldSelect&&Ad(wi.select)&&wi.select())}},Ys=ot=>{i={...i,...ot}},Qs={control:{register:Xi,unregister:Ei,getFieldState:Ot,handleSubmit:Gi,setError:Hi,_subscribe:si,_runSchema:pe,_getWatch:At,_getDirty:dt,_setValid:$,_setFieldArray:te,_setDisabledField:Ai,_setErrors:_e,_getFieldArray:qt,_reset:Kr,_resetDefaultValues:()=>Ad(e.defaultValues)&&e.defaultValues().then(ot=>{rs(ot,e.resetOptions),N.state.next({isLoading:!1})}),_removeUnmounted:Je,_disableForm:zi,_subjects:N,_proxyFormState:C,get _fields(){return n},get _formValues(){return c},get _state(){return f},set _state(ot){f=ot},get _defaultValues(){return o},get _names(){return r},set _names(ot){r=ot},get _formState(){return i},get _options(){return e},set _options(ot){e={...e,...ot}}},subscribe:Oi,trigger:Ge,register:Xi,handleSubmit:Gi,watch:ei,setValue:Fe,getValues:Rt,reset:rs,resetField:Sr,clearErrors:Ci,unregister:Ei,setError:Hi,setFocus:Yn,getFieldState:Ot};return{...Qs,formControl:Qs}}function zg(t={}){const e=Tn.useRef(void 0),i=Tn.useRef(void 0),[n,o]=Tn.useState({isDirty:!1,isValidating:!1,isLoading:Ad(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Ad(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:cIe(t),formState:n},t.formControl&&t.defaultValues&&!Ad(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const c=e.current.control;return c._options=t,Tn.useLayoutEffect(()=>c._subscribe({formState:c._proxyFormState,callback:()=>o({...c._formState}
vendor: 8,888 bytes, line 3723
3723),reRenderRoot:!0}),[c]),Tn.useEffect(()=>c._disableForm(t.disabled),[c,t.disabled]),Tn.useEffect(()=>{if(c._proxyFormState.isDirty){const f=c._getDirty();f!==n.isDirty&&c._subjects.state.next({isDirty:f})}},[c,n.isDirty]),Tn.useEffect(()=>{t.values&&!Em(t.values,i.current)?(c._reset(t.values,c._options.resetOptions),i.current=t.values,o(f=>({...f}))):c._resetDefaultValues()},[t.values,c]),Tn.useEffect(()=>{t.errors&&!Jl(t.errors)&&c._setErrors(t.errors)},[t.errors,c]),Tn.useEffect(()=>{c._state.mount||(c._setValid(),c._state.mount=!0),c._state.watch&&(c._state.watch=!1,c._subjects.state.next({...c._formState})),c._removeUnmounted()}),Tn.useEffect(()=>{t.shouldUnregister&&c._subjects.state.next({values:c._getWatch()})},[t.shouldUnregister,c]),e.current.formState=gre(n,c),e.current}const Qq=(t,e,i)=>{if(t&&"reportValidity"in t){const n=rn(i,e);t.setCustomValidity(n&&n.message||""),t.reportValidity()}},Cre=(t,e)=>{for(const i in e.fields){const n=e.fields[i];n&&n.ref&&"reportValidity"in n.ref?Qq(n.ref,i,t):n.refs&&n.refs.forEach(o=>Qq(o,i,t))}},uIe=(t,e)=>{e.shouldUseNativeValidation&&Cre(t,e);const i={};for(const n in t){const o=rn(e.fields,n),c=Object.assign(t[n]||{},{ref:o&&o.ref});if(dIe(e.names||Object.keys(t),n)){const f=Object.assign({},rn(i,n));zs(f,"root",c),zs(i,n,f)}else zs(i,n,c)}return i},dIe=(t,e)=>t.some(i=>i.startsWith(e+"."));var hIe=function(t,e){for(var i={};t.length;){var n=t[0],o=n.code,c=n.message,f=n.path.join(".");if(!i[f])if("unionErrors"in n){var r=n.unionErrors[0].errors[0];i[f]={message:r.message,type:r.code}}else i[f]={message:c,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(C){return C.errors.forEach(function(I){return t.push(I)})}),e){var x=i[f].types,S=x&&x[n.code];i[f]=_re(f,e,i,o,S?[].concat(S,n.message):n.message)}t.shift()}return i},Lg=function(t,e,i){return i===void 0&&(i={}),function(n,o,c){try{return Promise.resolve(function(f,r){try{var x=Promise.resolve(t[i.mode==="sync"?"parse":"parseAsync"](n,e)).then(function(S){return c.shouldUseNativeValidation&&Cre({},c),{errors:{},values:i.raw?n:S}})}catch(S){return r(S)}return x&&x.then?x.then(void 0,r):x}(0,function(f){if(function(r){return Array.isArray(r==null?void 0:r.errors)}(f))return{values:{},errors:uIe(hIe(f.errors,!c.shouldUseNativeValidation&&c.criteriaMode==="all"),c)};throw f}))}catch(f){return Promise.reject(f)}}},_s;(function(t){t.assertEqual=o=>o;function e(o){}t.assertIs=e;function i(o){throw new Error}t.assertNever=i,t.arrayToEnum=o=>{const c={};for(const f of o)c[f]=f;return c},t.getValidEnumValues=o=>{const c=t.objectKeys(o).filter(r=>typeof o[o[r]]!="number"),f={};for(const r of c)f[r]=o[r];return t.objectValues(f)},t.objectValues=o=>t.objectKeys(o).map(function(c){return o[c]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const c=[];for(const f in o)Object.prototype.hasOwnProperty.call(o,f)&&c.push(f);return c},t.find=(o,c)=>{for(const f of o)if(c(f))return f},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,c=" | "){return o.map(f=>typeof f=="string"?`'${f}'`:f).join(c)}t.joinValues=n,t.jsonStringifyReplacer=(o,c)=>typeof c=="bigint"?c.toString():c})(_s||(_s={}));var IO;(function(t){t.mergeShapes=(e,i)=>({...e,...i})})(IO||(IO={}));const fn=_s.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Op=t=>{switch(typeof t){case"undefined":return fn.undefined;case"string":return fn.string;case"number":return isNaN(t)?fn.nan:fn.number;case"boolean":return fn.boolean;case"function":return fn.function;case"bigint":return fn.bigint;case"symbol":return fn.symbol;case"object":return Array.isArray(t)?fn.array:t===null?fn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?fn.promise:typeof Map<"u"&&t instanceof Map?fn.map:typeof Set<"u"&&t instanceof Set?fn.set:typeof Date<"u"&&t instanceof Date?fn.date:fn.object;default:return fn.unknown}},ki=_s.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),pIe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class su extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=e}format(e){const i=e||function(c){return c.message},n={_errors:[]},o=c=>{for(const f of c.issues)if(f.code==="invalid_union")f.unionErrors.map(o);else if(f.code==="invalid_return_type")o(f.returnTypeError);else if(f.code==="invalid_arguments")o(f.argumentsError);else if(f.path.length===0)n._errors.push(i(f));else{let r=n,x=0;for(;x<f.path.length;){const S=f.path[x];x===f.path.length-1?(r[S]=r[S]||{_errors:[]},r[S]._errors.push(i(f))):r[S]=r[S]||{_errors:[]},r=r[S],x++}}};return o(this),n}static assert(e){if(!(e instanceof su))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_s.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=i=>i.message){const i={},n=[];for(const o of this.issues)o.path.length>0?(i[o.path[0]]=i[o.path[0]]||[],i[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:i}}get formErrors(){return this.flatten()}}su.create=t=>new su(t);const Pb=(t,e)=>{let i;switch(t.code){case ki.invalid_type:t.received===fn.undefined?i="Required":i=`Expected ${t.expected}, received ${t.received}`;break;case ki.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(t.expected,_s.jsonStringifyReplacer)}`;break;case ki.unrecognized_keys:i=`Unrecognized key(s) in object: ${_s.joinValues(t.keys,", ")}`;break;case ki.invalid_union:i="Invalid input";break;case ki.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${_s.joinValues(t.options)}`;break;case ki.invalid_enum_value:i=`Invalid enum value. Expected ${_s.joinValues(t.options)}, received '${t.received}'`;break;case ki.invalid_arguments:i="Invalid function arguments";break;case ki.invalid_return_type:i="Invalid function return type";break;case ki.invalid_date:i="Invalid date";break;case ki.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(i=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?i=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?i=`Invalid input: must end with "${t.validation.endsWith}"`:_s.assertNever(t.validation):t.validation!=="regex"?i=`Invalid ${t.validation}`:i="Invalid";break;case ki.too_small:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:i="Invalid input";break;case ki.too_big:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?i=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:i="Invalid input";break;case ki.custom:i="Invalid input";break;case ki.invalid_intersection_types:i="Intersection results could not be merged";break;case ki.not_multiple_of:i=`Number must be a multiple of ${t.multipleOf}`;break;case ki.not_finite:i="Number must be finite";break;default:i=e.defaultError,_s.assertNever(t)}return{message:i}};let Ere=Pb;function fIe(t){Ere=t}function oP(){return Ere}const aP=t=>{const{data:e,path:i,errorMaps:n,issueData:o}=t,c=[...i,...o.path||[]],f={...o,path:c};if(o.message!==void 0)return{...o,path:c,message:o.message};let r="";
vendor: 4,969 bytes, line 3723
3723const x=n.filter(S=>!!S).slice().reverse();for(const S of x)r=S(f,{data:e,defaultError:r}).message;return{...o,path:c,message:r}},mIe=[];function on(t,e){const i=oP(),n=aP({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,i,i===Pb?void 0:Pb].filter(o=>!!o)});t.common.issues.push(n)}class Al{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,i){const n=[];for(const o of i){if(o.status==="aborted")return ur;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,i){const n=[];for(const o of i){const c=await o.key,f=await o.value;n.push({key:c,value:f})}return Al.mergeObjectSync(e,n)}static mergeObjectSync(e,i){const n={};for(const o of i){const{key:c,value:f}=o;if(c.status==="aborted"||f.status==="aborted")return ur;c.status==="dirty"&&e.dirty(),f.status==="dirty"&&e.dirty(),c.value!=="__proto__"&&(typeof f.value<"u"||o.alwaysSet)&&(n[c.value]=f.value)}return{status:e.value,value:n}}}const ur=Object.freeze({status:"aborted"}),f0=t=>({status:"dirty",value:t}),lc=t=>({status:"valid",value:t}),kO=t=>t.status==="aborted",PO=t=>t.status==="dirty",K_=t=>t.status==="valid",sC=t=>typeof Promise<"u"&&t instanceof Promise;function lP(t,e,i,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Are(t,e,i,n,o){if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var Cn;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Cn||(Cn={}));var HS,GS;class Gh{constructor(e,i,n,o){this._cachedPath=[],this.parent=e,this.data=i,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Jq=(t,e)=>{if(K_(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new su(t.common.issues);return this._error=i,this._error}}};function kr(t){if(!t)return{};const{errorMap:e,invalid_type_error:i,required_error:n,description:o}=t;if(e&&(i||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(f,r)=>{var x,S;const{message:C}=t;return f.code==="invalid_enum_value"?{message:C??r.defaultError}:typeof r.data>"u"?{message:(x=C??n)!==null&&x!==void 0?x:r.defaultError}:f.code!=="invalid_type"?{message:r.defaultError}:{message:(S=C??i)!==null&&S!==void 0?S:r.defaultError}},description:o}}class Lr{get description(){return this._def.description}_getType(e){return Op(e.data)}_getOrReturnCtx(e,i){return i||{common:e.parent.common,data:e.data,parsedType:Op(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Al,ctx:{common:e.parent.common,data:e.data,parsedType:Op(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const i=this._parse(e);if(sC(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(e){const i=this._parse(e);return Promise.resolve(i)}parse(e,i){const n=this.safeParse(e,i);if(n.success)return n.data;throw n.error}safeParse(e,i){var n;const o={common:{issues:[],async:(n=i==null?void 0:i.async)!==null&&n!==void 0?n:!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Op(e)},c=this._parseSync({data:e,path:o.path,parent:o});return Jq(o,c)}"~validate"(e){var i,n;const o={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Op(e)};if(!this["~standard"].async)try{const c=this._parseSync({data:e,path:[],parent:o});return K_(c)?{value:c.value}:{issues:o.common.issues}}catch(c){!((n=(i=c==null?void 0:c.message)===null||i===void 0?void 0:i.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),o.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:o}).then(c=>K_(c)?{value:c.value}:{issues:o.common.issues})}async parseAsync(e,i){const n=await this.safeParseAsync(e,i);if(n.success)return n.data;throw n.error}async safeParseAsync(e,i){const n={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Op(e)},o=this._parse({data:e,path:n.path,parent:n}),c=await(sC(o)?o:Promise.resolve(o));return Jq(n,c)}
vendor: 44,830 bytes, line 3723
3723refine(e,i){const n=o=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(o):i;return this._refinement((o,c)=>{const f=e(o),r=()=>c.addIssue({code:ki.custom,...n(o)});return typeof Promise<"u"&&f instanceof Promise?f.then(x=>x?!0:(r(),!1)):f?!0:(r(),!1)})}refinement(e,i){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof i=="function"?i(n,o):i),!1))}_refinement(e){return new Bd({schema:this,typeName:ar.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return Vh.create(this,this._def)}nullable(){return Tg.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return jd.create(this)}promise(){return Mb.create(this,this._def)}or(e){return cC.create([this,e],this._def)}and(e){return uC.create(this,e,this._def)}transform(e){return new Bd({...kr(this._def),schema:this,typeName:ar.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const i=typeof e=="function"?e:()=>e;return new mC({...kr(this._def),innerType:this,defaultValue:i,typeName:ar.ZodDefault})}brand(){return new H4({typeName:ar.ZodBranded,type:this,...kr(this._def)})}catch(e){const i=typeof e=="function"?e:()=>e;return new gC({...kr(this._def),innerType:this,catchValue:i,typeName:ar.ZodCatch})}describe(e){const i=this.constructor;return new i({...this._def,description:e})}pipe(e){return EE.create(this,e)}readonly(){return yC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gIe=/^c[^\s-]{8,}$/i,yIe=/^[0-9a-z]+$/,_Ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vIe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,xIe=/^[a-z0-9_-]{21}$/i,bIe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wIe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,SIe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,TIe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qj;const CIe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,EIe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,AIe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,IIe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,kIe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PIe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ire="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",NIe=new RegExp(`^${Ire}$`);function kre(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function MIe(t){return new RegExp(`^${kre(t)}$`)}function Pre(t){let e=`${Ire}T${kre(t)}`;const i=[];return i.push(t.local?"Z?":"Z"),t.offset&&i.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${i.join("|")})`,new RegExp(`^${e}$`)}function DIe(t,e){return!!((e==="v4"||!e)&&CIe.test(t)||(e==="v6"||!e)&&AIe.test(t))}function RIe(t,e){if(!bIe.test(t))return!1;try{const[i]=t.split("."),n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||!o.typ||!o.alg||e&&o.alg!==e)}catch{return!1}}function jIe(t,e){return!!((e==="v4"||!e)&&EIe.test(t)||(e==="v6"||!e)&&IIe.test(t))}class Pd extends Lr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==fn.string){const c=this._getOrReturnCtx(e);return on(c,{code:ki.invalid_type,expected:fn.string,received:c.parsedType}),ur}const n=new Al;let o;for(const c of this._def.checks)if(c.kind==="min")e.data.length<c.value&&(o=this._getOrReturnCtx(e,o),on(o,{code:ki.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="max")e.data.length>c.value&&(o=this._getOrReturnCtx(e,o),on(o,{code:ki.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){const f=e.data.length>c.value,r=e.data.length<c.value;(f||r)&&(o=this._getOrReturnCtx(e,o),f?on(o,{code:ki.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):r&&on(o,{code:ki.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")SIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"email",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="emoji")Qj||(Qj=new RegExp(TIe,"u")),Qj.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"emoji",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")vIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"uuid",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="nanoid")xIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"nanoid",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")gIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"cuid",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid2")yIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"cuid2",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="ulid")_Ie.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"ulid",code:ki.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),on(o,{validation:"url",code:ki.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"regex",code:ki.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?e.data=e.data.trim():c.kind==="includes"?e.data.includes(c.value,c.position)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),n.dirty()):c.kind==="toLowerCase"?e.data=e.data.toLowerCase():c.kind==="toUpperCase"?e.data=e.data.toUpperCase():c.kind==="startsWith"?e.data.startsWith(c.value)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?e.data.endsWith(c.value)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?Pre(c).test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:"datetime",message:c.message}),n.dirty()):c.kind==="date"?NIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:"date",message:c.message}),n.dirty()):c.kind==="time"?MIe(c).test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{code:ki.invalid_string,validation:"time",message:c.message}),n.dirty()):c.kind==="duration"?wIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"duration",code:ki.invalid_string,message:c.message}),n.dirty()):c.kind==="ip"?DIe(e.data,c.version)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"ip",code:ki.invalid_string,message:c.message}),n.dirty()):c.kind==="jwt"?RIe(e.data,c.alg)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"jwt",code:ki.invalid_string,message:c.message}),n.dirty()):c.kind==="cidr"?jIe(e.data,c.version)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"cidr",code:ki.invalid_string,message:c.message}),n.dirty()):c.kind==="base64"?kIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"base64",code:ki.invalid_string,message:c.message}),n.dirty()):c.kind==="base64url"?PIe.test(e.data)||(o=this._getOrReturnCtx(e,o),on(o,{validation:"base64url",code:ki.invalid_string,message:c.message}),n.dirty()):_s.assertNever(c);return{status:n.value,value:e.data}}_regex(e,i,n){return this.refinement(o=>e.test(o),{validation:i,code:ki.invalid_string,...Cn.errToObj(n)})}_addCheck(e){return new Pd({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Cn.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Cn.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Cn.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Cn.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Cn.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Cn.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Cn.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Cn.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Cn.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Cn.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Cn.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Cn.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Cn.errToObj(e)})}datetime(e){var i,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(i=e==null?void 0:e.offset)!==null&&i!==void 0?i:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...Cn.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Cn.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Cn.errToObj(e)})}regex(e,i){return this._addCheck({kind:"regex",regex:e,...Cn.errToObj(i)})}includes(e,i){return this._addCheck({kind:"includes",value:e,position:i==null?void 0:i.position,...Cn.errToObj(i==null?void 0:i.message)})}startsWith(e,i){return this._addCheck({kind:"startsWith",value:e,...Cn.errToObj(i)})}endsWith(e,i){return this._addCheck({kind:"endsWith",value:e,...Cn.errToObj(i)})}min(e,i){return this._addCheck({kind:"min",value:e,...Cn.errToObj(i)})}max(e,i){return this._addCheck({kind:"max",value:e,...Cn.errToObj(i)})}length(e,i){return this._addCheck({kind:"length",value:e,...Cn.errToObj(i)})}nonempty(e){return this.min(1,Cn.errToObj(e))}trim(){return new Pd({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Pd({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Pd({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxLength(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}}Pd.create=t=>{var e;return new Pd({checks:[],typeName:ar.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...kr(t)})};function zIe(t,e){const i=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=i>n?i:n,c=parseInt(t.toFixed(o).replace(".","")),f=parseInt(e.toFixed(o).replace(".",""));return c%f/Math.pow(10,o)}class bg extends Lr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==fn.number){const c=this._getOrReturnCtx(e);return on(c,{code:ki.invalid_type,expected:fn.number,received:c.parsedType}),ur}let n;const o=new Al;for(const c of this._def.checks)c.kind==="int"?_s.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),on(n,{code:ki.invalid_type,expected:"integer",received:"float",message:c.message}),o.dirty()):c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),o.dirty()):c.kind==="multipleOf"?zIe(e.data,c.value)!==0&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):c.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),on(n,{code:ki.not_finite,message:c.message}),o.dirty()):_s.assertNever(c);return{status:o.value,value:e.data}}gte(e,i){return this.setLimit("min",e,!0,Cn.toString(i))}gt(e,i){return this.setLimit("min",e,!1,Cn.toString(i))}lte(e,i){return this.setLimit("max",e,!0,Cn.toString(i))}lt(e,i){return this.setLimit("max",e,!1,Cn.toString(i))}setLimit(e,i,n,o){return new bg({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:n,message:Cn.toString(o)}]})}_addCheck(e){return new bg({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Cn.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Cn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Cn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Cn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Cn.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:Cn.toString(i)})}finite(e){return this._addCheck({kind:"finite",message:Cn.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Cn.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Cn.toString(e)})}get minValue(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_s.isInteger(e.value))}get isFinite(){let e=null,i=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(i===null||n.value>i)&&(i=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(i)&&Number.isFinite(e)}}bg.create=t=>new bg({checks:[],typeName:ar.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...kr(t)});class wg extends Lr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==fn.bigint)return this._getInvalidInput(e);let n;const o=new Al;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?e.data<c.value:e.data<=c.value)&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="max"?(c.inclusive?e.data>c.value:e.data>=c.value)&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),o.dirty()):c.kind==="multipleOf"?e.data%c.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),on(n,{code:ki.not_multiple_of,multipleOf:c.value,message:c.message}),o.dirty()):_s.assertNever(c);return{status:o.value,value:e.data}}_getInvalidInput(e){const i=this._getOrReturnCtx(e);return on(i,{code:ki.invalid_type,expected:fn.bigint,received:i.parsedType}),ur}gte(e,i){return this.setLimit("min",e,!0,Cn.toString(i))}gt(e,i){return this.setLimit("min",e,!1,Cn.toString(i))}lte(e,i){return this.setLimit("max",e,!0,Cn.toString(i))}lt(e,i){return this.setLimit("max",e,!1,Cn.toString(i))}setLimit(e,i,n,o){return new wg({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:n,message:Cn.toString(o)}]})}_addCheck(e){return new wg({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Cn.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Cn.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Cn.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Cn.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:Cn.toString(i)})}get minValue(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}}wg.create=t=>{var e;return new wg({checks:[],typeName:ar.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...kr(t)})};class oC extends Lr{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==fn.boolean){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.boolean,received:n.parsedType}),ur}return lc(e.data)}}oC.create=t=>new oC({typeName:ar.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...kr(t)});class Z_ extends Lr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==fn.date){const c=this._getOrReturnCtx(e);return on(c,{code:ki.invalid_type,expected:fn.date,received:c.parsedType}),ur}if(isNaN(e.data.getTime())){const c=this._getOrReturnCtx(e);return on(c,{code:ki.invalid_date}),ur}const n=new Al;let o;for(const c of this._def.checks)c.kind==="min"?e.data.getTime()<c.value&&(o=this._getOrReturnCtx(e,o),on(o,{code:ki.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?e.data.getTime()>c.value&&(o=this._getOrReturnCtx(e,o),on(o,{code:ki.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):_s.assertNever(c);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Z_({...this._def,checks:[...this._def.checks,e]})}min(e,i){return this._addCheck({kind:"min",value:e.getTime(),message:Cn.toString(i)})}max(e,i){return this._addCheck({kind:"max",value:e.getTime(),message:Cn.toString(i)})}get minDate(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e!=null?new Date(e):null}}Z_.create=t=>new Z_({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ar.ZodDate,...kr(t)});class cP extends Lr{_parse(e){if(this._getType(e)!==fn.symbol){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.symbol,received:n.parsedType}),ur}return lc(e.data)}}cP.create=t=>new cP({typeName:ar.ZodSymbol,...kr(t)});class aC extends Lr{_parse(e){if(this._getType(e)!==fn.undefined){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.undefined,received:n.parsedType}),ur}return lc(e.data)}}aC.create=t=>new aC({typeName:ar.ZodUndefined,...kr(t)});class lC extends Lr{_parse(e){if(this._getType(e)!==fn.null){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.null,received:n.parsedType}),ur}return lc(e.data)}}lC.create=t=>new lC({typeName:ar.ZodNull,...kr(t)});class Nb extends Lr{constructor(){super(...arguments),this._any=!0}_parse(e){return lc(e.data)}}Nb.create=t=>new Nb({typeName:ar.ZodAny,...kr(t)});class A_ extends Lr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lc(e.data)}}A_.create=t=>new A_({typeName:ar.ZodUnknown,...kr(t)});class uf extends Lr{_parse(e){const i=this._getOrReturnCtx(e);return on(i,{code:ki.invalid_type,expected:fn.never,received:i.parsedType}),ur}}uf.create=t=>new uf({typeName:ar.ZodNever,...kr(t)});class uP extends Lr{_parse(e){if(this._getType(e)!==fn.undefined){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.void,received:n.parsedType}),ur}return lc(e.data)}}uP.create=t=>new uP({typeName:ar.ZodVoid,...kr(t)});class jd extends Lr{_parse(e){const{ctx:i,status:n}=this._processInputParams(e),o=this._def;if(i.parsedType!==fn.array)return on(i,{code:ki.invalid_type,expected:fn.array,received:i.parsedType}),ur;if(o.exactLength!==null){const f=i.data.length>o.exactLength.value,r=i.data.length<o.exactLength.value;(f||r)&&(on(i,{code:f?ki.too_big:ki.too_small,minimum:r?o.exactLength.value:void 0,maximum:f?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&i.data.length<o.minLength.value&&(on(i,{code:ki.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&i.data.length>o.maxLength.value&&(on(i,{code:ki.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),i.common.async)return Promise.all([...i.data].map((f,r)=>o.type._parseAsync(new Gh(i,f,i.path,r)))).then(f=>Al.mergeArray(n,f));const c=[...i.data].map((f,r)=>o.type._parseSync(new Gh(i,f,i.path,r)));return Al.mergeArray(n,c)}get element(){return this._def.type}min(e,i){return new jd({...this._def,minLength:{value:e,message:Cn.toString(i)}})}max(e,i){return new jd({...this._def,maxLength:{value:e,message:Cn.toString(i)}})}length(e,i){return new jd({...this._def,exactLength:{value:e,message:Cn.toString(i)}})}nonempty(e){return this.min(1,e)}}jd.create=(t,e)=>new jd({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ar.ZodArray,...kr(e)});function Qx(t){if(t instanceof So){const e={};for(const i in t.shape){const n=t.shape[i];e[i]=Vh.create(Qx(n))}return new So({...t._def,shape:()=>e})}else return t instanceof jd?new jd({...t._def,type:Qx(t.element)}):t instanceof Vh?Vh.create(Qx(t.unwrap())):t instanceof Tg?Tg.create(Qx(t.unwrap())):t instanceof Wh?Wh.create(t.items.map(e=>Qx(e))):t}class So extends Lr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),i=_s.objectKeys(e);return this._cached={shape:e,keys:i}}_parse(e){if(this._getType(e)!==fn.object){const S=this._getOrReturnCtx(e);return on(S,{code:ki.invalid_type,expected:fn.object,received:S.parsedType}),ur}const{status:n,ctx:o}=this._processInputParams(e),{shape:c,keys:f}=this._getCached(),r=[];if(!(this._def.catchall instanceof uf&&this._def.unknownKeys==="strip"))for(const S in o.data)f.includes(S)||r.push(S);const x=[];for(const S of f){const C=c[S],I=o.data[S];x.push({key:{status:"valid",value:S},value:C._parse(new Gh(o,I,o.path,S)),alwaysSet:S in o.data})}if(this._def.catchall instanceof uf){const S=this._def.unknownKeys;if(S==="passthrough")for(const C of r)x.push({key:{status:"valid",value:C},value:{status:"valid",value:o.data[C]}});else if(S==="strict")r.length>0&&(on(o,{code:ki.unrecognized_keys,keys:r}),n.dirty());else if(S!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const S=this._def.catchall;for(const C of r){const I=o.data[C];x.push({key:{status:"valid",value:C},value:S._parse(new Gh(o,I,o.path,C)),alwaysSet:C in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const S=[];for(const C of x){const I=await C.key,N=await C.value;S.push({key:I,value:N,alwaysSet:C.alwaysSet})}return S}).then(S=>Al.mergeObjectSync(n,S)):Al.mergeObjectSync(n,x)}get shape(){return this._def.shape()}strict(e){return Cn.errToObj,new So({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(i,n)=>{var o,c,f,r;const x=(f=(c=(o=this._def).errorMap)===null||c===void 0?void 0:c.call(o,i,n).message)!==null&&f!==void 0?f:n.defaultError;return i.code==="unrecognized_keys"?{message:(r=Cn.errToObj(e).message)!==null&&r!==void 0?r:x}:{message:x}}}:{}})}strip(){return new So({...this._def,unknownKeys:"strip"})}passthrough(){return new So({...this._def,unknownKeys:"passthrough"})}extend(e){return new So({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new So({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ar.ZodObject})}setKey(e,i){return this.augment({[e]:i})}catchall(e){return new So({...this._def,catchall:e})}pick(e){const i={};return _s.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(i[n]=this.shape[n])}),new So({...this._def,shape:()=>i})}omit(e){const i={};return _s.objectKeys(this.shape).forEach(n=>{e[n]||(i[n]=this.shape[n])}),new So({...this._def,shape:()=>i})}deepPartial(){return Qx(this)}partial(e){const i={};return _s.objectKeys(this.shape).forEach(n=>{const o=this.shape[n];e&&!e[n]?i[n]=o:i[n]=o.optional()}),new So({...this._def,shape:()=>i})}required(e){const i={};return _s.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])i[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof Vh;)c=c._def.innerType;i[n]=c}}),new So({...this._def,shape:()=>i})}keyof(){return Nre(_s.objectKeys(this.shape))}}So.create=(t,e)=>new So({shape:()=>t,unknownKeys:"strip",catchall:uf.create(),typeName:ar.ZodObject,...kr(e)});So.strictCreate=(t,e)=>new So({shape:()=>t,unknownKeys:"strict",catchall:uf.create(),typeName:ar.ZodObject,...kr(e)});So.lazycreate=(t,e)=>new So({shape:t,unknownKeys:"strip",catchall:uf.create(),typeName:ar.ZodObject,...kr(e)});class cC extends Lr{_parse(e){const{ctx:i}=this._processInputParams(e),n=this._def.options;function o(c){for(const r of c)if(r.result.status==="valid")return r.result;for(const r of c)if(r.result.status==="dirty")return i.common.issues.push(...r.ctx.common.issues),r.result;const f=c.map(r=>new su(r.ctx.common.issues));return on(i,{code:ki.invalid_union,unionErrors:f}),ur}if(i.common.async)return Promise.all(n.map(async c=>{const f={...i,common:{...i.common,issues:[]},parent:null};return{result:await c._parseAsync({data:i.data,path:i.path,parent:f}),ctx:f}})).then(o);{let c;const f=[];for(const x of n){const S={...i,common:{...i.common,issues:[]},parent:null},C=x._parseSync({data:i.data,path:i.path,parent:S});if(C.status==="valid")return C;C.status==="dirty"&&!c&&(c={result:C,ctx:S}),S.common.issues.length&&f.push(S.common.issues)}if(c)return i.common.issues.push(...c.ctx.common.issues),c.result;const r=f.map(x=>new su(x));return on(i,{code:ki.invalid_union,unionErrors:r}),ur}}get options(){return this._def.options}}cC.create=(t,e)=>new cC({options:t,typeName:ar.ZodUnion,...kr(e)});const Mp=t=>t instanceof hC?Mp(t.schema):t instanceof Bd?Mp(t.innerType()):t instanceof pC?[t.value]:t instanceof Sg?t.options:t instanceof fC?_s.objectValues(t.enum):t instanceof mC?Mp(t._def.innerType):t instanceof aC?[void 0]:t instanceof lC?[null]:t instanceof Vh?[void 0,...Mp(t.unwrap())]:t instanceof Tg?[null,...Mp(t.unwrap())]:t instanceof H4||t instanceof yC?Mp(t.unwrap()):t instanceof gC?Mp(t._def.innerType):[];class EM extends Lr{_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==fn.object)return on(i,{code:ki.invalid_type,expected:fn.object,received:i.parsedType}),ur;const n=this.discriminator,o=i.data[n],c=this.optionsMap.get(o);return c?i.common.async?c._parseAsync({data:i.data,path:i.path,parent:i}):c._parseSync({data:i.data,path:i.path,parent:i}):(on(i,{code:ki.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ur)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,i,n){const o=new Map;for(const c of i){const f=Mp(c.shape[e]);if(!f.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of f){if(o.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);o.set(r,c)}}return new EM({typeName:ar.ZodDiscriminatedUnion,discriminator:e,options:i,optionsMap:o,...kr(n)})}}function NO(t,e){const i=Op(t),n=Op(e);if(t===e)return{valid:!0,data:t};if(i===fn.object&&n===fn.object){const o=_s.objectKeys(e),c=_s.objectKeys(t).filter(r=>o.indexOf(r)!==-1),f={...t,...e};for(const r of c){const x=NO(t[r],e[r]);if(!x.valid)return{valid:!1};f[r]=x.data}return{valid:!0,data:f}}else if(i===fn.array&&n===fn.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let c=0;c<t.length;c++){const f=t[c],r=e[c],x=NO(f,r);if(!x.valid)return{valid:!1};o.push(x.data)}return{valid:!0,data:o}}else return i===fn.date&&n===fn.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class uC extends Lr{_parse(e){const{status:i,ctx:n}=this._processInputParams(e),o=(c,f)=>{if(kO(c)||kO(f))return ur;const r=NO(c.value,f.value);return r.valid?((PO(c)||PO(f))&&i.dirty(),{status:i.value,value:r.data}):(on(n,{code:ki.invalid_intersection_types}),ur)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([c,f])=>o(c,f)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}uC.create=(t,e,i)=>new uC({left:t,right:e,typeName:ar.ZodIntersection,...kr(i)});class Wh extends Lr{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==fn.array)return on(n,{code:ki.invalid_type,expected:fn.array,received:n.parsedType}),ur;if(n.data.length<this._def.items.length)return on(n,{code:ki.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ur;!this._def.rest&&n.data.length>this._def.items.length&&(on(n,{code:ki.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const c=[...n.data].map((f,r)=>{const x=this._def.items[r]||this._def.rest;return x?x._parse(new Gh(n,f,n.path,r)):null}).filter(f=>!!f);return n.common.async?Promise.all(c).then(f=>Al.mergeArray(i,f)):Al.mergeArray(i,c)}get items(){return this._def.items}rest(e){return new Wh({...this._def,rest:e})}}Wh.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wh({items:t,typeName:ar.ZodTuple,rest:null,...kr(e)})};class dC extends Lr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==fn.object)return on(n,{code:ki.invalid_type,expected:fn.object,received:n.parsedType}),ur;const o=[],c=this._def.keyType,f=this._def.valueType;for(const r in n.data)o.push({key:c._parse(new Gh(n,r,n.path,r)),value:f._parse(new Gh(n,n.data[r],n.path,r)),alwaysSet:r in n.data});return n.common.async?Al.mergeObjectAsync(i,o):Al.mergeObjectSync(i,o)}get element(){return this._def.valueType}static create(e,i,n){return i instanceof Lr?new dC({keyType:e,valueType:i,typeName:ar.ZodRecord,...kr(n)}):new dC({keyType:Pd.create(),valueType:e,typeName:ar.ZodRecord,...kr(i)})}}class dP extends Lr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==fn.map)return on(n,{code:ki.invalid_type,expected:fn.map,received:n.parsedType}),ur;const o=this._def.keyType,c=this._def.valueType,f=[...n.data.entries()].map(([r,x],S)=>({key:o._parse(new Gh(n,r,n.path,[S,"key"])),value:c._parse(new Gh(n,x,n.path,[S,"value"]))}));if(n.common.async){const r=new Map;return Promise.resolve().then(async()=>{for(const x of f){const S=await x.key,C=await x.value;if(S.status==="aborted"||C.status==="aborted")return ur;(S.status==="dirty"||C.status==="dirty")&&i.dirty(),r.set(S.value,C.value)}return{status:i.value,value:r}})}else{const r=new Map;for(const x of f){const S=x.key,C=x.value;if(S.status==="aborted"||C.status==="aborted")return ur;(S.status==="dirty"||C.status==="dirty")&&i.dirty(),r.set(S.value,C.value)}return{status:i.value,value:r}}}}dP.create=(t,e,i)=>new dP({valueType:e,keyType:t,typeName:ar.ZodMap,...kr(i)});class X_ extends Lr{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==fn.set)return on(n,{code:ki.invalid_type,expected:fn.set,received:n.parsedType}),ur;const o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(on(n,{code:ki.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),i.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(on(n,{code:ki.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),i.dirty());const c=this._def.valueType;function f(x){const S=new Set;for(const C of x){if(C.status==="aborted")return ur;C.status==="dirty"&&i.dirty(),S.add(C.value)}return{status:i.value,value:S}}const r=[...n.data.values()].map((x,S)=>c._parse(new Gh(n,x,n.path,S)));return n.common.async?Promise.all(r).then(x=>f(x)):f(r)}min(e,i){return new X_({...this._def,minSize:{value:e,message:Cn.toString(i)}})}max(e,i){return new X_({...this._def,maxSize:{value:e,message:Cn.toString(i)}})}size(e,i){return this.min(e,i).max(e,i)}nonempty(e){return this.min(1,e)}}X_.create=(t,e)=>new X_({valueType:t,minSize:null,maxSize:null,typeName:ar.ZodSet,...kr(e)});class k0 extends Lr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==fn.function)return on(i,{code:ki.invalid_type,expected:fn.function,received:i.parsedType}),ur;function n(r,x){return aP({data:r,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,oP(),Pb].filter(S=>!!S),issueData:{code:ki.invalid_arguments,argumentsError:x}})}function o(r,x){return aP({data:r,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,oP(),Pb].filter(S=>!!S),issueData:{code:ki.invalid_return_type,returnTypeError:x}})}const c={errorMap:i.common.contextualErrorMap},f=i.data;if(this._def.returns instanceof Mb){const r=this;return lc(async function(...x){const S=new su([]),C=await r._def.args.parseAsync(x,c).catch(D=>{throw S.addIssue(n(x,D)),S}),I=await Reflect.apply(f,this,C);return await r._def.returns._def.type.parseAsync(I,c).catch(D=>{throw S.addIssue(o(I,D)),S})})}else{const r=this;return lc(function(...x){const S=r._def.args.safeParse(x,c);if(!S.success)throw new su([n(x,S.error)]);const C=Reflect.apply(f,this,S.data),I=r._def.returns.safeParse(C,c);if(!I.success)throw new su([o(C,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new k0({...this._def,args:Wh.create(e).rest(A_.create())})}returns(e){return new k0({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,i,n){return new k0({args:e||Wh.create([]).rest(A_.create()),returns:i||A_.create(),typeName:ar.ZodFunction,...kr(n)})}}class hC extends Lr{get schema(){return this._def.getter()}_parse(e){const{ctx:i}=this._processInputParams(e);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}hC.create=(t,e)=>new hC({getter:t,typeName:ar.ZodLazy,...kr(e)});class pC extends Lr{_parse(e){if(e.data!==this._def.value){const i=this._getOrReturnCtx(e);return on(i,{received:i.data,code:ki.invalid_literal,expected:this._def.value}),ur}return{status:"valid",value:e.data}}get value(){return this._def.value}}pC.create=(t,e)=>new pC({value:t,typeName:ar.ZodLiteral,...kr(e)});function Nre(t,e){return new Sg({values:t,typeName:ar.ZodEnum,...kr(e)})}class Sg extends Lr{constructor(){super(...arguments),HS.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const i=this._getOrReturnCtx(e),n=this._def.values;return on(i,{expected:_s.joinValues(n),received:i.parsedType,code:ki.invalid_type}),ur}if(lP(this,HS)||Are(this,HS,new Set(this._def.values)),!lP(this,HS).has(e.data)){const i=this._getOrReturnCtx(e),n=this._def.values;return on(i,{received:i.data,code:ki.invalid_enum_value,options:n}),ur}return lc(e.data)}get options(){return this._def.values}get enum(){const e={};for(const i of this._def.values)e[i]=i;return e}get Values(){const e={};for(const i of this._def.values)e[i]=i;return e}get Enum(){const e={};for(const i of this._def.values)e[i]=i;return e}extract(e,i=this._def){return Sg.create(e,{...this._def,...i})}exclude(e,i=this._def){return Sg.create(this.options.filter(n=>!e.includes(n)),{...this._def,...i})}}HS=new WeakMap;Sg.create=Nre;class fC extends Lr{constructor(){super(...arguments),GS.set(this,void 0)}_parse(e){const i=_s.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==fn.string&&n.parsedType!==fn.number){const o=_s.objectValues(i);return on(n,{expected:_s.joinValues(o),received:n.parsedType,code:ki.invalid_type}),ur}if(lP(this,GS)||Are(this,GS,new Set(_s.getValidEnumValues(this._def.values))),!lP(this,GS).has(e.data)){const o=_s.objectValues(i);return on(n,{received:n.data,code:ki.invalid_enum_value,options:o}),ur}return lc(e.data)}get enum(){return this._def.values}}GS=new WeakMap;fC.create=(t,e)=>new fC({values:t,typeName:ar.ZodNativeEnum,...kr(e)});class Mb extends Lr{unwrap(){return this._def.type}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==fn.promise&&i.common.async===!1)return on(i,{code:ki.invalid_type,expected:fn.promise,received:i.parsedType}),ur;const n=i.parsedType===fn.promise?i.data:Promise.resolve(i.data);return lc(n.then(o=>this._def.type.parseAsync(o,{path:i.path,errorMap:i.common.contextualErrorMap})))}}Mb.create=(t,e)=>new Mb({type:t,typeName:ar.ZodPromise,...kr(e)});class Bd extends Lr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ar.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:i,ctx:n}=this._processInputParams(e),o=this._def.effect||null,c={addIssue:f=>{on(n,f),f.fatal?i.abort():i.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),o.type==="preprocess"){const f=o.transform(n.data,c);if(n.common.async)return Promise.resolve(f).then(async r=>{if(i.value==="aborted")return ur;const x=await this._def.schema._parseAsync({data:r,path:n.path,parent:n});return x.status==="aborted"?ur:x.status==="dirty"||i.value==="dirty"?f0(x.value):x});{if(i.value==="aborted")return ur;const r=this._def.schema._parseSync({data:f,path:n.path,parent:n});return r.status==="aborted"?ur:r.status==="dirty"||i.value==="dirty"?f0(r.value):r}}if(o.type==="refinement"){const f=r=>{const x=o.refinement(r,c);if(n.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(n.common.async===!1){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?ur:(r.status==="dirty"&&i.dirty(),f(r.value),{status:i.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(r=>r.status==="aborted"?ur:(r.status==="dirty"&&i.dirty(),f(r.value).then(()=>({status:i.value,value:r.value}))))}if(o.type==="transform")if(n.common.async===!1){const f=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!K_(f))return f;const r=o.transform(f.value,c);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:r}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(f=>K_(f)?Promise.resolve(o.transform(f.value,c)).then(r=>({status:i.value,value:r})):f);_s.assertNever(o)}}Bd.create=(t,e,i)=>new Bd({schema:t,typeName:ar.ZodEffects,effect:e,...kr(i)});Bd.createWithPreprocess=(t,e,i)=>new Bd({schema:e,effect:{type:"preprocess",transform:t},typeName:ar.ZodEffects,...kr(i)});class Vh extends Lr{_parse(e){return this._getType(e)===fn.undefined?lc(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Vh.create=(t,e)=>new Vh({innerType:t,typeName:ar.ZodOptional,...kr(e)});class Tg extends Lr{_parse(e){return this._getType(e)===fn.null?lc(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tg.create=(t,e)=>new Tg({innerType:t,typeName:ar.ZodNullable,...kr(e)});class mC extends Lr{_parse(e){const{ctx:i}=this._processInputParams(e);let n=i.data;return i.parsedType===fn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}mC.create=(t,e)=>new mC({innerType:t,typeName:ar.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...kr(e)});class gC extends Lr{_parse(e){const{ctx:i}=this._processInputParams(e),n={...i,common:{...i.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return sC(o)?o.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new su(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new su(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}gC.create=(t,e)=>new gC({innerType:t,typeName:ar.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...kr(e)});class hP extends Lr{_parse(e){if(this._getType(e)!==fn.nan){const n=this._getOrReturnCtx(e);return on(n,{code:ki.invalid_type,expected:fn.nan,received:n.parsedType}),ur}
vendor: 4,701 bytes, line 3723
3723return{status:"valid",value:e.data}}}hP.create=t=>new hP({typeName:ar.ZodNaN,...kr(t)});const LIe=Symbol("zod_brand");class H4 extends Lr{_parse(e){const{ctx:i}=this._processInputParams(e),n=i.data;return this._def.type._parse({data:n,path:i.path,parent:i})}unwrap(){return this._def.type}}class EE extends Lr{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?ur:c.status==="dirty"?(i.dirty(),f0(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})})();{const o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ur:o.status==="dirty"?(i.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,i){return new EE({in:e,out:i,typeName:ar.ZodPipeline})}}class yC extends Lr{_parse(e){const i=this._def.innerType._parse(e),n=o=>(K_(o)&&(o.value=Object.freeze(o.value)),o);return sC(i)?i.then(o=>n(o)):n(i)}unwrap(){return this._def.innerType}}yC.create=(t,e)=>new yC({innerType:t,typeName:ar.ZodReadonly,...kr(e)});function eH(t,e){const i=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof i=="string"?{message:i}:i}function Mre(t,e={},i){return t?Nb.create().superRefine((n,o)=>{var c,f;const r=t(n);if(r instanceof Promise)return r.then(x=>{var S,C;if(!x){const I=eH(e,n),N=(C=(S=I.fatal)!==null&&S!==void 0?S:i)!==null&&C!==void 0?C:!0;o.addIssue({code:"custom",...I,fatal:N})}});if(!r){const x=eH(e,n),S=(f=(c=x.fatal)!==null&&c!==void 0?c:i)!==null&&f!==void 0?f:!0;o.addIssue({code:"custom",...x,fatal:S})}}):Nb.create()}const OIe={object:So.lazycreate};var ar;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ar||(ar={}));const FIe=(t,e={message:`Input not instance of ${t.name}`})=>Mre(i=>i instanceof t,e),Dre=Pd.create,Rre=bg.create,BIe=hP.create,UIe=wg.create,jre=oC.create,VIe=Z_.create,$Ie=cP.create,qIe=aC.create,HIe=lC.create,GIe=Nb.create,WIe=A_.create,KIe=uf.create,ZIe=uP.create,XIe=jd.create,YIe=So.create,QIe=So.strictCreate,JIe=cC.create,eke=EM.create,tke=uC.create,ike=Wh.create,nke=dC.create,rke=dP.create,ske=X_.create,oke=k0.create,ake=hC.create,lke=pC.create,cke=Sg.create,uke=fC.create,dke=Mb.create,tH=Bd.create,hke=Vh.create,pke=Tg.create,fke=Bd.createWithPreprocess,mke=EE.create,gke=()=>Dre().optional(),yke=()=>Rre().optional(),_ke=()=>jre().optional(),vke={string:t=>Pd.create({...t,coerce:!0}),number:t=>bg.create({...t,coerce:!0}),boolean:t=>oC.create({...t,coerce:!0}),bigint:t=>wg.create({...t,coerce:!0}),date:t=>Z_.create({...t,coerce:!0})},xke=ur;var Xt=Object.freeze({__proto__:null,defaultErrorMap:Pb,setErrorMap:fIe,getErrorMap:oP,makeIssue:aP,EMPTY_PATH:mIe,addIssueToContext:on,ParseStatus:Al,INVALID:ur,DIRTY:f0,OK:lc,isAborted:kO,isDirty:PO,isValid:K_,isAsync:sC,get util(){return _s},get objectUtil(){return IO},ZodParsedType:fn,getParsedType:Op,ZodType:Lr,datetimeRegex:Pre,ZodString:Pd,ZodNumber:bg,ZodBigInt:wg,ZodBoolean:oC,ZodDate:Z_,ZodSymbol:cP,ZodUndefined:aC,ZodNull:lC,ZodAny:Nb,ZodUnknown:A_,ZodNever:uf,ZodVoid:uP,ZodArray:jd,ZodObject:So,ZodUnion:cC,ZodDiscriminatedUnion:EM,ZodIntersection:uC,ZodTuple:Wh,ZodRecord:dC,ZodMap:dP,ZodSet:X_,ZodFunction:k0,ZodLazy:hC,ZodLiteral:pC,ZodEnum:Sg,ZodNativeEnum:fC,ZodPromise:Mb,ZodEffects:Bd,ZodTransformer:Bd,ZodOptional:Vh,ZodNullable:Tg,ZodDefault:mC,ZodCatch:gC,ZodNaN:hP,BRAND:LIe,ZodBranded:H4,ZodPipeline:EE,ZodReadonly:yC,custom:Mre,Schema:Lr,ZodSchema:Lr,late:OIe,get ZodFirstPartyTypeKind(){return ar},coerce:vke,any:GIe,array:XIe,bigint:UIe,boolean:jre,date:VIe,discriminatedUnion:eke,effect:tH,enum:cke,function:oke,instanceof:FIe,intersection:tke,lazy:ake,literal:lke,map:rke,nan:BIe,nativeEnum:uke,never:KIe,null:HIe,nullable:pke,number:
vendor: 10,368 bytes, line 3723
3723Rre,object:YIe,oboolean:_ke,onumber:yke,optional:hke,ostring:gke,pipeline:mke,preprocess:fke,promise:dke,record:nke,set:ske,strictObject:QIe,string:Dre,symbol:$Ie,transformer:tH,tuple:ike,undefined:qIe,union:JIe,unknown:WIe,void:ZIe,NEVER:xke,ZodIssueCode:ki,quotelessJson:pIe,ZodError:su});function nl(t){this.content=t}nl.prototype={constructor:nl,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,i){var n=i&&i!=t?this.remove(i):this,o=n.find(t),c=n.content.slice();return o==-1?c.push(i||t,e):(c[o+1]=e,i&&(c[o]=i)),new nl(c)},remove:function(t){var e=this.find(t);if(e==-1)return this;var i=this.content.slice();return i.splice(e,2),new nl(i)},addToStart:function(t,e){return new nl([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var i=this.remove(t).content.slice();return i.push(t,e),new nl(i)},addBefore:function(t,e,i){var n=this.remove(e),o=n.content.slice(),c=n.find(t);return o.splice(c==-1?o.length:c,0,e,i),new nl(o)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=nl.from(t),t.size?new nl(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=nl.from(t),t.size?new nl(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=nl.from(t);for(var i=0;i<t.content.length;i+=2)e=e.remove(t.content[i]);return e},toObject:function(){var t={};return this.forEach(function(e,i){t[e]=i}),t},get size(){return this.content.length>>1}};nl.from=function(t){if(t instanceof nl)return t;var e=[];if(t)for(var i in t)e.push(i,t[i]);return new nl(e)};function zre(t,e,i){for(let n=0;;n++){if(n==t.childCount||n==e.childCount)return t.childCount==e.childCount?null:i;let o=t.child(n),c=e.child(n);if(o==c){i+=o.nodeSize;continue}if(!o.sameMarkup(c))return i;if(o.isText&&o.text!=c.text){for(let f=0;o.text[f]==c.text[f];f++)i++;return i}if(o.content.size||c.content.size){let f=zre(o.content,c.content,i+1);if(f!=null)return f}i+=o.nodeSize}}function Lre(t,e,i,n){for(let o=t.childCount,c=e.childCount;;){if(o==0||c==0)return o==c?null:{a:i,b:n};let f=t.child(--o),r=e.child(--c),x=f.nodeSize;if(f==r){i-=x,n-=x;continue}if(!f.sameMarkup(r))return{a:i,b:n};if(f.isText&&f.text!=r.text){let S=0,C=Math.min(f.text.length,r.text.length);for(;S<C&&f.text[f.text.length-S-1]==r.text[r.text.length-S-1];)S++,i--,n--;return{a:i,b:n}}if(f.content.size||r.content.size){let S=Lre(f.content,r.content,i-1,n-1);if(S)return S}i-=x,n-=x}}class Si{constructor(e,i){if(this.content=e,this.size=i||0,i==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,i,n,o=0,c){for(let f=0,r=0;r<i;f++){let x=this.content[f],S=r+x.nodeSize;if(S>e&&n(x,o+r,c||null,f)!==!1&&x.content.size){let C=r+1;x.nodesBetween(Math.max(0,e-C),Math.min(x.content.size,i-C),n,o+C)}r=S}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,i,n,o){let c="",f=!0;return this.nodesBetween(e,i,(r,x)=>{let S=r.isText?r.text.slice(Math.max(e,x)-x,i-x):r.isLeaf?o?typeof o=="function"?o(r):o:r.type.spec.leafText?r.type.spec.leafText(r):"":"";r.isBlock&&(r.isLeaf&&S||r.isTextblock)&&n&&(f?f=!1:c+=n),c+=S},0),c}append(e){if(!e.size)return this;if(!this.size)return e;let i=this.lastChild,n=e.firstChild,o=this.content.slice(),c=0;for(i.isText&&i.sameMarkup(n)&&(o[o.length-1]=i.withText(i.text+n.text),c=1);c<e.content.length;c++)o.push(e.content[c]);return new Si(o,this.size+e.size)}cut(e,i=this.size){if(e==0&&i==this.size)return this;let n=[],o=0;if(i>e)for(let c=0,f=0;f<i;c++){let r=this.content[c],x=f+r.nodeSize;x>e&&((f<e||x>i)&&(r.isText?r=r.cut(Math.max(0,e-f),Math.min(r.text.length,i-f)):r=r.cut(Math.max(0,e-f-1),Math.min(r.content.size,i-f-1))),n.push(r),o+=r.nodeSize),f=x}return new Si(n,o)}cutByIndex(e,i){return e==i?Si.empty:e==0&&i==this.content.length?this:new Si(this.content.slice(e,i))}replaceChild(e,i){let n=this.content[e];if(n==i)return this;let o=this.content.slice(),c=this.size+i.nodeSize-n.nodeSize;return o[e]=i,new Si(o,c)}addToStart(e){return new Si([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Si(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let i=0;i<this.content.length;i++)if(!this.content[i].eq(e.content[i]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let i=this.content[e];if(!i)throw new RangeError("Index "+e+" out of range for "+this);return i}maybeChild(e){return this.content[e]||null}forEach(e){for(let i=0,n=0;i<this.content.length;i++){let o=this.content[i];e(o,n,i),n+=o.nodeSize}}findDiffStart(e,i=0){return zre(this,e,i)}findDiffEnd(e,i=this.size,n=e.size){return Lre(this,e,i,n)}findIndex(e){if(e==0)return oI(0,e);if(e==this.size)return oI(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let i=0,n=0;;i++){let o=this.child(i),c=n+o.nodeSize;if(c>=e)return c==e?oI(i+1,c):oI(i,n);n=c}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,i){if(!i)return Si.empty;if(!Array.isArray(i))throw new RangeError("Invalid input for Fragment.fromJSON");return new Si(i.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Si.empty;let i,n=0;for(let o=0;o<e.length;o++){let c=e[o];n+=c.nodeSize,o&&c.isText&&e[o-1].sameMarkup(c)?(i||(i=e.slice(0,o)),i[i.length-1]=c.withText(i[i.length-1].text+c.text)):i&&i.push(c)}return new Si(i||e,n)}static from(e){if(!e)return Si.empty;if(e instanceof Si)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Si([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Si.empty=new Si([],0);const Jj={index:0,offset:0};function oI(t,e){return Jj.index=t,Jj.offset=e,Jj}function pP(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let i=Array.isArray(t);if(Array.isArray(e)!=i)return!1;if(i){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!pP(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!pP(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}let Ws=class MO{constructor(e,i){this.type=e,this.attrs=i}addToSet(e){let i,n=!1;for(let o=0;o<e.length;o++){let c=e[o];if(this.eq(c))return e;if(this.type.excludes(c.type))i||(i=e.slice(0,o));else{if(c.type.excludes(this.type))return e;!n&&c.type.rank>this.type.rank&&(i||(i=e.slice(0,o)),i.push(this),n=!0),i&&i.push(c)}}return i||(i=e.slice()),n||i.push(this),i}removeFromSet(e){for(let i=0;i<e.length;i++)if(this.eq(e[i]))return e.slice(0,i).concat(e.slice(i+1));return e}isInSet(e){for(let i=0;i<e.length;i++)if(this.eq(e[i]))return!0;return!1}eq(e){return this==e||this.type==e.type&&pP(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let i in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,i){if(!i)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[i.type];if(!n)throw new RangeError(`There is no mark type ${i.type} in this schema`);let o=n.create(i.attrs);return n.checkAttrs(o.attrs),o}static sameSet(e,i){if(e==i)return!0;if(e.length!=i.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(i[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return MO.none;if(e instanceof MO)return[e];let i=e.slice();return i.sort((n,o)=>n.type.rank-o.type.rank),i}};Ws.none=[];class fP extends Error{}class pn{constructor(e,i,n){this.content=e,this.openStart=i,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,i){let n=Fre(this.content,e+this.openStart,i);return n&&new pn(n,this.openStart,this.openEnd)}removeBetween(e,i){return new pn(Ore(this.content,e+this.openStart,i+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,i){if(!i)return pn.empty;let n=i.openStart||0,o=i.openEnd||0;if(typeof n!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new pn(Si.fromJSON(e,i.content),n,o)}static maxOpen(e,i=!0){let n=0,o=0;for(let c=e.firstChild;c&&!c.isLeaf&&(i||!c.type.spec.isolating);c=c.firstChild)n++;for(let c=e.lastChild;c&&!c.isLeaf&&(i||!c.type.spec.isolating);c=c.lastChild)o++;return new pn(e,n,o)}}pn.empty=new pn(Si.empty,0,0);function Ore(t,e,i){let{index:n,offset:o}=t.findIndex(e),c=t.maybeChild(n),{index:f,offset:r}=t.findIndex(i);if(o==e||c.isText){if(r!=i&&!t.child(f).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(i))}if(n!=f)throw new RangeError("Removing non-flat range");return t.replaceChild(n,c.copy(Ore(c.content,e-o-1,i-o-1)))}function Fre(t,e,i,n){let{index:o,offset:c}=t.findIndex(e),f=t.maybeChild(o);if(c==e||f.isText)return n&&!n.canReplace(o,o,i)?null:t.cut(0,e).append(i).append(t.cut(e));let r=Fre(f.content,e-c-1,i,f);return r&&t.replaceChild(o,f.copy(r))}function bke(t,e,i){if(i.openStart>t.depth)throw new fP("Inserted content deeper than insertion position");if(t.depth-i.openStart!=e.depth-i.openEnd)throw new fP("Inconsistent open depths");return Bre(t,e,i,0)}function Bre(t,e,i,n){let o=t.index(n),c=t.node(n);if(o==e.index(n)&&n<t.depth-i.openStart){let f=Bre(t,e,i,n+1);return c.copy(c.content.replaceChild(o,f))}else if(i.content.size)if(!i.openStart&&!i.openEnd&&t.depth==n&&e.depth==n){let f=t.parent,r=f.content;return k_(f,r.cut(0,t.parentOffset).append(i.content).append(r.cut(e.parentOffset)))}else{let{start:f,end:r}=wke(i,t);return k_(c,Vre(t,f,r,e,n))}else return k_(c,mP(t,e,n))}function Ure(t,e){if(!e.type.compatibleContent(t.type))throw new fP("Cannot join "+e.type.name+" onto "+t.type.name)}
vendor: 9,472 bytes, line 3723
3723function DO(t,e,i){let n=t.node(i);return Ure(n,e.node(i)),n}function I_(t,e){let i=e.length-1;i>=0&&t.isText&&t.sameMarkup(e[i])?e[i]=t.withText(e[i].text+t.text):e.push(t)}function xT(t,e,i,n){let o=(e||t).node(i),c=0,f=e?e.index(i):o.childCount;t&&(c=t.index(i),t.depth>i?c++:t.textOffset&&(I_(t.nodeAfter,n),c++));for(let r=c;r<f;r++)I_(o.child(r),n);e&&e.depth==i&&e.textOffset&&I_(e.nodeBefore,n)}function k_(t,e){return t.type.checkContent(e),t.copy(e)}function Vre(t,e,i,n,o){let c=t.depth>o&&DO(t,e,o+1),f=n.depth>o&&DO(i,n,o+1),r=[];return xT(null,t,o,r),c&&f&&e.index(o)==i.index(o)?(Ure(c,f),I_(k_(c,Vre(t,e,i,n,o+1)),r)):(c&&I_(k_(c,mP(t,e,o+1)),r),xT(e,i,o,r),f&&I_(k_(f,mP(i,n,o+1)),r)),xT(n,null,o,r),new Si(r)}function mP(t,e,i){let n=[];if(xT(null,t,i,n),t.depth>i){let o=DO(t,e,i+1);I_(k_(o,mP(t,e,i+1)),n)}return xT(e,null,i,n),new Si(n)}function wke(t,e){let i=e.depth-t.openStart,o=e.node(i).copy(t.content);for(let c=i-1;c>=0;c--)o=e.node(c).copy(Si.from(o));return{start:o.resolveNoCache(t.openStart+i),end:o.resolveNoCache(o.content.size-t.openEnd-i)}}class _C{constructor(e,i,n){this.pos=e,this.path=i,this.parentOffset=n,this.depth=i.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,i=this.index(this.depth);if(i==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],o=e.child(i);return n?e.child(i).cut(n):o}get nodeBefore(){let e=this.index(this.depth),i=this.pos-this.path[this.path.length-1];return i?this.parent.child(e).cut(0,i):e==0?null:this.parent.child(e-1)}posAtIndex(e,i){i=this.resolveDepth(i);let n=this.path[i*3],o=i==0?0:this.path[i*3-1]+1;for(let c=0;c<e;c++)o+=n.child(c).nodeSize;return o}marks(){let e=this.parent,i=this.index();if(e.content.size==0)return Ws.none;if(this.textOffset)return e.child(i).marks;let n=e.maybeChild(i-1),o=e.maybeChild(i);if(!n){let r=n;n=o,o=r}let c=n.marks;for(var f=0;f<c.length;f++)c[f].type.spec.inclusive===!1&&(!o||!c[f].isInSet(o.marks))&&(c=c[f--].removeFromSet(c));return c}marksAcross(e){let i=this.parent.maybeChild(this.index());if(!i||!i.isInline)return null;let n=i.marks,o=e.parent.maybeChild(e.index());for(var c=0;c<n.length;c++)n[c].type.spec.inclusive===!1&&(!o||!n[c].isInSet(o.marks))&&(n=n[c--].removeFromSet(n));return n}sharedDepth(e){for(let i=this.depth;i>0;i--)if(this.start(i)<=e&&this.end(i)>=e)return i;return 0}blockRange(e=this,i){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!i||i(this.node(n))))return new gP(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let i=1;i<=this.depth;i++)e+=(e?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return e+":"+this.parentOffset}static resolve(e,i){if(!(i>=0&&i<=e.content.size))throw new RangeError("Position "+i+" out of range");let n=[],o=0,c=i;for(let f=e;;){let{index:r,offset:x}=f.content.findIndex(c),S=c-x;if(n.push(f,r,o+x),!S||(f=f.child(r),f.isText))break;c=S-1,o+=x+1}return new _C(i,n,c)}static resolveCached(e,i){let n=iH.get(e);if(n)for(let c=0;c<n.elts.length;c++){let f=n.elts[c];if(f.pos==i)return f}else iH.set(e,n=new Ske);let o=n.elts[n.i]=_C.resolve(e,i);return n.i=(n.i+1)%Tke,o}}class Ske{constructor(){this.elts=[],this.i=0}}const Tke=12,iH=new WeakMap;class gP{constructor(e,i,n){this.$from=e,this.$to=i,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Cke=Object.create(null);let sg=class RO{constructor(e,i,n,o=Ws.none){this.type=e,this.attrs=i,this.marks=o,this.content=n||Si.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,i,n,o=0){this.content.nodesBetween(e,i,n,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,i,n,o){return this.content.textBetween(e,i,n,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,i,n){return this.type==e&&pP(this.attrs,i||e.defaultAttrs||Cke)&&Ws.sameSet(this.marks,n||Ws.none)}copy(e=null){return e==this.content?this:new RO(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new RO(this.type,this.attrs,this.content,e)}cut(e,i=this.content.size){return e==0&&i==this.content.size?this:this.copy(this.content.cut(e,i))}slice(e,i=this.content.size,n=!1){if(e==i)return pn.empty;let o=this.resolve(e),c=this.resolve(i),f=n?0:o.sharedDepth(i),r=o.start(f),S=o.node(f).content.cut(o.pos-r,c.pos-r);return new pn(S,o.depth-f,c.depth-f)}replace(e,i,n){return bke(this.resolve(e),this.resolve(i),n)}nodeAt(e){for(let i=this;;){let{index:n,offset:o}=i.content.findIndex(e);if(i=i.maybeChild(n),!i)return null;if(o==e||i.isText)return i;e-=o+1}}childAfter(e){let{index:i,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(i),index:i,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:i,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(i),index:i,offset:n};let o=this.content.child(i-1);return{node:o,index:i-1,offset:n-o.nodeSize}}resolve(e){return _C.resolveCached(this,e)}resolveNoCache(e){return _C.resolve(this,e)}rangeHasMark(e,i,n){let o=!1;return i>e&&this.nodesBetween(e,i,c=>(n.isInSet(c.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),$re(this.marks,e)}contentMatchAt(e){let i=this.type.contentMatch.matchFragment(this.content,0,e);if(!i)throw new Error("Called contentMatchAt on a node with invalid content");return i}canReplace(e,i,n=Si.empty,o=0,c=n.childCount){let f=this.contentMatchAt(e).matchFragment(n,o,c),r=f&&f.matchFragment(this.content,i);if(!r||!r.validEnd)return!1;for(let x=o;x<c;x++)if(!this.type.allowsMarks(n.child(x).marks))return!1;return!0}canReplaceWith(e,i,n,o){if(o&&!this.type.allowsMarks(o))return!1;let c=this.contentMatchAt(e).matchType(n),f=c&&c.matchFragment(this.content,i);return f?f.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ws.none;for(let i=0;i<this.marks.length;i++){let n=this.marks[i];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ws.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(i=>i.type.name)}`);this.content.forEach(i=>i.check())}toJSON(){let e={type:this.type.name};for(let i in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(i=>i.toJSON())),e}static fromJSON(e,i){if(!i)throw new RangeError("Invalid input for Node.fromJSON");let n;if(i.marks){if(!Array.isArray(i.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=i.marks.map(e.markFromJSON)}if(i.type=="text"){if(typeof i.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(i.text,n)}let o=Si.fromJSON(e,i.content),c=e.nodeType(i.type).create(i.attrs,o,n);return c.type.checkAttrs(c.attrs),c}};sg.prototype.text=void 0;class yP extends sg{constructor(e,i,n,o){if(super(e,i,null,o),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):$re(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,i){return this.text.slice(e,i)}get nodeSize(){return this.text.length}
vendor: 9,720 bytes, lines 3723-3724
3723mark(e){return e==this.marks?this:new yP(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yP(this.type,this.attrs,e,this.marks)}cut(e=0,i=this.text.length){return e==0&&i==this.text.length?this:this.withText(this.text.slice(e,i))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function $re(t,e){for(let i=t.length-1;i>=0;i--)e=t[i].type.name+"("+e+")";return e}class Y_{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,i){let n=new Eke(e,i);if(n.next==null)return Y_.empty;let o=qre(n);n.next&&n.err("Unexpected trailing text");let c=Dke(Mke(o));return Rke(c,n),c}matchType(e){for(let i=0;i<this.next.length;i++)if(this.next[i].type==e)return this.next[i].next;return null}matchFragment(e,i=0,n=e.childCount){let o=this;for(let c=i;o&&c<n;c++)o=o.matchType(e.child(c).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:i}=this.next[e];if(!(i.isText||i.hasRequiredAttrs()))return i}return null}compatible(e){for(let i=0;i<this.next.length;i++)for(let n=0;n<e.next.length;n++)if(this.next[i].type==e.next[n].type)return!0;return!1}fillBefore(e,i=!1,n=0){let o=[this];function c(f,r){let x=f.matchFragment(e,n);if(x&&(!i||x.validEnd))return Si.from(r.map(S=>S.createAndFill()));for(let S=0;S<f.next.length;S++){let{type:C,next:I}=f.next[S];if(!(C.isText||C.hasRequiredAttrs())&&o.indexOf(I)==-1){o.push(I);let N=c(I,r.concat(C));if(N)return N}}return null}return c(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let i=this.computeWrapping(e);return this.wrapCache.push(e,i),i}computeWrapping(e){let i=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let o=n.shift(),c=o.match;if(c.matchType(e)){let f=[];for(let r=o;r.type;r=r.via)f.push(r.type);return f.reverse()}for(let f=0;f<c.next.length;f++){let{type:r,next:x}=c.next[f];!r.isLeaf&&!r.hasRequiredAttrs()&&!(r.name in i)&&(!o.type||x.validEnd)&&(n.push({match:r.contentMatch,type:r,via:o}),i[r.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function i(n){e.push(n);for(let o=0;o<n.next.length;o++)e.indexOf(n.next[o].next)==-1&&i(n.next[o].next)}return i(this),e.map((n,o)=>{let c=o+(n.validEnd?"*":" ")+" ";for(let f=0;f<n.next.length;f++)c+=(f?", ":"")+n.next[f].type.name+"->"+e.indexOf(n.next[f].next);return c}).join(` 3724`)}}Y_.empty=new Y_(!0);class Eke{constructor(e,i){this.string=e,this.nodeTypes=i,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function qre(t){let e=[];do e.push(Ake(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ake(t){let e=[];do e.push(Ike(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Ike(t){let e=Nke(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=kke(t,e);else break;return e}function nH(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function kke(t,e){let i=nH(t),n=i;return t.eat(",")&&(t.next!="}"?n=nH(t):n=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:i,max:n,expr:e}}function Pke(t,e){let i=t.nodeTypes,n=i[e];if(n)return[n];let o=[];for(let c in i){let f=i[c];f.isInGroup(e)&&o.push(f)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function Nke(t){if(t.eat("(")){let e=qre(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Pke(t,t.next).map(i=>(t.inline==null?t.inline=i.isInline:t.inline!=i.isInline&&t.err("Mixing inline and block content"),{type:"name",value:i}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Mke(t){let e=[[]];return o(c(t,0),i()),e;function i(){return e.push([])-1}function n(f,r,x){let S={term:x,to:r};return e[f].push(S),S}function o(f,r){f.forEach(x=>x.to=r)}function c(f,r){if(f.type=="choice")return f.exprs.reduce((x,S)=>x.concat(c(S,r)),[]);if(f.type=="seq")for(let x=0;;x++){let S=c(f.exprs[x],r);if(x==f.exprs.length-1)return S;o(S,r=i())}else if(f.type=="star"){let x=i();return n(r,x),o(c(f.expr,x),x),[n(x)]}else if(f.type=="plus"){let x=i();return o(c(f.expr,r),x),o(c(f.expr,x),x),[n(x)]}else{if(f.type=="opt")return[n(r)].concat(c(f.expr,r));if(f.type=="range"){let x=r;for(let S=0;S<f.min;S++){let C=i();o(c(f.expr,x),C),x=C}if(f.max==-1)o(c(f.expr,x),x);else for(let S=f.min;S<f.max;S++){let C=i();n(x,C),o(c(f.expr,x),C),x=C}return[n(x)]}else{if(f.type=="name")return[n(r,void 0,f.value)];throw new Error("Unknown expr type")}}}}function Hre(t,e){return e-t}function rH(t,e){let i=[];return n(e),i.sort(Hre);function n(o){let c=t[o];if(c.length==1&&!c[0].term)return n(c[0].to);i.push(o);for(let f=0;f<c.length;f++){let{term:r,to:x}=c[f];!r&&i.indexOf(x)==-1&&n(x)}}}function Dke(t){let e=Object.create(null);return i(rH(t,0));function i(n){let o=[];n.forEach(f=>{t[f].forEach(({term:r,to:x})=>{if(!r)return;let S;for(let C=0;C<o.length;C++)o[C][0]==r&&(S=o[C][1]);rH(t,x).forEach(C=>{S||o.push([r,S=[]]),S.indexOf(C)==-1&&S.push(C)})})});let c=e[n.join(",")]=new Y_(n.indexOf(t.length-1)>-1);for(let f=0;f<o.length;f++){let r=o[f][1].sort(Hre);c.next.push({type:o[f][0],next:e[r.join(",")]||i(r)})}return c}}function Rke(t,e){for(let i=0,n=[t];i<n.length;i++){let o=n[i],c=!o.validEnd,f=[];for(let r=0;r<o.next.length;r++){let{type:x,next:S}=o.next[r];f.push(x.name),c&&!(x.isText||x.hasRequiredAttrs())&&(c=!1),n.indexOf(S)==-1&&n.push(S)}c&&e.err("Only non-generatable nodes ("+f.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Gre(t){let e=Object.create(null);for(let i in t){let n=t[i];if(!n.hasDefault)return null;e[i]=n.default}return e}function Wre(t,e){let i=Object.create(null);for(let n in t){let o=e&&e[n];if(o===void 0){let c=t[n];if(c.hasDefault)o=c.default;else throw new RangeError("No value supplied for attribute "+n)}i[n]=o}return i}function Kre(t,e,i,n){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${i} of type ${o}`);for(let o in t){let c=t[o];c.validate&&c.validate(e[o])}}function Zre(t,e){let i=Object.create(null);if(e)for(let n in e)i[n]=new zke(t,n,e[n]);return i}let sH=class Xre{constructor(e,i,n){this.name=e,this.schema=i,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Zre(e,n.attrs),this.defaultAttrs=Gre(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Y_.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Wre(this.attrs,e)}create(e=null,i,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new sg(this,this.computeAttrs(e),Si.from(i),Ws.setFrom(n))}createChecked(e=null,i,n){return i=Si.from(i),this.checkContent(i),new sg(this,this.computeAttrs(e),i,Ws.setFrom(n))}createAndFill(e=null,i,n){if(e=this.computeAttrs(e),i=Si.from(i),i.size){let f=this.contentMatch.fillBefore(i);if(!f)return null;i=f.append(i)}let o=this.contentMatch.matchFragment(i),c=o&&o.fillBefore(Si.empty,!0);return c?new sg(this,e,i.append(c),Ws.setFrom(n)):null}validContent(e){let i=this.contentMatch.matchFragment(e);if(!i||!i.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Kre(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let i=0;i<e.length;i++)if(!this.allowsMarkType(e[i].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let i;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?i&&i.push(e[n]):i||(i=e.slice(0,n));return i?i.length?i:Ws.none:e}static compile(e,i){let n=Object.create(null);e.forEach((c,f)=>n[c]=new Xre(c,i,f));let o=i.spec.topNode||"doc";if(!n[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let c in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function jke(t,e,i){let n=i.split("|");return o=>{let c=o===null?"null":typeof o;if(n.indexOf(c)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${t}, got ${c}`)}}class zke{constructor(e,i,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?jke(e,i,n.val
vendor: 9,558 bytes, lines 3724-3726
3724idate):n.validate}get isRequired(){return!this.hasDefault}}class AM{constructor(e,i,n,o){this.name=e,this.rank=i,this.schema=n,this.spec=o,this.attrs=Zre(e,o.attrs),this.excluded=null;let c=Gre(this.attrs);this.instance=c?new Ws(this,c):null}create(e=null){return!e&&this.instance?this.instance:new Ws(this,Wre(this.attrs,e))}static compile(e,i){let n=Object.create(null),o=0;return e.forEach((c,f)=>n[c]=new AM(c,o++,i,f)),n}removeFromSet(e){for(var i=0;i<e.length;i++)e[i].type==this&&(e=e.slice(0,i).concat(e.slice(i+1)),i--);return e}isInSet(e){for(let i=0;i<e.length;i++)if(e[i].type==this)return e[i]}checkAttrs(e){Kre(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Yre=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let i=this.spec={};for(let o in e)i[o]=e[o];i.nodes=nl.from(e.nodes),i.marks=nl.from(e.marks||{}),this.nodes=sH.compile(this.spec.nodes,this),this.marks=AM.compile(this.spec.marks,this);let n=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let c=this.nodes[o],f=c.spec.content||"",r=c.spec.marks;if(c.contentMatch=n[f]||(n[f]=Y_.parse(f,this.nodes)),c.inlineContent=c.contentMatch.inlineContent,c.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!c.isInline||!c.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=c}c.markSet=r=="_"?null:r?oH(this,r.split(" ")):r==""||!c.inlineContent?[]:null}for(let o in this.marks){let c=this.marks[o],f=c.spec.excludes;c.excluded=f==null?[c]:f==""?[]:oH(this,f.split(" "))}this.nodeFromJSON=o=>sg.fromJSON(this,o),this.markFromJSON=o=>Ws.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,i=null,n,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof sH){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(i,n,o)}text(e,i){let n=this.nodes.text;return new yP(n,n.defaultAttrs,e,Ws.setFrom(i))}mark(e,i){return typeof e=="string"&&(e=this.marks[e]),e.create(i)}nodeType(e){let i=this.nodes[e];if(!i)throw new RangeError("Unknown node type: "+e);return i}};function oH(t,e){let i=[];for(let n=0;n<e.length;n++){let o=e[n],c=t.marks[o],f=c;if(c)i.push(c);else for(let r in t.marks){let x=t.marks[r];(o=="_"||x.spec.group&&x.spec.group.split(" ").indexOf(o)>-1)&&i.push(f=x)}if(!f)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return i}function Lke(t){return t.tag!=null}function Oke(t){return t.style!=null}class og{constructor(e,i){this.schema=e,this.rules=i,this.tags=[],this.styles=[];let n=this.matchedStyles=[];i.forEach(o=>{if(Lke(o))this.tags.push(o);else if(Oke(o)){let c=/[^=]*/.exec(o.style)[0];n.indexOf(c)<0&&n.push(c),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let c=e.nodes[o.node];return c.contentMatch.matchType(c)})}parse(e,i={}){let n=new lH(this,i,!1);return n.addAll(e,Ws.none,i.from,i.to),n.finish()}parseSlice(e,i={}){let n=new lH(this,i,!0);return n.addAll(e,Ws.none,i.from,i.to),pn.maxOpen(n.finish())}matchTag(e,i,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){let c=this.tags[o];if(Uke(e,c.tag)&&(c.namespace===void 0||e.namespaceURI==c.namespace)&&(!c.context||i.matchesContext(c.context))){if(c.getAttrs){let f=c.getAttrs(e);if(f===!1)continue;c.attrs=f||void 0}return c}}}matchStyle(e,i,n,o){for(let c=o?this.styles.indexOf(o)+1:0;c<this.styles.length;c++){let f=this.styles[c],r=f.style;if(!(r.indexOf(e)!=0||f.context&&!n.matchesContext(f.context)||r.length>e.length&&(r.charCodeAt(e.length)!=61||r.slice(e.length+1)!=i))){if(f.getAttrs){let x=f.getAttrs(i);if(x===!1)continue;f.attrs=x||void 0}return f}}}static schemaRules(e){let i=[];function n(o){let c=o.priority==null?50:o.priority,f=0;for(;f<i.length;f++){let r=i[f];if((r.priority==null?50:r.priority)<c)break}i.splice(f,0,o)}for(let o in e.marks){let c=e.marks[o].spec.parseDOM;c&&c.forEach(f=>{n(f=cH(f)),f.mark||f.ignore||f.clearMark||(f.mark=o)})}for(let o in e.nodes){let c=e.nodes[o].spec.parseDOM;c&&c.forEach(f=>{n(f=cH(f)),f.node||f.ignore||f.mark||(f.node=o)})}return i}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new og(e,og.schemaRules(e)))}}const Qre={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Fke={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Jre={ol:!0,ul:!0},vC=1,jO=2,bT=4;function aH(t,e,i){return e!=null?(e?vC:0)|(e==="full"?jO:0):t&&t.whitespace=="pre"?vC|jO:i&~bT}class aI{constructor(e,i,n,o,c,f){this.type=e,this.attrs=i,this.marks=n,this.solid=o,this.options=f,this.content=[],this.activeMarks=Ws.none,this.match=c||(f&bT?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let i=this.type.contentMatch.fillBefore(Si.from(e));if(i)this.match=this.type.contentMatch.matchFragment(i);else{let n=this.type.contentMatch,o;return(o=n.findWrapping(e.type))?(this.match=n,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&vC)){let n=this.content[this.content.length-1],o;if(n&&n.isText&&(o=/[ \t\r\n\u000c]+$/.exec(n.text))){let c=n;n.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=c.withText(c.text.slice(0,c.text.length-o[0].length))}}let i=Si.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(Si.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Qre.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lH{constructor(e,i,n){this.parser=e,this.options=i,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let o=i.topNode,c,f=aH(null,i.preserveWhitespace,0)|(n?bT:0);o?c=new aI(o.type,o.attrs,Ws.none,!0,i.topMatch||o.type.contentMatch,f):n?c=new aI(null,null,Ws.none,!0,null,f):c=new aI(e.schema.topNodeType,null,Ws.none,!0,null,f),this.nodes=[c],this.find=i.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,i){e.nodeType==3?this.addTextNode(e,i):e.nodeType==1&&this.addElement(e,i)}addTextNode(e,i){let n=e.nodeValue,o=this.top,c=o.options&jO?"full":this.localPreserveWS||(o.options&vC)>0,{schema:f}=this.parser;if(c==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(c)if(c==="full")n=n.replace(/\r\n?/g,` 3725`);else if(f.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(f.linebreakReplacement.create())){let r=n.split(/\r?\n|\r/);for(let x=0;x<r.length;x++)x&&this.insertNode(f.linebreakReplacement.create(),i,!0),r[x]&&this.insertNode(f.text(r[x]),i,!/\S/.test(r[x]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let r=o.content[o.content.length-1],x=e.previousSibling;(!r||x&&x.nodeName=="BR"||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(n=n.slice(1))}n&&this.insertNode(f.text(n),i,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,i,n){let o=this.localPreserveWS,c=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let f=e.nodeName.toLowerCase(),r;Jre.hasOwnProperty(f)&&this.parser.normalizeLists&&Bke(e);let x=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(r=this.parser.matchTag(e,this,n));e:if(x?x.ignore:Fke.hasOwnProperty(f))this.findInside(e),this.ignoreFallback(e,i);else if(!x||x.skip||x.closeParent){x&&x.closeParent?this.open=Math.max(0,this.open-1):x&&x.skip.nodeType&&(e=x.skip);let S,C=this.needsBlock;if(Qre.hasOwnProperty(f))c.content.length&&c.content[0].isInline&&this.open&&(this.open--,c=this.top),S=!0,c.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,i);break e}let I=x&&x.skip?i:this.readStyles(e,i);I&&this.addAll(e,I),S&&this.sync(c),this.needsBlock=C}else{let S=this.readStyles(e,i);S&&this.addElementByRule(e,x,S,x.consuming===!1?r:void 0)}this.localPreserveWS=o}leafFallback(e,i){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` 3726`),i)}ignoreFallback(e,i){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),i,!0)}readStyles(e,i){let n=e.style;if(n&&n.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let c=this.parser.matchedStyles[o],f=n.getPropertyValue(c);if(f)for(let r=void 0;;){let x=this.parser.matchStyle(c,f,this,r);if(!x)break;if(x.ignore)return null;if(x.clearMark?i=i.filter(S=>!x.clearMark(S)):i=i.concat(this.parser.schema.marks[x.mark].create(x.attrs)),x.consuming===!1)r=x;else break}}return i}addElementByRule(e,i,n,o){let c,f;if(i.node)if(f=this.parser.schema.nodes[i.node],f.isLeaf)this.insertNode(f.create(i.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let x=this.enter(f,i.attrs||null,n,i.preserveWhitespace);x&&(c=!0,n=x)}else{let x=this.parser.schema.marks[i.mark];n=n.concat(x.create(i.attrs))}let r=this.top;if(f&&f.isLeaf)this.findInside(e);else if(o)this.addElement(e,n,o);else if(i.getContent)this.findInside(e),i.getContent(e,this.parser.schema).forEac
vendor: 4,078 bytes, line 3726
3726h(x=>this.insertNode(x,n,!1));else{let x=e;typeof i.contentElement=="string"?x=e.querySelector(i.contentElement):typeof i.contentElement=="function"?x=i.contentElement(e):i.contentElement&&(x=i.contentElement),this.findAround(e,x,!0),this.addAll(x,n),this.findAround(e,x,!1)}c&&this.sync(r)&&this.open--}addAll(e,i,n,o){let c=n||0;for(let f=n?e.childNodes[n]:e.firstChild,r=o==null?null:e.childNodes[o];f!=r;f=f.nextSibling,++c)this.findAtPoint(e,c),this.addDOM(f,i);this.findAtPoint(e,c)}findPlace(e,i,n){let o,c;for(let f=this.open,r=0;f>=0;f--){let x=this.nodes[f],S=x.findWrapping(e);if(S&&(!o||o.length>S.length+r)&&(o=S,c=x,!S.length))break;if(x.solid){if(n)break;r+=2}}if(!o)return null;this.sync(c);for(let f=0;f<o.length;f++)i=this.enterInner(o[f],null,i,!1);return i}insertNode(e,i,n){if(e.isInline&&this.needsBlock&&!this.top.type){let c=this.textblockFromContext();c&&(i=this.enterInner(c,null,i))}let o=this.findPlace(e,i,n);if(o){this.closeExtra();let c=this.top;c.match&&(c.match=c.match.matchType(e.type));let f=Ws.none;for(let r of o.concat(e.marks))(c.type?c.type.allowsMarkType(r.type):uH(r.type,e.type))&&(f=r.addToSet(f));return c.content.push(e.mark(f)),!0}return!1}enter(e,i,n,o){let c=this.findPlace(e.create(i),n,!1);return c&&(c=this.enterInner(e,i,n,!0,o)),c}enterInner(e,i,n,o=!1,c){this.closeExtra();let f=this.top;f.match=f.match&&f.match.matchType(e);let r=aH(e,c,f.options);f.options&bT&&f.content.length==0&&(r|=bT);let x=Ws.none;return n=n.filter(S=>(f.type?f.type.allowsMarkType(S.type):uH(S.type,e))?(x=S.addToSet(x),!1):!0),this.nodes.push(new aI(e,i,x,o,null,r)),this.open++,n}closeExtra(e=!1){let i=this.nodes.length-1;if(i>this.open){for(;i>this.open;i--)this.nodes[i-1].content.push(this.nodes[i].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let i=this.open;i>=0;i--){if(this.nodes[i]==e)return this.open=i,!0;this.localPreserveWS&&(this.nodes[i].options|=vC)}return!1}get currentPos(){this.closeExtra();let e=0;for(let i=this.open;i>=0;i--){let n=this.nodes[i].content;for(let o=n.length-1;o>=0;o--)e+=n[o].nodeSize;i&&e++}return e}findAtPoint(e,i){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==i&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&(this.find[i].pos=this.currentPos)}findAround(e,i,n){if(e!=i&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&i.compareDocumentPosition(this.find[o].node)&(n?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&(this.find[i].pos=this.currentPos-(e.nodeValue.length-this.find[i].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let i=e.split("/"),n=this.options.context,o=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),c=-(n?n.depth+1:0)+(o?0:1),f=(r,x)=>{for(;r>=0;r--){let S=i[r];if(S==""){if(r==i.length-1||r==0)continue;for(;x>=c;x--)if(f(r-1,x))return!0;return!1}else{let C=x>0||x==0&&o?this.nodes[x].type:n&&x>=c?n.node(x-c).type:null;if(!C||C.name!=S&&!C.isInGroup(S))return!1;x--}}return!0};return f(i.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let i=e.depth;i>=0;i--){let n=e.node(i).contentMatchAt(e.indexAfter(i)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let i in this.parser.schema.nodes){let n=this.parser.schema.nodes[i];if(n.isTextblock&&n.defaultAttrs)return n}}}function Bke(t){for(let e=t.firstChild,i=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&Jre.hasOwnProperty(n)&&i?(i.appendChild(e),e=i):n=="li"?i=e:n&&(i=null)}}function Uke(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cH(t){let e={};for(let i in t)e[i]=t[i];return e}
vendor: 10,206 bytes, line 3726
3726function uH(t,e){let i=e.schema.nodes;for(let n in i){let o=i[n];if(!o.allowsMarkType(t))continue;let c=[],f=r=>{c.push(r);for(let x=0;x<r.edgeCount;x++){let{type:S,next:C}=r.edge(x);if(S==e||c.indexOf(C)<0&&f(C))return!0}};if(f(o.contentMatch))return!0}}class hv{constructor(e,i){this.nodes=e,this.marks=i}serializeFragment(e,i={},n){n||(n=ez(i).createDocumentFragment());let o=n,c=[];return e.forEach(f=>{if(c.length||f.marks.length){let r=0,x=0;for(;r<c.length&&x<f.marks.length;){let S=f.marks[x];if(!this.marks[S.type.name]){x++;continue}if(!S.eq(c[r][0])||S.type.spec.spanning===!1)break;r++,x++}for(;r<c.length;)o=c.pop()[1];for(;x<f.marks.length;){let S=f.marks[x++],C=this.serializeMark(S,f.isInline,i);C&&(c.push([S,o]),o.appendChild(C.dom),o=C.contentDOM||C.dom)}}o.appendChild(this.serializeNodeInner(f,i))}),n}serializeNodeInner(e,i){let{dom:n,contentDOM:o}=QI(ez(i),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,i,o)}return n}serializeNode(e,i={}){let n=this.serializeNodeInner(e,i);for(let o=e.marks.length-1;o>=0;o--){let c=this.serializeMark(e.marks[o],e.isInline,i);c&&((c.contentDOM||c.dom).appendChild(n),n=c.dom)}return n}serializeMark(e,i,n={}){let o=this.marks[e.type.name];return o&&QI(ez(n),o(e,i),null,e.attrs)}static renderSpec(e,i,n=null,o){return QI(e,i,n,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new hv(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let i=dH(e.nodes);return i.text||(i.text=n=>n.text),i}static marksFromSchema(e){return dH(e.marks)}}function dH(t){let e={};for(let i in t){let n=t[i].spec.toDOM;n&&(e[i]=n)}return e}function ez(t){return t.document||window.document}const hH=new WeakMap;function Vke(t){let e=hH.get(t);return e===void 0&&hH.set(t,e=$ke(t)),e}function $ke(t){let e=null;function i(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let o=0;o<n.length;o++)i(n[o]);else for(let o in n)i(n[o])}return i(t),e}function QI(t,e,i,n){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],c;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(c=Vke(n))&&c.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let f=o.indexOf(" ");f>0&&(i=o.slice(0,f),o=o.slice(f+1));let r,x=i?t.createElementNS(i,o):t.createElement(o),S=e[1],C=1;if(S&&typeof S=="object"&&S.nodeType==null&&!Array.isArray(S)){C=2;for(let I in S)if(S[I]!=null){let N=I.indexOf(" ");N>0?x.setAttributeNS(I.slice(0,N),I.slice(N+1),S[I]):I=="style"&&x.style?x.style.cssText=S[I]:x.setAttribute(I,S[I])}}for(let I=C;I<e.length;I++){let N=e[I];if(N===0){if(I<e.length-1||I>C)throw new RangeError("Content hole must be the only child of its parent node");return{dom:x,contentDOM:x}}else{let{dom:D,contentDOM:V}=QI(t,N,i,n);if(x.appendChild(D),V){if(r)throw new RangeError("Multiple content holes");r=V}}}return{dom:x,contentDOM:r}}const ese=65535,tse=Math.pow(2,16);function qke(t,e){return t+e*tse}function pH(t){return t&ese}function Hke(t){return(t-(t&ese))/tse}const ise=1,nse=2,JI=4,rse=8;class zO{constructor(e,i,n){this.pos=e,this.delInfo=i,this.recover=n}get deleted(){return(this.delInfo&rse)>0}get deletedBefore(){return(this.delInfo&(ise|JI))>0}get deletedAfter(){return(this.delInfo&(nse|JI))>0}get deletedAcross(){return(this.delInfo&JI)>0}}class eu{constructor(e,i=!1){if(this.ranges=e,this.inverted=i,!e.length&&eu.empty)return eu.empty}recover(e){let i=0,n=pH(e);if(!this.inverted)for(let o=0;o<n;o++)i+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[n*3]+i+Hke(e)}mapResult(e,i=1){return this._map(e,i,!1)}map(e,i=1){return this._map(e,i,!0)}_map(e,i,n){let o=0,c=this.inverted?2:1,f=this.inverted?1:2;for(let r=0;r<this.ranges.length;r+=3){let x=this.ranges[r]-(this.inverted?o:0);if(x>e)break;let S=this.ranges[r+c],C=this.ranges[r+f],I=x+S;if(e<=I){let N=S?e==x?-1:e==I?1:i:i,D=x+o+(N<0?0:C);if(n)return D;let V=e==(i<0?x:I)?null:qke(r/3,e-x),B=e==x?nse:e==I?ise:JI;return(i<0?e!=x:e!=I)&&(B|=rse),new zO(D,B,V)}o+=C-S}return n?e+o:new zO(e+o,0,null)}touches(e,i){let n=0,o=pH(i),c=this.inverted?2:1,f=this.inverted?1:2;for(let r=0;r<this.ranges.length;r+=3){let x=this.ranges[r]-(this.inverted?n:0);if(x>e)break;let S=this.ranges[r+c],C=x+S;if(e<=C&&r==o*3)return!0;n+=this.ranges[r+f]-S}return!1}forEach(e){let i=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,c=0;o<this.ranges.length;o+=3){let f=this.ranges[o],r=f-(this.inverted?c:0),x=f+(this.inverted?0:c),S=this.ranges[o+i],C=this.ranges[o+n];e(r,r+S,x,x+C),c+=C-S}}invert(){return new eu(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?eu.empty:new eu(e<0?[0,-e,0]:[0,0,e])}}eu.empty=new eu([]);class xC{constructor(e,i,n=0,o=e?e.length:0){this.mirror=i,this.from=n,this.to=o,this._maps=e||[],this.ownData=!(e||i)}get maps(){return this._maps}slice(e=0,i=this.maps.length){return new xC(this._maps,this.mirror,e,i)}appendMap(e,i){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),i!=null&&this.setMirror(this._maps.length-1,i)}appendMapping(e){for(let i=0,n=this._maps.length;i<e._maps.length;i++){let o=e.getMirror(i);this.appendMap(e._maps[i],o!=null&&o<i?n+o:void 0)}}getMirror(e){if(this.mirror){for(let i=0;i<this.mirror.length;i++)if(this.mirror[i]==e)return this.mirror[i+(i%2?-1:1)]}}setMirror(e,i){this.mirror||(this.mirror=[]),this.mirror.push(e,i)}appendMappingInverted(e){for(let i=e.maps.length-1,n=this._maps.length+e._maps.length;i>=0;i--){let o=e.getMirror(i);this.appendMap(e._maps[i].invert(),o!=null&&o>i?n-o-1:void 0)}}invert(){let e=new xC;return e.appendMappingInverted(this),e}map(e,i=1){if(this.mirror)return this._map(e,i,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,i);return e}mapResult(e,i=1){return this._map(e,i,!1)}_map(e,i,n){let o=0;for(let c=this.from;c<this.to;c++){let f=this._maps[c],r=f.mapResult(e,i);if(r.recover!=null){let x=this.getMirror(c);if(x!=null&&x>c&&x<this.to){c=x,e=this._maps[x].recover(r.recover);continue}}o|=r.delInfo,e=r.pos}return n?e:new zO(e,o,null)}}const tz=Object.create(null);class Pl{getMap(){return eu.empty}merge(e){return null}static fromJSON(e,i){if(!i||!i.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=tz[i.stepType];if(!n)throw new RangeError(`No step type ${i.stepType} defined`);return n.fromJSON(e,i)}static jsonID(e,i){if(e in tz)throw new RangeError("Duplicate use of step JSON ID "+e);return tz[e]=i,i.prototype.jsonID=e,i}}class fa{constructor(e,i){this.doc=e,this.failed=i}static ok(e){return new fa(e,null)}static fail(e){return new fa(null,e)}static fromReplace(e,i,n,o){try{return fa.ok(e.replace(i,n,o))}catch(c){if(c instanceof fP)return fa.fail(c.message);throw c}}}function G4(t,e,i){let n=[];for(let o=0;o<t.childCount;o++){let c=t.child(o);c.content.size&&(c=c.copy(G4(c.content,e,c))),c.isInline&&(c=e(c,i,o)),n.push(c)}return Si.fromArray(n)}class qm extends Pl{constructor(e,i,n){super(),this.from=e,this.to=i,this.mark=n}apply(e){let i=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),c=new pn(G4(i.content,(f,r)=>!f.isAtom||!r.type.allowsMarkType(this.mark.type)?f:f.mark(this.mark.addToSet(f.marks)),o),i.openStart,i.openEnd);return fa.fromReplace(e,this.from,this.to,c)}invert(){return new Nd(this.from,this.to,this.mark)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new qm(i.pos,n.pos,this.mark)}merge(e){return e instanceof qm&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qm(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qm(i.from,i.to,e.markFromJSON(i.mark))}}Pl.jsonID("addMark",qm);class Nd extends Pl{constructor(e,i,n){super(),this.from=e,this.to=i,this.mark=n}apply(e){let i=e.slice(this.from,this.to),n=new pn(G4(i.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),i.openStart,i.openEnd);return fa.fromReplace(e,this.from,this.to,n)}invert(){return new qm(this.from,this.to,this.mark)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new Nd(i.pos,n.pos,this.mark)}merge(e){return e instanceof Nd&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nd(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Nd(i.from,i.to,e.markFromJSON(i.mark))}}Pl.jsonID("removeMark",Nd);class Hm extends Pl{constructor(e,i){super(),this.pos=e,this.mark=i}apply(e){let i=e.nodeAt(this.pos);if(!i)return fa.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.addToSet(i.marks));return fa.fromReplace(e,this.pos,this.pos+1,new pn(Si.from(n),0,i.isLeaf?0:1))}invert(e){let i=e.nodeAt(this.pos);if(i){let n=this.mark.addToSet(i.marks);if(n.length==i.marks.length){for(let o=0;o<i.marks.length;o++)if(!i.marks[o].isInSet(n))return new Hm(this.pos,i.marks[o]);return new Hm(this.pos,this.mark)}}return new Q_(this.pos,this.mark)}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new Hm(i.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Hm(i.pos,e.markFromJSON(i.mark))}}Pl.jsonID("addNodeMark",Hm);class Q_ extends Pl{constructor(e,i){super(),this.pos=e,this.mark=i}
vendor: 4,684 bytes, line 3726
3726apply(e){let i=e.nodeAt(this.pos);if(!i)return fa.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.removeFromSet(i.marks));return fa.fromReplace(e,this.pos,this.pos+1,new pn(Si.from(n),0,i.isLeaf?0:1))}invert(e){let i=e.nodeAt(this.pos);return!i||!this.mark.isInSet(i.marks)?this:new Hm(this.pos,this.mark)}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new Q_(i.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Q_(i.pos,e.markFromJSON(i.mark))}}Pl.jsonID("removeNodeMark",Q_);class Ba extends Pl{constructor(e,i,n,o=!1){super(),this.from=e,this.to=i,this.slice=n,this.structure=o}apply(e){return this.structure&&LO(e,this.from,this.to)?fa.fail("Structure replace would overwrite content"):fa.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new eu([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ba(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return i.deletedAcross&&n.deletedAcross?null:new Ba(i.pos,Math.max(i.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ba)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let i=this.slice.size+e.slice.size==0?pn.empty:new pn(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ba(this.from,this.to+(e.to-e.from),i,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let i=this.slice.size+e.slice.size==0?pn.empty:new pn(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ba(e.from,this.to,i,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ba(i.from,i.to,pn.fromJSON(e,i.slice),!!i.structure)}}Pl.jsonID("replace",Ba);class qa extends Pl{constructor(e,i,n,o,c,f,r=!1){super(),this.from=e,this.to=i,this.gapFrom=n,this.gapTo=o,this.slice=c,this.insert=f,this.structure=r}apply(e){if(this.structure&&(LO(e,this.from,this.gapFrom)||LO(e,this.gapTo,this.to)))return fa.fail("Structure gap-replace would overwrite content");let i=e.slice(this.gapFrom,this.gapTo);if(i.openStart||i.openEnd)return fa.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,i.content);return n?fa.fromReplace(e,this.from,this.to,n):fa.fail("Content does not fit in gap")}getMap(){return new eu([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let i=this.gapTo-this.gapFrom;return new qa(this.from,this.from+this.slice.size+i,this.from+this.insert,this.from+this.insert+i,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let i=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),o=this.from==this.gapFrom?i.pos:e.map(this.gapFrom,-1),c=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return i.deletedAcross&&n.deletedAcross||o<i.pos||c>n.pos?null:new qa(i.pos,n.pos,o,c,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,i){if(typeof i.from!="number"||typeof i.to!="number"||typeof i.gapFrom!="number"||typeof i.gapTo!="number"||typeof i.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new qa(i.from,i.to,i.gapFrom,i.gapTo,pn.fromJSON(e,i.slice),i.insert,!!i.structure)}}Pl.jsonID("replaceAround",qa);function LO(t,e,i){let n=t.resolve(e),o=i-e,c=n.depth;for(;o>0&&c>0&&n.indexAfter(c)==n.node(c).childCount;)c--,o--;if(o>0){let f=n.node(c).maybeChild(n.indexAfter(c));for(;o>0;){if(!f||f.isLeaf)return!0;f=f.firstChild,o--}}return!1}function Gke(t,e,i,n){let o=[],c=[],f,r;t.doc.nodesBetween(e,i,(x,S,C)=>{if(!x.isInline)return;let I=x.marks;if(!n.isInSet(I)&&C.type.allowsMarkType(n.type)){let N=Math.max(S,e),D=Math.min(S+x.nodeSize,i),V=n.addToSet(I);for(let B=0;B<I.length;B++)I[B].isInSet(V)||(f&&f.to==N&&f.mark.eq(I[B])?f.to=D:o.push(f=new Nd(N,D,I[B])));r&&r.to==N?r.to=D:c.push(r=new qm(N,D,n))}}),o.forEach(x=>
vendor: 4,823 bytes, lines 3726-3727
3726t.step(x)),c.forEach(x=>t.step(x))}function Wke(t,e,i,n){let o=[],c=0;t.doc.nodesBetween(e,i,(f,r)=>{if(!f.isInline)return;c++;let x=null;if(n instanceof AM){let S=f.marks,C;for(;C=n.isInSet(S);)(x||(x=[])).push(C),S=C.removeFromSet(S)}else n?n.isInSet(f.marks)&&(x=[n]):x=f.marks;if(x&&x.length){let S=Math.min(r+f.nodeSize,i);for(let C=0;C<x.length;C++){let I=x[C],N;for(let D=0;D<o.length;D++){let V=o[D];V.step==c-1&&I.eq(o[D].style)&&(N=V)}N?(N.to=S,N.step=c):o.push({style:I,from:Math.max(r,e),to:S,step:c})}}}),o.forEach(f=>t.step(new Nd(f.from,f.to,f.style)))}function W4(t,e,i,n=i.contentMatch,o=!0){let c=t.doc.nodeAt(e),f=[],r=e+1;for(let x=0;x<c.childCount;x++){let S=c.child(x),C=r+S.nodeSize,I=n.matchType(S.type);if(!I)f.push(new Ba(r,C,pn.empty));else{n=I;for(let N=0;N<S.marks.length;N++)i.allowsMarkType(S.marks[N].type)||t.step(new Nd(r,C,S.marks[N]));if(o&&S.isText&&i.whitespace!="pre"){let N,D=/\r?\n|\r/g,V;for(;N=D.exec(S.text);)V||(V=new pn(Si.from(i.schema.text(" ",i.allowedMarks(S.marks))),0,0)),f.push(new Ba(r+N.index,r+N.index+N[0].length,V))}}r=C}if(!n.validEnd){let x=n.fillBefore(Si.empty,!0);t.replace(r,r,new pn(x,0,0))}for(let x=f.length-1;x>=0;x--)t.step(f[x])}function Kke(t,e,i){return(e==0||t.canReplace(e,t.childCount))&&(i==t.childCount||t.canReplace(0,i))}function l1(t){let i=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,o=0,c=0;;--n){let f=t.$from.node(n),r=t.$from.index(n)+o,x=t.$to.indexAfter(n)-c;if(n<t.depth&&f.canReplace(r,x,i))return n;if(n==0||f.type.spec.isolating||!Kke(f,r,x))break;r&&(o=1),x<f.childCount&&(c=1)}return null}function Zke(t,e,i){let{$from:n,$to:o,depth:c}=e,f=n.before(c+1),r=o.after(c+1),x=f,S=r,C=Si.empty,I=0;for(let V=c,B=!1;V>i;V--)B||n.index(V)>0?(B=!0,C=Si.from(n.node(V).copy(C)),I++):x--;let N=Si.empty,D=0;for(let V=c,B=!1;V>i;V--)B||o.after(V+1)<o.end(V)?(B=!0,N=Si.from(o.node(V).copy(N)),D++):S++;t.step(new qa(x,S,f,r,new pn(C.append(N),I,D),C.size-I,!0))}function K4(t,e,i=null,n=t){let o=Xke(t,e),c=o&&Yke(n,e);return c?o.map(fH).concat({type:e,attrs:i}).concat(c.map(fH)):null}function fH(t){return{type:t,attrs:null}}function Xke(t,e){let{parent:i,startIndex:n,endIndex:o}=t,c=i.contentMatchAt(n).findWrapping(e);if(!c)return null;let f=c.length?c[0]:e;return i.canReplaceWith(n,o,f)?c:null}function Yke(t,e){let{parent:i,startIndex:n,endIndex:o}=t,c=i.child(n),f=e.contentMatch.findWrapping(c.type);if(!f)return null;let x=(f.length?f[f.length-1]:e).contentMatch;for(let S=n;x&&S<o;S++)x=x.matchType(i.child(S).type);return!x||!x.validEnd?null:f}function Qke(t,e,i){let n=Si.empty;for(let f=i.length-1;f>=0;f--){if(n.size){let r=i[f].type.contentMatch.matchFragment(n);if(!r||!r.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Si.from(i[f].type.create(i[f].attrs,n))}let o=e.start,c=e.end;t.step(new qa(o,c,o,c,new pn(n,0,0),i.length,!0))}function Jke(t,e,i,n,o){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let c=t.steps.length;t.doc.nodesBetween(e,i,(f,r)=>{let x=typeof o=="function"?o(f):o;if(f.isTextblock&&!f.hasMarkup(n,x)&&ePe(t.doc,t.mapping.slice(c).map(r),n)){let S=null;if(n.schema.linebreakReplacement){let D=n.whitespace=="pre",V=!!n.contentMatch.matchType(n.schema.linebreakReplacement);D&&!V?S=!1:!D&&V&&(S=!0)}S===!1&&ose(t,f,r,c),W4(t,t.mapping.slice(c).map(r,1),n,void 0,S===null);let C=t.mapping.slice(c),I=C.map(r,1),N=C.map(r+f.nodeSize,1);return t.step(new qa(I,N,I+1,N-1,new pn(Si.from(n.create(x,null,f.marks)),0,0),1,!0)),S===!0&&sse(t,f,r,c),!1}})}function sse(t,e,i,n){e.forEach((o,c)=>{if(o.isText){let f,r=/\r?\n|\r/g;for(;f=r.exec(o.text);){let x=t.mapping.slice(n).map(i+1+c+f.index);t.replaceWith(x,x+1,e.type.schema.linebreakReplacement.create())}}})}function ose(t,e,i,n){e.forEach((o,c)=>{if(o.type==o.type.schema.linebreakReplacement){let f=t.mapping.slice(n).map(i+1+c);t.replaceWith(f,f+1,e.type.schema.text(` 3727`))}})}function ePe(t,e,i){let n=t.resolve(e),o=n.index();return n.parent.canReplaceWith(o,o+1,i)}function tPe(t,e,i,n,o){let c=t.doc.nodeAt(e);if(!c)throw new RangeError("No node at given position");i||(i=c.type);let f=i.create(n,null,o||c.marks);if(c.isLeaf)return t.replaceWith(e,e+c.nodeSize,f);if(!i.validContent(c.content))throw new RangeError("Invalid content for node type "+i.name);t.step(new qa(e,e+c.nodeSize,e+1,e+c.nodeSize-1,new pn(Si.from(f),0,0),1,!0))}function P0(t,e,i=1,n){let o=t.resolve(e),c=o.depth-i,f=n&&n[n.length-1]||o.parent;if(c<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!f.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let S=o.depth-1,C=i-2;S>c;S--,C--){let I=o.node(S),N=o.index(S);if(I.type.spec.isolating)return!1;
vendor: 6,649 bytes, line 3727
3727let D=I.content.cutByIndex(N,I.childCount),V=n&&n[C+1];V&&(D=D.replaceChild(0,V.type.create(V.attrs)));let B=n&&n[C]||I;if(!I.canReplace(N+1,I.childCount)||!B.type.validContent(D))return!1}let r=o.indexAfter(c),x=n&&n[0];return o.node(c).canReplaceWith(r,r,x?x.type:o.node(c+1).type)}function iPe(t,e,i=1,n){let o=t.doc.resolve(e),c=Si.empty,f=Si.empty;for(let r=o.depth,x=o.depth-i,S=i-1;r>x;r--,S--){c=Si.from(o.node(r).copy(c));let C=n&&n[S];f=Si.from(C?C.type.create(C.attrs,f):o.node(r).copy(f))}t.step(new Ba(e,e,new pn(c.append(f),i,i),!0))}function Og(t,e){let i=t.resolve(e),n=i.index();return ase(i.nodeBefore,i.nodeAfter)&&i.parent.canReplace(n,n+1)}function nPe(t,e){e.content.size||t.type.compatibleContent(e.type);let i=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let o=0;o<e.childCount;o++){let c=e.child(o),f=c.type==n?t.type.schema.nodes.text:c.type;if(i=i.matchType(f),!i||!t.type.allowsMarks(c.marks))return!1}return i.validEnd}function ase(t,e){return!!(t&&e&&!t.isLeaf&&nPe(t,e))}function IM(t,e,i=-1){let n=t.resolve(e);for(let o=n.depth;;o--){let c,f,r=n.index(o);if(o==n.depth?(c=n.nodeBefore,f=n.nodeAfter):i>0?(c=n.node(o+1),r++,f=n.node(o).maybeChild(r)):(c=n.node(o).maybeChild(r-1),f=n.node(o+1)),c&&!c.isTextblock&&ase(c,f)&&n.node(o).canReplace(r,r+1))return e;if(o==0)break;e=i<0?n.before(o):n.after(o)}}function rPe(t,e,i){let n=null,{linebreakReplacement:o}=t.doc.type.schema,c=t.doc.resolve(e-i),f=c.node().type;if(o&&f.inlineContent){let C=f.whitespace=="pre",I=!!f.contentMatch.matchType(o);C&&!I?n=!1:!C&&I&&(n=!0)}let r=t.steps.length;if(n===!1){let C=t.doc.resolve(e+i);ose(t,C.node(),C.before(),r)}f.inlineContent&&W4(t,e+i-1,f,c.node().contentMatchAt(c.index()),n==null);let x=t.mapping.slice(r),S=x.map(e-i);if(t.step(new Ba(S,x.map(e+i,-1),pn.empty,!0)),n===!0){let C=t.doc.resolve(S);sse(t,C.node(),C.before(),t.steps.length)}return t}function sPe(t,e,i){let n=t.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),i))return e;if(n.parentOffset==0)for(let o=n.depth-1;o>=0;o--){let c=n.index(o);if(n.node(o).canReplaceWith(c,c,i))return n.before(o+1);if(c>0)return null}if(n.parentOffset==n.parent.content.size)for(let o=n.depth-1;o>=0;o--){let c=n.indexAfter(o);if(n.node(o).canReplaceWith(c,c,i))return n.after(o+1);if(c<n.node(o).childCount)return null}return null}function lse(t,e,i){let n=t.resolve(e);if(!i.content.size)return e;let o=i.content;for(let c=0;c<i.openStart;c++)o=o.firstChild.content;for(let c=1;c<=(i.openStart==0&&i.size?2:1);c++)for(let f=n.depth;f>=0;f--){let r=f==n.depth?0:n.pos<=(n.start(f+1)+n.end(f+1))/2?-1:1,x=n.index(f)+(r>0?1:0),S=n.node(f),C=!1;if(c==1)C=S.canReplace(x,x,o);else{let I=S.contentMatchAt(x).findWrapping(o.firstChild.type);C=I&&S.canReplaceWith(x,x,I[0])}if(C)return r==0?n.pos:r<0?n.before(f+1):n.after(f+1)}return null}function kM(t,e,i=e,n=pn.empty){if(e==i&&!n.size)return null;let o=t.resolve(e),c=t.resolve(i);return cse(o,c,n)?new Ba(e,i,n):new oPe(o,c,n).fit()}function cse(t,e,i){return!i.openStart&&!i.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),i.content)}class oPe{constructor(e,i,n){this.$from=e,this.$to=i,this.unplaced=n,this.frontier=[],this.placed=Si.empty;for(let o=0;o<=e.depth;o++){let c=e.node(o);this.frontier.push({type:c.type,match:c.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=Si.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let S=this.findFittable();S?this.placeNodes(S):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),i=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let c=this.placed,f=n.depth,r=o.depth;for(;f&&r&&c.childCount==1;)c=c.firstChild.content,f--,r--;let x=new pn(c,f,r);return e>-1?new qa(n.pos,e,this.$to.pos,this.$to.end(),x,i):x.size||n.pos!=this.$to.pos?new Ba(n.pos,o.pos,x):null}findFittable(){let e=this.unplaced.openStart;for(let i=this.unplaced.content,n=0,o=this.unplaced.openEnd;n<e;n++){let c=i.firstChild;if(i.childCount>1&&(o=0),c.type.spec.isolating&&o<=n){e=n;break}i=c.content}for(let i=1;i<=2;i++)for(let n=i==1?e:this.unplaced.openStart;n>=0;n--){let o,c=null;n?(c=iz(this.unplaced.content,n-1).firstChild,o=c.content):o=this.unplaced.content;let f=o.firstChild;for(let r=this.depth;r>=0;r--){let{type:x,match:S}=this.frontier[r],C,I=null;if(i==1&&(f?S.matchType(f.type)||(I=S.fillBefore(Si.from(f),!1)):c&&x.compatibleContent(c.type)))return{sliceDepth:n,frontierDepth:r,parent:c,inject:I};if(i==2&&f&&(C=S.findWrapping(f.type)))return{sliceDepth:n,frontierDepth:r,parent:c,wrap:C};if(c&&S.matchType(c.type))break}}}openMore(){let{content:e,openStart:i,openEnd:n}=this.unplaced,o=iz(e,i);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new pn(e,i+1,Math.max(n,o.size+i>=e.size-n?i+1:0)),!0)}dropNode(){let{content:e,openStart:i,openEnd:n}=this.unplaced,o=iz(e,i);if(o.childCount<=1&&i>0){let c=e.size-i<=i+o.size;this.unplaced=new pn(WS(e,i-1,1),i-1,c?i-1:n)}else this.unplaced=new pn(WS(e,i,1),i,n)}placeNodes({sliceDepth:e,frontierDepth:i,parent:n,inject:o,wrap:c}){for(;this.depth>i;)this.closeFrontierNode();if(c)for(let B=0;B<c.length;B++)this.openFrontierNode(c[B]);let f=this.unplaced,r=n?n.content:f.content,x=f.openStart-e,S=0,C=[],{match:I,type:N}=this.frontier[i];if(o){for(let B=0;B<o.childCount;B++)C.push(o.child(B));I=I.matchFragment(o)}let D=r.size+e-(f.content.size-f.openEnd);for(;S<r.childCount;){let B=r.child(S),W=I.matchType(B.type);if(!W)break;S++,(S>1||x==0||B.content.size)&&(I=W,C.push(use(B.mark(N.allowedMarks(B.marks)),S==1?x:0,S==r.childCount?D:-1)))}let V=S==r.childCount;V||(D=-1),this.placed=KS(this.placed,i,Si.from(C)),this.frontier[i].match=I,V&&D<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let B=0,W=r;B<D;B++){let $=W.lastChild;this.frontier.push({type:$.type,match:$.contentMatchAt($.childCount)}),W=$.content}this.unplaced=V?e==0?pn.empty:new pn(WS(f.content,e-1,1),e-1,D<0?f.openEnd:e-1):new pn(WS(f.content,e,S),f.openStart,f.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],i;if(!e.type.isTextblock||!nz(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(i=this.findCloseLevel(this.$to))&&i.depth==this.depth)return-1;let{depth:n}=this.$to,o=this.$to.after(n);for(;n>1&&o==this.$to.end(--n);)++o;return o}findCloseLevel(e){e:for(let i=Math.min(this.depth,e.depth);i>=0;i--){let{match:n,type:o}=this.frontier[i],c=i<e.depth&&e.end(i+1)==e.pos+(e.depth-(i+1)),f=nz(e,i,o,n,c
vendor: 9,938 bytes, line 3727
3727);if(f){for(let r=i-1;r>=0;r--){let{match:x,type:S}=this.frontier[r],C=nz(e,r,S,x,!0);if(!C||C.childCount)continue e}return{depth:i,fit:f,move:c?e.doc.resolve(e.after(i+1)):e}}}}close(e){let i=this.findCloseLevel(e);if(!i)return null;for(;this.depth>i.depth;)this.closeFrontierNode();i.fit.childCount&&(this.placed=KS(this.placed,i.depth,i.fit)),e=i.move;for(let n=i.depth+1;n<=e.depth;n++){let o=e.node(n),c=o.type.contentMatch.fillBefore(o.content,!0,e.index(n));this.openFrontierNode(o.type,o.attrs,c)}return e}openFrontierNode(e,i=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=KS(this.placed,this.depth,Si.from(e.create(i,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let i=this.frontier.pop().match.fillBefore(Si.empty,!0);i.childCount&&(this.placed=KS(this.placed,this.frontier.length,i))}}function WS(t,e,i){return e==0?t.cutByIndex(i,t.childCount):t.replaceChild(0,t.firstChild.copy(WS(t.firstChild.content,e-1,i)))}function KS(t,e,i){return e==0?t.append(i):t.replaceChild(t.childCount-1,t.lastChild.copy(KS(t.lastChild.content,e-1,i)))}function iz(t,e){for(let i=0;i<e;i++)t=t.firstChild.content;return t}function use(t,e,i){if(e<=0)return t;let n=t.content;return e>1&&(n=n.replaceChild(0,use(n.firstChild,e-1,n.childCount==1?i-1:0))),e>0&&(n=t.type.contentMatch.fillBefore(n).append(n),i<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(Si.empty,!0)))),t.copy(n)}function nz(t,e,i,n,o){let c=t.node(e),f=o?t.indexAfter(e):t.index(e);if(f==c.childCount&&!i.compatibleContent(c.type))return null;let r=n.fillBefore(c.content,!0,f);return r&&!aPe(i,c.content,f)?r:null}function aPe(t,e,i){for(let n=i;n<e.childCount;n++)if(!t.allowsMarks(e.child(n).marks))return!0;return!1}function lPe(t){return t.spec.defining||t.spec.definingForContent}function cPe(t,e,i,n){if(!n.size)return t.deleteRange(e,i);let o=t.doc.resolve(e),c=t.doc.resolve(i);if(cse(o,c,n))return t.step(new Ba(e,i,n));let f=hse(o,c);f[f.length-1]==0&&f.pop();let r=-(o.depth+1);f.unshift(r);for(let N=o.depth,D=o.pos-1;N>0;N--,D--){let V=o.node(N).type.spec;if(V.defining||V.definingAsContext||V.isolating)break;f.indexOf(N)>-1?r=N:o.before(N)==D&&f.splice(1,0,-N)}let x=f.indexOf(r),S=[],C=n.openStart;for(let N=n.content,D=0;;D++){let V=N.firstChild;if(S.push(V),D==n.openStart)break;N=V.content}for(let N=C-1;N>=0;N--){let D=S[N],V=lPe(D.type);if(V&&!D.sameMarkup(o.node(Math.abs(r)-1)))C=N;else if(V||!D.type.isTextblock)break}for(let N=n.openStart;N>=0;N--){let D=(N+C+1)%(n.openStart+1),V=S[D];if(V)for(let B=0;B<f.length;B++){let W=f[(B+x)%f.length],$=!0;W<0&&($=!1,W=-W);let G=o.node(W-1),te=o.index(W-1);if(G.canReplaceWith(te,te,V.type,V.marks))return t.replace(o.before(W),$?c.after(W):i,new pn(dse(n.content,0,n.openStart,D),D,n.openEnd))}}let I=t.steps.length;for(let N=f.length-1;N>=0&&(t.replace(e,i,n),!(t.steps.length>I));N--){let D=f[N];D<0||(e=o.before(D),i=c.after(D))}}function dse(t,e,i,n,o){if(e<i){let c=t.firstChild;t=t.replaceChild(0,c.copy(dse(c.content,e+1,i,n,c)))}if(e>n){let c=o.contentMatchAt(0),f=c.fillBefore(t).append(t);t=f.append(c.matchFragment(f).fillBefore(Si.empty,!0))}return t}function uPe(t,e,i,n){if(!n.isInline&&e==i&&t.doc.resolve(e).parent.content.size){let o=sPe(t.doc,e,n.type);o!=null&&(e=i=o)}t.replaceRange(e,i,new pn(Si.from(n),0,0))}function dPe(t,e,i){let n=t.doc.resolve(e),o=t.doc.resolve(i),c=hse(n,o);for(let f=0;f<c.length;f++){let r=c[f],x=f==c.length-1;if(x&&r==0||n.node(r).type.contentMatch.validEnd)return t.delete(n.start(r),o.end(r));if(r>0&&(x||n.node(r-1).canReplace(n.index(r-1),o.indexAfter(r-1))))return t.delete(n.before(r),o.after(r))}for(let f=1;f<=n.depth&&f<=o.depth;f++)if(e-n.start(f)==n.depth-f&&i>n.end(f)&&o.end(f)-i!=o.depth-f&&n.start(f-1)==o.start(f-1)&&n.node(f-1).canReplace(n.index(f-1),o.index(f-1)))return t.delete(n.before(f),i);t.delete(e,i)}function hse(t,e){let i=[],n=Math.min(t.depth,e.depth);for(let o=n;o>=0;o--){let c=t.start(o);if(c<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(c==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==c-1)&&i.push(o)}return i}class N0 extends Pl{constructor(e,i,n){super(),this.pos=e,this.attr=i,this.value=n}apply(e){let i=e.nodeAt(this.pos);if(!i)return fa.fail("No node at attribute step's position");let n=Object.create(null);for(let c in i.attrs)n[c]=i.attrs[c];n[this.attr]=this.value;let o=i.type.create(n,null,i.marks);return fa.fromReplace(e,this.pos,this.pos+1,new pn(Si.from(o),0,i.isLeaf?0:1))}getMap(){return eu.empty}invert(e){return new N0(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let i=e.mapResult(this.pos,1);return i.deletedAfter?null:new N0(i.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,i){if(typeof i.pos!="number"||typeof i.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new N0(i.pos,i.attr,i.value)}}Pl.jsonID("attr",N0);class bC extends Pl{constructor(e,i){super(),this.attr=e,this.value=i}apply(e){let i=Object.create(null);for(let o in e.attrs)i[o]=e.attrs[o];i[this.attr]=this.value;let n=e.type.create(i,e.content,e.marks);return fa.ok(n)}getMap(){return eu.empty}invert(e){return new bC(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,i){if(typeof i.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new bC(i.attr,i.value)}}Pl.jsonID("docAttr",bC);let Db=class extends Error{};Db=function t(e){let i=Error.call(this,e);return i.__proto__=t.prototype,i};Db.prototype=Object.create(Error.prototype);Db.prototype.constructor=Db;Db.prototype.name="TransformError";class pse{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new xC}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let i=this.maybeStep(e);if(i.failed)throw new Db(i.failed);return this}maybeStep(e){let i=e.apply(this.doc);return i.failed||this.addStep(e,i.doc),i}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,i=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let o=this.mapping.maps[n];n&&(e=o.map(e,1),i=o.map(i,-1)),o.forEach((c,f,r,x)=>{e=Math.min(e,r),i=Math.max(i,x)})}return e==1e9?null:{from:e,to:i}}addStep(e,i){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=i}replace(e,i=e,n=pn.empty){let o=kM(this.doc,e,i,n);return o&&this.step(o),this}replaceWith(e,i,n){return this.replace(e,i,new pn(Si.from(n),0,0))}delete(e,i){return this.replace(e,i,pn.empty)}insert(e,i){return this.replaceWith(e,e,i)}replaceRange(e,i,n){return cPe(this,e,i,n),this}replaceRangeWith(e,i,n){return uPe(this,e,i,n),this}deleteRange(e,i){return dPe(this,e,i),this}lift(e,i){return Zke(this,e,i),this}join(e,i=1){return rPe(this,e,i),this}wrap(e,i){return Qke(this,e,i),this}setBlockType(e,i=e,n,o=null){return Jke(this,e,i,n,o),this}setNodeMarkup(e,i,n=null,o){return tPe(this,e,i,n,o),this}setNodeAttribute(e,i,n){return this.step(new N0(e,i,n)),this}setDocAttribute(e,i){return this.step(new bC(e,i)),this}addNodeMark(e,i){return this.step(new Hm(e,i)),this}removeNodeMark(e,i){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(i instanceof Ws)i.isInSet(n.marks)&&this.step(new Q_(e,i));else{let o=n.marks,c,f=[];for(;c=i.isInSet(o);)f.push(new Q_(e,c)),o=c.removeFromSet(o);for(let r=f.length-1;r>=0;r--)this.step(f[r])}return this}split(e,i=1,n){return iPe(this,e,i,n),this}addMark(e,i,n){return Gke(this,e,i,n),this}removeMark(e,i,n){return Wke(this,e,i,n),this}clearIncompatible(e,i,n){return W4(this,e,i,n),this}}const rz=Object.create(null);class zr{constructor(e,i,n){this.$anchor=e,this.$head=i,this.ranges=n||[new hPe(e.min(i),e.max(i))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let i=0;i<e.length;i++)if(e[i].$from.pos!=e[i].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,i=pn.empty){let n=i.content.lastChild,o=null;for(let r=0;r<i.openEnd;r++)o=n,n=n.lastChild;let c=e.steps.length,f=this.ranges;for(let r=0;r<f.length;r++){let{$from:x,$to:S}=f[r],C=e.mapping.slice(c);e.replaceRange(C.map(x.pos),C.map(S.pos),r?pn.empty:i),r==0&&yH(e,c,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,i){let n=e.steps.length,o=this.ranges;for(let c=0;c<o.length;c++){let{$from:f,$to:r}=o[c],x=e.mapping.slice(n),S=x.map(f.pos),C=x.map(r.pos);c?e.deleteRange(S,C):(e.replaceRangeWith(S,C,i),yH(e,n,i.isInline?-1:1))}}static findFrom(e,i,n=!1){let o=e.parent.inlineContent?new br(e):Jx(e.node(0),e.parent,e.pos,e.index(),i,n);if(o)return o;for(let c=e.depth-1;c>=0;c--){let f=i<0?Jx(e.node(0),e.node(c),e.before(c+1),e.index(c),i,n):Jx(e.node(0),e.node(c),e.after(c+1),e.index(c)+1,i,n);if(f)return f}return null}static near(e,i=1){return this.findFrom(e,i)||this.findFrom(e,-i)||new Lu(e.node(0))}static atStart(e){return Jx(e,e,0,0,1)||new Lu(e)}static atEnd(e){return Jx(e,e,e.content.size,e.childCount,-1)||new Lu(e)}static fromJSON(e,i){if(!i||!i.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=rz[i.type];if(!n)throw new RangeError(`No selection type ${i.type} defined`);return n.fromJSON(e,i)}static jsonID(e,i){if(e in rz)throw new RangeError("Duplicate use of selection JSON ID "+e);return rz[e]=i,i.prototype.jsonID=e,i}getBookmark(){return br.between(this.$anchor,this.$head).getBookmark()}}zr.prototype.visible=!0;class hPe{constructor(e,i){this.$from=e,this.$to=i}}let mH=!1;function gH(t){!mH&&!t.parent.inlineContent&&(mH=!0,console.warn("TextSelection endpoint not pointing into a
3727node with inline content ("+t.parent.type.name+")"))}class br extends zr{constructor(e,i=e){gH(e),gH(i),super(e,i)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,i){let n=e.resolve(i.map(this.head));if(!n.parent.inlineContent)return zr.near(n);let o=e.resolve(i.map(this.anchor));return new br(o.parent.inlineContent?o:n,n)}replace(e,i=pn.empty){if(super.replace(e,i),i==pn.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof br&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new PM(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,i){if(typeof i.anchor!="number"||typeof i.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new br(e.resolve(i.anchor),e.resolve(i.head))}static create(e,i,n=i){let o=e.resolve(i);return new this(o,n==i?o:e.resolve(n))}static between(e,i,n){let o=e.pos-i.pos;if((!n||o)&&(n=o>=0?1:-1),!i.parent.inlineContent){let c=zr.findFrom(i,n,!0)||zr.findFrom(i,-n,!0);if(c)i=c.$head;else return zr.near(i,n)}return e.parent.inlineContent||(o==0?e=i:(e=(zr.findFrom(e,-n,!0)||zr.findFrom(e,n,!0)).$anchor,e.pos<i.pos!=o<0&&(e=i))),new br(e,i)}}zr.jsonID("text",br);class PM{constructor(e,i){this.anchor=e,this.head=i}map(e){return new PM(e.map(this.anchor),e.map(this.head))}resolve(e){return br.between(e.resolve(this.anchor),e.resolve(this.head))}}class qn extends zr{constructor(e){let i=e.nodeAfter,n=e.node(0).resolve(e.pos+i.nodeSize);super(e,n),this.node=i}map(e,i){let{deleted:n,pos:o}=i.mapResult(this.anchor),c=e.resolve(o);return n?zr.near(c):new qn(c)}content(){return new pn(Si.from(this.node),0,0)}eq(e){return e instanceof qn&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Z4(this.anchor)}static fromJSON(e,i){if(typeof i.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new qn(e.resolve(i.anchor))}static create(e,i){return new qn(e.resolve(i))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}qn.prototype.visible=!1;zr.jsonID("node",qn);class Z4{constructor(e){this.anchor=e}map(e){let{deleted:i,pos:n}=e.mapResult(this.anchor);return i?new PM(n,n):new Z4(n)}resolve(e){let i=e.resolve(this.anchor),n=i.nodeAfter;return n&&qn.isSelectable(n)?new qn(i):zr.near(i)}}class Lu extends zr{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,i=pn.empty){if(i==pn.empty){e.delete(0,e.doc.content.size);let n=zr.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,i)}toJSON(){return{type:"all"}}static fromJSON(e){return new Lu(e)}map(e){return new Lu(e)}eq(e){return e instanceof Lu}getBookmark(){return pPe}}zr.jsonID("all",Lu);const pPe={map(){return this},resolve(t){return new Lu(t)}};function Jx(t,e,i,n,o,c=!1){if(e.inlineContent)return br.create(t,i);for(let f=n-(o>0?0:1);o>0?f<e.childCount:f>=0;f+=o){let r=e.child(f);if(r.isAtom){if(!c&&qn.isSelectable(r))return qn.create(t,i-(o<0?r.nodeSize:0))}else{let x=Jx(t,r,i+o,o<0?r.childCount:0,o,c);if(x)return x}i+=r.nodeSize*o}return null}function yH(t,e,i){let n=t.steps.length-1;if(n<e)return;let o=t.steps[n];if(!(o instanceof Ba||o instanceof qa))return;let c=t.mapping.maps[n],f;c.forEach((r,x,S,C)=>{f==null&&(f=C)}),t.setSelection(zr.near(t.doc.resolve(f),i))}const _H=1,lI=2,vH=4;class fPe extends pse{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|_H)&~lI,this.storedMarks=null,this}get selectionSet(){return(this.updated&_H)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=lI,this}ensureMarks(e){return Ws.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&lI)>0}addStep(e,i){super.addStep(e,i),this.updated=this.updated&~lI,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,i=!0){let n=this.selection;return i&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ws.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,i,n){let o=this.doc.type.schema;if(i==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(n==null&&(n=i),!e)return this.deleteRange(i,n);let c=this.storedMarks;if(!c){let f=this.doc.resolve(i);c=n==i?f.marks():f.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(i,n,o.text(e,c)),!this.selection.empty&&this.selection.to==i+e.length&&this.setSelection(zr.near(this.selection.$to)),this}}setMeta(e,i){return this.meta[typeof e=="string"?e:e.key]=i,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=vH,this}get scrolledIntoView(){return(this.updated&vH)>0}}function xH(t,e){return!e||!t?t:t.bind(e)}class ZS{constructor(e,i,n){this.name=e,this.init=xH(i.init,n),this.apply=xH(i.apply,n)}}const mPe=[new ZS("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ZS("selection",{init(t,e){return t.selection||zr.atStart(e.doc)},apply(t){return t.selection}}),new ZS("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,i,n){return n.selection.$cursor?t.storedMarks:null}}),new ZS("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class sz{constructor(e,i){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=mPe.slice(),i&&i.forEac
vendor: 14,218 bytes, lines 3727-3728
3727h(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new ZS(n.key,n.spec.state,n))})}}class m0{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,i=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=i){let o=this.config.plugins[n];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let i=[e],n=this.applyInner(e),o=null;for(;;){let c=!1;for(let f=0;f<this.config.plugins.length;f++){let r=this.config.plugins[f];if(r.spec.appendTransaction){let x=o?o[f].n:0,S=o?o[f].state:this,C=x<i.length&&r.spec.appendTransaction.call(r,x?i.slice(x):i,S,n);if(C&&n.filterTransaction(C,f)){if(C.setMeta("appendedTransaction",e),!o){o=[];for(let I=0;I<this.config.plugins.length;I++)o.push(I<f?{state:n,n:i.length}:{state:this,n:0})}i.push(C),n=n.applyInner(C),c=!0}o&&(o[f]={state:n,n:i.length})}}if(!c)return{state:n,transactions:i}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let i=new m0(this.config),n=this.config.fields;for(let o=0;o<n.length;o++){let c=n[o];i[c.name]=c.apply(e,this[c.name],this,i)}return i}get tr(){return new fPe(this)}static create(e){let i=new sz(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new m0(i);for(let o=0;o<i.fields.length;o++)n[i.fields[o].name]=i.fields[o].init(e,n);return n}reconfigure(e){let i=new sz(this.schema,e.plugins),n=i.fields,o=new m0(i);for(let c=0;c<n.length;c++){let f=n[c].name;o[f]=this.hasOwnProperty(f)?this[f]:n[c].init(e,o)}return o}toJSON(e){let i={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(i.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[n],c=o.spec.state;c&&c.toJSON&&(i[n]=c.toJSON.call(o,this[o.key]))}return i}static fromJSON(e,i,n){if(!i)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new sz(e.schema,e.plugins),c=new m0(o);return o.fields.forEach(f=>{if(f.name=="doc")c.doc=sg.fromJSON(e.schema,i.doc);else if(f.name=="selection")c.selection=zr.fromJSON(c.doc,i.selection);else if(f.name=="storedMarks")i.storedMarks&&(c.storedMarks=i.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let x=n[r],S=x.spec.state;if(x.key==f.name&&S&&S.fromJSON&&Object.prototype.hasOwnProperty.call(i,r)){c[f.name]=S.fromJSON.call(x,e,i[r],c);return}}c[f.name]=f.init(e,c)}}),c}}function fse(t,e,i){for(let n in t){let o=t[n];o instanceof Function?o=o.bind(e):n=="handleDOMEvents"&&(o=fse(o,e,{})),i[n]=o}return i}class Po{constructor(e){this.spec=e,this.props={},e.props&&fse(e.props,this,this.props),this.key=e.key?e.key.key:mse("plugin")}getState(e){return e[this.key]}}const oz=Object.create(null);function mse(t){return t in oz?t+"$"+ ++oz[t]:(oz[t]=0,t+"$")}class Aa{constructor(e="key"){this.key=mse(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const gPe=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function gse(t,e){let{$cursor:i}=t.selection;return!i||(e?!e.endOfTextblock("backward",t):i.parentOffset>0)?null:i}const yPe=(t,e,i)=>{let n=gse(t,i);if(!n)return!1;let o=X4(n);if(!o){let f=n.blockRange(),r=f&&l1(f);return r==null?!1:(e&&e(t.tr.lift(f,r).scrollIntoView()),!0)}let c=o.nodeBefore;if(xse(t,o,e,-1))return!0;if(n.parent.content.size==0&&(Rb(c,"end")||qn.isSelectable(c)))for(let f=n.depth;;f--){let r=kM(t.doc,n.before(f),n.after(f),pn.empty);if(r&&r.slice.size<r.to-r.from){if(e){let x=t.tr.step(r);x.setSelection(Rb(c,"end")?zr.findFrom(x.doc.resolve(x.mapping.map(o.pos,-1)),-1):qn.create(x.doc,o.pos-c.nodeSize)),e(x.scrollIntoView())}return!0}if(f==1||n.node(f-1).childCount>1)break}return c.isAtom&&o.depth==n.depth-1?(e&&e(t.tr.delete(o.pos-c.nodeSize,o.pos).scrollIntoView()),!0):!1},_Pe=(t,e,i)=>{let n=gse(t,i);if(!n)return!1;let o=X4(n);return o?yse(t,o,e):!1},vPe=(t,e,i)=>{let n=_se(t,i);if(!n)return!1;let o=Y4(n);return o?yse(t,o,e):!1};function yse(t,e,i){let n=e.nodeBefore,o=n,c=e.pos-1;for(;!o.isTextblock;c--){if(o.type.spec.isolating)return!1;let C=o.lastChild;if(!C)return!1;o=C}let f=e.nodeAfter,r=f,x=e.pos+1;for(;!r.isTextblock;x++){if(r.type.spec.isolating)return!1;let C=r.firstChild;if(!C)return!1;r=C}let S=kM(t.doc,c,x,pn.empty);if(!S||S.from!=c||S instanceof Ba&&S.slice.size>=x-c)return!1;if(i){let C=t.tr.step(S);C.setSelection(br.create(C.doc,c)),i(C.scrollIntoView())}return!0}function Rb(t,e,i=!1){for(let n=t;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(i&&n.childCount!=1)return!1}return!1}const xPe=(t,e,i)=>{let{$head:n,empty:o}=t.selection,c=n;if(!o)return!1;if(n.parent.isTextblock){if(i?!i.endOfTextblock("backward",t):n.parentOffset>0)return!1;c=X4(n)}let f=c&&c.nodeBefore;return!f||!qn.isSelectable(f)?!1:(e&&e(t.tr.setSelection(qn.create(t.doc,c.pos-f.nodeSize)).scrollIntoView()),!0)};function X4(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function _se(t,e){let{$cursor:i}=t.selection;return!i||(e?!e.endOfTextblock("forward",t):i.parentOffset<i.parent.content.size)?null:i}const bPe=(t,e,i)=>{let n=_se(t,i);if(!n)return!1;let o=Y4(n);if(!o)return!1;let c=o.nodeAfter;if(xse(t,o,e,1))return!0;if(n.parent.content.size==0&&(Rb(c,"start")||qn.isSelectable(c))){let f=kM(t.doc,n.before(),n.after(),pn.empty);if(f&&f.slice.size<f.to-f.from){if(e){let r=t.tr.step(f);r.setSelection(Rb(c,"start")?zr.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):qn.create(r.doc,r.mapping.map(o.pos))),e(r.scrollIntoView())}return!0}}return c.isAtom&&o.depth==n.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+c.nodeSize).scrollIntoView()),!0):!1},wPe=(t,e,i)=>{let{$head:n,empty:o}=t.selection,c=n;if(!o)return!1;if(n.parent.isTextblock){if(i?!i.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)return!1;c=Y4(n)}let f=c&&c.nodeAfter;return!f||!qn.isSelectable(f)?!1:(e&&e(t.tr.setSelection(qn.create(t.doc,c.pos)).scrollIntoView()),!0)};function Y4(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let i=t.node(e);if(t.index(e)+1<i.childCount)return t.doc.resolve(t.after(e+1));if(i.type.spec.isolating)break}return null}const SPe=(t,e)=>{let i=t.selection,n=i instanceof qn,o;if(n){if(i.node.isTextblock||!Og(t.doc,i.from))return!1;o=i.from}else if(o=IM(t.doc,i.from,-1),o==null)return!1;if(e){let c=t.tr.join(o);n&&c.setSelection(qn.create(c.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(c.scrollIntoView())}return!0},TPe=(t,e)=>{let i=t.selection,n;if(i instanceof qn){if(i.node.isTextblock||!Og(t.doc,i.to))return!1;n=i.to}else if(n=IM(t.doc,i.to,1),n==null)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0},CPe=(t,e)=>{let{$from:i,$to:n}=t.selection,o=i.blockRange(n),c=o&&l1(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)},EPe=(t,e)=>{let{$head:i,$anchor:n}=t.selection;return!i.parent.type.spec.code||!i.sameParent(n)?!1:(e&&e(t.tr.insertText(` 3728`).scrollIntoView()),!0)};function vse(t){for(let e=0;e<t.edgeCount;e++){let{type:i}=t.edge(e);if(i.isTextblock&&!i.hasRequiredAttrs())return i}return null}const APe=(t,e)=>{let{$head:i,$anchor:n}=t.selection;if(!i.parent.type.spec.code||!i.sameParent(n))return!1;let o=i.node(-1),c=i.indexAfter(-1),f=vse(o.contentMatchAt(c));if(!f||!o.canReplaceWith(c,c,f))return!1;if(e){let r=i.after(),x=t.tr.replaceWith(r,r,f.createAndFill());x.setSelection(zr.near(x.doc.resolve(r),1)),e(x.scrollIntoView())}return!0},IPe=(t,e)=>{let i=t.selection,{$from:n,$to:o}=i;if(i instanceof Lu||n.parent.inlineContent||o.parent.inlineContent)return!1;let c=vse(o.parent.contentMatchAt(o.indexAfter()));if(!c||!c.isTextblock)return!1;if(e){let f=(!n.parentOffset&&o.index()<o.parent.childCount?n:o).pos,r=t.tr.insert(f,c.createAndFill());r.setSelection(br.create(r.doc,f+1)),e(r.scrollIntoView())}return!0},kPe=(t,e)=>{let{$cursor:i}=t.selection;if(!i||i.parent.content.size)return!1;if(i.depth>1&&i.after()!=i.end(-1)){let c=i.before();if(P0(t.doc,c))return e&&e(t.tr.split(c).scrollIntoView()),!0}let n=i.blockRange(),o=n&&l1(n);return o==null?!1:(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)},PPe=(t,e)=>{let{$from:i,to:n}=t.selection,o,c=i.sharedDepth(n);return c==0?!1:(o=i.before(c),e&&e(t.tr.setSelection(qn.create(t.doc,o))),!0)};function NPe(t,e,i){let n=e.nodeBefore,o=e.nodeAfter,c=e.index();return!n||!o||!n.type.compatibleContent(o.type)?!1:!n.content.size&&e.parent.canReplace(c-1,c)?(i&&i(t.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(c,c+1)||!(o.isTextblock||Og(t.doc,e.pos))?!1:(i&&i(t.tr.join(e.pos).scrollIntoView()),!0)}function xse(t,e,i,n){let o=e.nodeBefore,c=e.nodeAfter,f,r,x=o.type.spec.isolating||c.type.spec.isolating;if(!x&&NPe(t,e,i))return!0;let S=!x&&e.parent.canReplace(e.index(),e.index()+1);if(S&&(f=(r=o.contentMatchAt(o.childCount)).findWrapping(c.type))&&r.matchType(f[0]||c.type).validEnd){if(i){let D=e.pos+c.nodeSize,V=Si.empty;for(let $=f.length-1;$>=0;$--)V=Si.from(f[$].create(null,V));V=Si.from(o.copy(V));let B=t.tr.step(new qa(e.pos-1,D,e.pos,D,new pn(V,1,0),f.length,!0)),W=B.doc.resolve(D+2*f.length);W.nodeAfter&&W.nodeAfter.type==o.type&&Og(B.doc,W.pos)&&B.join(W.pos),i(B.scrollIntoView())}return!0}let C=c.type.spec.isolating||n>0&&x?null:zr.findFrom(e,1),I=C&&C.$from.blockRange(C.$to),N=I&&l1(I);if(N!=null&&N>=e.depth)return i&&i(t.tr.lift(I,N).scrollIntoView()),!0;if(S&&Rb(c,"start",!0)&&Rb(o,"end")){let D=o,V=[];for(;V.push(D),!D.isTextblock;)D=D.lastChild;let B=c,W=1;for(;!B.isTextblock;B=B.firstChild)W++;if(D.canReplace(D.childCount,D.childCount,B.content)){if(i){let $=Si.empty;for(let te=V.length-1;te>=0;te--)$=Si.from(V[te].copy($));let G=t.tr.step(new qa(e.pos-V.length,e.pos+c.nodeSize,e.pos+W,e.pos+c.nodeSize-W,new pn($,V.length,0),0,!0));i(G.scrollIntoView())}return!0}}return!1}function bse(t){return function(e,i){let n=e.selection,o=t<0?n.$from:n.$to,c=o.depth;for(;o.node(c).isInline;){if(!c)return!1;c--}return o.node(c).isTextblock?(i&&i(e.tr.setSelection(br.create(e.doc,t<0?o.start(c):o.end(c)))),!0):!1}}const MPe=bse(-1),DPe=bse(1);function RPe(t,e=null){return function(i,n){let{$from:o,$to:c}=i.selection,f=o.blockRange(c),r=f&&K4(f,t,e);return r?(n&&n(i.tr.wrap(f,r).scrollIntoView()),!0):!1}}function bH(t,e=null){return function(i,n){let o=!1;for(let c=0;c<i.selection.ranges.length&&!o;c++){let{$from:{pos:f},$to:{pos:r}}=i.selection.ranges[c];i.doc.nodesBetween(f,r,(x,S)=>{if(o)return!1;if(!(!x.isTextblock||x.hasMarkup(t,e)))if(x.type==t)o=!0;else{let C=i.doc.resolve(S),I=C.index();o=C.parent.canReplaceWith(I,I+1,t)}})}if(!o)return!1;if(n){let c=i.tr;for(let f=0;f<i.selection.ranges.length;f++){let{$from:{pos:r},$to:{pos:x}}=i.selection.ranges[f];c.setBlockType(r,x,t,e)}n(c.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function jPe(t,e=null){return function(i,n){let{$from:o,$to:c}=i.selection,f=o.blockRange(c);if(!f)return!1;let r=n?i.tr:null;return zPe(r,f,t,e)?(n&&n(r.scrollIntoView()),!0):!1}}function zPe(t,e,i,n=null){let o=!1,c=e,f=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(i)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let x=f.resolve(e.start-2);c=new gP(x,x,e.depth),e.endIndex<e.parent.childCount&&(e=new gP(e.$from,f.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let r=K4(c,i,n,e);return r?(t&&LPe(t,e,r,o,i),!0):!1}function LPe(t,e,i,n,o){let c=Si.empty;for(let C=i.length-1;C>=0;C--)c=Si.from(i[C].type.create(i[C].attrs,c));t.step(new qa(e.start-(n?2:0),e.end,e.start,e.end,new pn(c,0,0),i.length,!0));let f=0;for(let C=0;C<i.length;C++)i[C].type==o&&(f=C+1);let r=i.length-f,x=e.start+i.length-(n?2:0),S=e.parent;for(let C=e.startIndex,I=e.endIndex,N=!0;C<I;C++,N=!1)!N&&P0(t.doc,x,r)&&(t.split(x,r),x+=2*r),x+=S.child(C).nodeSize;return t}function OPe(t){return function(e,i){let{$from:n,$to:o}=e.selection,c=n.blockRange(o,f=>f.childCount>0&&f.firstChild.type==t);return c?i?n.node(c.depth-1).type==t?FPe(e,i,t,c):BPe(e,i,c):!0:!1}}function FPe(t,e,i,n){let o=t.tr,c=n.end,f=n.$to.end(n.depth);c<f&&(o.step(new qa(c-1,f,c,f,new pn(Si.from(i.create(null,n.parent.copy())),1,0),1,!0)),n=new gP(o.doc.resolve(n.$from.pos),o.doc.resolve(f),n.depth));const r=l1(n);if(r==null)return!1;o.lift(n,r);let x=o.doc.resolve(o.mapping.map(c,-1)-1);return Og(o.doc,x.pos)&&x.nodeBefore.type==x.nodeAfter.type&&o.join(x.pos),e(o.scrollIntoView()),!0}function BPe(t,e,i){let n=t.tr,o=i.parent;for(let D=i.end,V=i.endIndex-1,B=i.startIndex;V>B;V--)D-=o.child(V).nodeSize,n.delete(D-1,D+1);let c=n.doc.resolve(i.start),f=c.nodeAfter;if(n.mapping.map(i.end)!=i.start+c.nodeAfter.nodeSize)return!1;let r=i.startIndex==0,x=i.endIndex==o.childCount,S=c.node(-1),C=c.index(-1);if(!S.canReplace(C+(r?0:1),C+1,f.content.append(x?Si.empty:Si.from(o))))return!1;let I=c.pos,N=I+f.nodeSize;return n.step(new qa(I-(r?1:0),N+(x?1:0),I+1,N-1,new pn((r?Si.empty:Si.from(o.copy(Si.empty))).append(x?Si.empty:Si.from(o.copy(Si.empty))),r?0:1,x?0:1),r?0:1)),e(n.scrollIntoView()),!0}function UPe(t){return function(e,i){let{$from:n,$to:o}=e.selection,c=n.blockRange(o,S=>S.childCount>0&&S.firstChild.type==t);if(!c)return!1;let f=c.startIndex;if(f==0)return!1;let r=c.parent,x=r.child(f-1);if(x.type!=t)return!1;if(i){let S=x.lastChild&&x.lastChild.type==r.type,C=Si.from(S?t.create():null),I=new pn(Si.from(t.create(null,Si.from(r.type.create(null,C)))),S?3:1,0),N=c.start,D=c.end;i(e.tr.step(new qa(N-(S?3:1),D,N,D,I,1,!0)).scrollIntoView())}return!0}}const rl=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},jb=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let OO=null;
vendor: 4,253 bytes, line 3728
3728const jp=function(t,e,i){let n=OO||(OO=document.createRange());return n.setEnd(t,i??t.nodeValue.length),n.setStart(t,e||0),n},VPe=function(){OO=null},J_=function(t,e,i,n){return i&&(wH(t,e,i,n,-1)||wH(t,e,i,n,1))},$Pe=/^(img|br|input|textarea|hr)$/i;function wH(t,e,i,n,o){for(var c;;){if(t==i&&e==n)return!0;if(e==(o<0?0:Nu(t))){let f=t.parentNode;if(!f||f.nodeType!=1||AE(t)||$Pe.test(t.nodeName)||t.contentEditable=="false")return!1;e=rl(t)+(o<0?0:1),t=f}else if(t.nodeType==1){let f=t.childNodes[e+(o<0?-1:0)];if(f.nodeType==1&&f.contentEditable=="false")if(!((c=f.pmViewDesc)===null||c===void 0)&&c.ignoreForSelection)e+=o;else return!1;else t=f,e=o<0?Nu(t):0}else return!1}}function Nu(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qPe(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Nu(t)}else if(t.parentNode&&!AE(t))e=rl(t),t=t.parentNode;else return null}}function HPe(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!AE(t))e=rl(t)+1,t=t.parentNode;else return null}}function GPe(t,e,i){for(let n=e==0,o=e==Nu(t);n||o;){if(t==i)return!0;let c=rl(t);if(t=t.parentNode,!t)return!1;n=n&&c==0,o=o&&c==Nu(t)}}function AE(t){let e;for(let i=t;i&&!(e=i.pmViewDesc);i=i.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const NM=function(t){return t.focusNode&&J_(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Wy(t,e){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=t,i.key=i.code=e,i}function WPe(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function KPe(t,e,i){if(t.caretPositionFromPoint)try{let n=t.caretPositionFromPoint(e,i);if(n)return{node:n.offsetNode,offset:Math.min(Nu(n.offsetNode),n.offset)}}catch{}if(t.caretRangeFromPoint){let n=t.caretRangeFromPoint(e,i);if(n)return{node:n.startContainer,offset:Math.min(Nu(n.startContainer),n.startOffset)}}}const Kh=typeof navigator<"u"?navigator:null,SH=typeof document<"u"?document:null,Fg=Kh&&Kh.userAgent||"",FO=/Edge\/(\d+)/.exec(Fg),wse=/MSIE \d/.exec(Fg),BO=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Fg),Fc=!!(wse||BO||FO),ag=wse?document.documentMode:BO?+BO[1]:FO?+FO[1]:0,Ou=!Fc&&/gecko\/(\d+)/i.test(Fg);Ou&&+(/Firefox\/(\d+)/.exec(Fg)||[0,0])[1];const UO=!Fc&&/Chrome\/(\d+)/.exec(Fg),ol=!!UO,Sse=UO?+UO[1]:0,Il=!Fc&&!!Kh&&/Apple Computer/.test(Kh.vendor),zb=Il&&(/Mobile\/\w+/.test(Fg)||!!Kh&&Kh.maxTouchPoints>2),Iu=zb||(Kh?/Mac/.test(Kh.platform):!1),Tse=Kh?/Win/.test(Kh.platform):!1,Kp=/Android \d/.test(Fg),IE=!!SH&&"webkitFontSmoothing"in SH.documentElement.style,ZPe=IE?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function XPe(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Ep(t,e){return typeof t=="number"?t:t[e]}function YPe(t){let e=t.getBoundingClientRect(),i=e.width/t.offsetWidth||1,n=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*i,top:e.top,bottom:e.top+t.clientHeight*n}}function TH(t,e,i){let n=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,c=t.dom.ownerDocument;for(let f=i||t.dom;f;){if(f.nodeType!=1){f=jb(f);continue}let r=f,x=r==c.body,S=x?XPe(c):YPe(r),C=0,I=0;if(e.top<S.top+Ep(n,"top")?I=-(S.top-e.top+Ep(o,"top")):e.bottom>S.bottom-Ep(n,"bottom")&&(I=e.bottom-e.top>S.bottom-S.top?e.top+Ep(o,"top")-S.top:e.bottom-S.bottom+Ep(o,"bottom")),e.left<S.left+Ep(n,"left")?C=-(S.left-e.left+Ep(o,"left")):e.right>S.right-Ep(n,"right")&&(C=e.right-S.right+Ep(o,"right")),C||I)if(x)c.defaultView.scrollBy(C,I);else{let D=r.scrollLeft,V=r.scrollTop;I&&(r.scrollTop+=I),C&&(r.scrollLeft+=C);let B=r.scrollLeft-D,W=r.scrollTop-V;e={left:e.left-B,top:e.top-W,right:e.right-B,bottom:e.bottom-W}}let N=x?"fixed":getComputedStyle(f).position;if(/^(fixed|sticky)$/.test(N))break;f=N=="absolute"?f.offsetParent:jb(f)}}function QPe(t){let e=t.dom.getBoundingClientRect(),i=Math.max(0,e.to
vendor: 15,326 bytes, lines 3728-3729
3728p),n,o;for(let c=(e.left+e.right)/2,f=i+1;f<Math.min(innerHeight,e.bottom);f+=5){let r=t.root.elementFromPoint(c,f);if(!r||r==t.dom||!t.dom.contains(r))continue;let x=r.getBoundingClientRect();if(x.top>=i-20){n=r,o=x.top;break}}return{refDOM:n,refTop:o,stack:Cse(t.dom)}}function Cse(t){let e=[],i=t.ownerDocument;for(let n=t;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=i);n=jb(n));return e}function JPe({refDOM:t,refTop:e,stack:i}){let n=t?t.getBoundingClientRect().top:0;Ese(i,n==0?0:n-e)}function Ese(t,e){for(let i=0;i<t.length;i++){let{dom:n,top:o,left:c}=t[i];n.scrollTop!=o+e&&(n.scrollTop=o+e),n.scrollLeft!=c&&(n.scrollLeft=c)}}let Wx=null;function eNe(t){if(t.setActive)return t.setActive();if(Wx)return t.focus(Wx);let e=Cse(t);t.focus(Wx==null?{get preventScroll(){return Wx={preventScroll:!0},!0}}:void 0),Wx||(Wx=!1,Ese(e,0))}function Ase(t,e){let i,n=2e8,o,c=0,f=e.top,r=e.top,x,S;for(let C=t.firstChild,I=0;C;C=C.nextSibling,I++){let N;if(C.nodeType==1)N=C.getClientRects();else if(C.nodeType==3)N=jp(C).getClientRects();else continue;for(let D=0;D<N.length;D++){let V=N[D];if(V.top<=f&&V.bottom>=r){f=Math.max(V.bottom,f),r=Math.min(V.top,r);let B=V.left>e.left?V.left-e.left:V.right<e.left?e.left-V.right:0;if(B<n){i=C,n=B,o=B&&i.nodeType==3?{left:V.right<e.left?V.right:V.left,top:e.top}:e,C.nodeType==1&&B&&(c=I+(e.left>=(V.left+V.right)/2?1:0));continue}}else V.top>e.top&&!x&&V.left<=e.left&&V.right>=e.left&&(x=C,S={left:Math.max(V.left,Math.min(V.right,e.left)),top:V.top});!i&&(e.left>=V.right&&e.top>=V.top||e.left>=V.left&&e.top>=V.bottom)&&(c=I+1)}}return!i&&x&&(i=x,o=S,n=0),i&&i.nodeType==3?tNe(i,o):!i||n&&i.nodeType==1?{node:t,offset:c}:Ase(i,o)}function tNe(t,e){let i=t.nodeValue.length,n=document.createRange(),o;for(let c=0;c<i;c++){n.setEnd(t,c+1),n.setStart(t,c);let f=gm(n,1);if(f.top!=f.bottom&&Q4(e,f)){o={node:t,offset:c+(e.left>=(f.left+f.right)/2?1:0)};break}}return n.detach(),o||{node:t,offset:0}}function Q4(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function iNe(t,e){let i=t.parentNode;return i&&/^li$/i.test(i.nodeName)&&e.left<t.getBoundingClientRect().left?i:t}function nNe(t,e,i){let{node:n,offset:o}=Ase(e,i),c=-1;if(n.nodeType==1&&!n.firstChild){let f=n.getBoundingClientRect();c=f.left!=f.right&&i.left>(f.left+f.right)/2?1:-1}return t.docView.posFromDOM(n,o,c)}function rNe(t,e,i,n){let o=-1;for(let c=e,f=!1;c!=t.dom;){let r=t.docView.nearestDesc(c,!0),x;if(!r)return null;if(r.dom.nodeType==1&&(r.node.isBlock&&r.parent||!r.contentDOM)&&((x=r.dom.getBoundingClientRect()).width||x.height)&&(r.node.isBlock&&r.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(r.dom.nodeName)&&(!f&&x.left>n.left||x.top>n.top?o=r.posBefore:(!f&&x.right<n.left||x.bottom<n.top)&&(o=r.posAfter),f=!0),!r.contentDOM&&o<0&&!r.node.isText))return(r.node.isBlock?n.top<(x.top+x.bottom)/2:n.left<(x.left+x.right)/2)?r.posBefore:r.posAfter;c=r.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,i,-1)}function Ise(t,e,i){let n=t.childNodes.length;if(n&&i.top<i.bottom)for(let o=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-i.top)/(i.bottom-i.top))-2)),c=o;;){let f=t.childNodes[c];if(f.nodeType==1){let r=f.getClientRects();for(let x=0;x<r.length;x++){let S=r[x];if(Q4(e,S))return Ise(f,e,S)}}if((c=(c+1)%n)==o)break}return t}function sNe(t,e){let i=t.dom.ownerDocument,n,o=0,c=KPe(i,e.left,e.top);c&&({node:n,offset:o}=c);let f=(t.root.elementFromPoint?t.root:i).elementFromPoint(e.left,e.top),r;if(!f||!t.dom.contains(f.nodeType!=1?f.parentNode:f)){let S=t.dom.getBoundingClientRect();if(!Q4(e,S)||(f=Ise(t.dom,e,S),!f))return null}if(Il)for(let S=f;n&&S;S=jb(S))S.draggable&&(n=void 0);if(f=iNe(f,e),n){if(Ou&&n.nodeType==1&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let C=n.childNodes[o],I;C.nodeName=="IMG"&&(I=C.getBoundingClientRect()).right<=e.left&&I.bottom>e.top&&o++}let S;IE&&o&&n.nodeType==1&&(S=n.childNodes[o-1]).nodeType==1&&S.contentEditable=="false"&&S.getBoundingClientRect().top>=e.top&&o--,n==t.dom&&o==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?r=t.state.doc.content.size:(o==0||n.nodeType!=1||n.childNodes[o-1].nodeName!="BR")&&(r=rNe(t,n,o,e))}r==null&&(r=nNe(t,f,e));let x=t.docView.nearestDesc(f,!0);return{pos:r,inside:x?x.posAtStart-x.border:-1}}function CH(t){return t.top<t.bottom||t.left<t.right}function gm(t,e){let i=t.getClientRects();if(i.length){let n=i[e<0?0:i.length-1];if(CH(n))return n}return Array.prototype.find.call(i,CH)||t.getBoundingClientRect()}const oNe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kse(t,e,i){let{node:n,offset:o,atom:c}=t.docView.domFromPos(e,i<0?-1:1),f=IE||Ou;if(n.nodeType==3)if(f&&(oNe.test(n.nodeValue)||(i<0?!o:o==n.nodeValue.length))){let x=gm(jp(n,o,o),i);if(Ou&&o&&/\s/.test(n.nodeValue[o-1])&&o<n.nodeValue.length){let S=gm(jp(n,o-1,o-1),-1);if(S.top==x.top){let C=gm(jp(n,o,o+1),-1);if(C.top!=x.top)return PS(C,C.left<S.left)}}return x}else{let x=o,S=o,C=i<0?1:-1;return i<0&&!o?(S++,C=-1):i>=0&&o==n.nodeValue.length?(x--,C=1):i<0?x--:S++,PS(gm(jp(n,x,S),C),C<0)}if(!t.state.doc.resolve(e-(c||0)).parent.inlineContent){if(c==null&&o&&(i<0||o==Nu(n))){let x=n.childNodes[o-1];if(x.nodeType==1)return az(x.getBoundingClientRect(),!1)}if(c==null&&o<Nu(n)){let x=n.childNodes[o];if(x.nodeType==1)return az(x.getBoundingClientRect(),!0)}return az(n.getBoundingClientRect(),i>=0)}if(c==null&&o&&(i<0||o==Nu(n))){let x=n.childNodes[o-1],S=x.nodeType==3?jp(x,Nu(x)-(f?0:1)):x.nodeType==1&&(x.nodeName!="BR"||!x.nextSibling)?x:null;if(S)return PS(gm(S,1),!1)}if(c==null&&o<Nu(n)){let x=n.childNodes[o];for(;x.pmViewDesc&&x.pmViewDesc.ignoreForCoords;)x=x.nextSibling;let S=x?x.nodeType==3?jp(x,0,f?0:1):x.nodeType==1?x:null:null;if(S)return PS(gm(S,-1),!0)}return PS(gm(n.nodeType==3?jp(n):n,-i),i>=0)}function PS(t,e){if(t.width==0)return t;let i=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:i,right:i}}function az(t,e){if(t.height==0)return t;let i=e?t.top:t.bottom;return{top:i,bottom:i,left:t.left,right:t.right}}function Pse(t,e,i){let n=t.state,o=t.root.activeElement;n!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return i()}finally{n!=e&&t.updateState(n),o!=t.dom&&o&&o.focus()}}function aNe(t,e,i){let n=e.selection,o=i=="up"?n.$from:n.$to;return Pse(t,e,()=>{let{node:c}=t.docView.domFromPos(o.pos,i=="up"?-1:1);for(;;){let r=t.docView.nearestDesc(c,!0);if(!r)break;if(r.node.isBlock){c=r.contentDOM||r.dom;break}c=r.dom.parentNode}let f=kse(t,o.pos,1);for(let r=c.firstChild;r;r=r.nextSibling){let x;if(r.nodeType==1)x=r.getClientRects();else if(r.nodeType==3)x=jp(r,0,r.nodeValue.length).getClientRects();else continue;for(let S=0;S<x.length;S++){let C=x[S];if(C.bottom>C.top+1&&(i=="up"?f.top-C.top>(C.bottom-f.top)*2:C.bottom-f.bottom>(f.bottom-C.top)*2))return!1}}return!0})}const lNe=/[\u0590-\u08ac]/;function cNe(t,e,i){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let o=n.parentOffset,c=!o,f=o==n.parent.content.size,r=t.domSelection();return r?!lNe.test(n.parent.textContent)||!r.modify?i=="left"||i=="backward"?c:f:Pse(t,e,()=>{let{focusNode:x,focusOffset:S,anchorNode:C,anchorOffset:I}=t.domSelectionRange(),N=r.caretBidiLevel;r.modify("move",i,"character");let D=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:V,focusOffset:B}=t.domSelectionRange(),W=V&&!D.contains(V.nodeType==1?V:V.parentNode)||x==V&&S==B;try{r.collapse(C,I),x&&(x!=C||S!=I)&&r.extend&&r.extend(x,S)}catch{}return N!=null&&(r.caretBidiLevel=N),W}):n.pos==n.start()||n.pos==n.end()}let EH=null,AH=null,IH=!1;function uNe(t,e,i){return EH==e&&AH==i?IH:(EH=e,AH=i,IH=i=="up"||i=="down"?aNe(t,e,i):cNe(t,e,i))}const Fu=0,kH=1,i_=2,Zh=3;class kE{constructor(e,i,n,o){this.parent=e,this.children=i,this.dom=n,this.contentDOM=o,this.dirty=Fu,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,i,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let i=0;i<this.children.length;i++)e+=this.children[i].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let i=0,n=this.posAtStart;;i++){let o=this.children[i];if(o==e)return n;n+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,i,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let c,f;if(e==this.contentDOM)c=e.childNodes[i-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;c=e.previousSibling}for(;c&&!((f=c.pmViewDesc)&&f.parent==this);)c=c.previousSibling;return c?this.posBeforeChild(f)+f.size:this.posAtStart}else{let c,f;if(e==this.contentDOM)c=e.childNodes[i];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;c=e.nextSibling}for(;c&&!((f=c.pmViewDesc)&&f.parent==this);)c=c.nextSibling;return c?this.posBeforeChild(f):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=i>rl(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(i==0)for(let c=e;;c=c.parentNode){if(c==this.dom){o=!1;break}if(c.previousSibling)break}if(o==null&&i==e.childNodes.length)for(let c=e;;c=c.parentNode){if(c==this.dom){o=!0;break}if(c.nextSibling)break}}return o??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,i=!1){for(let n=!0,o=e;o;o=o.parentNode){let c=this.getDesc(o),f;if(c&&(!i||c.node))if(n&&(f=c.nodeDOM)&&!(f.nodeType==1?f.contains(e.nodeType==1?e:e.parentNode):f==e))n=!1;else return c}}getDesc(e){let i=e.pmViewDesc;for(let n=i;n;n=n.parent)if(n==this)return i}posFromDOM(e,i,n){for(let o=e;o;o=o.parentNode){let c=this.getDesc(o);if(c)return c.localPosFromDOM(e,i,n)}return-1}descAt(e){for(let i=0,n=0;i<this.children.length;i++){let o=this.children[i],c=n+o.size;if(n==e&&c!=n){for(;!o.border&&o.children.length;)for(let f=0;f<o.children.length;f++){let r=o.children[f];if(r.size){o=r;break}}return o}if(e<c)return o.descAt(e-n-o.border);n=c}}domFromPos(e,i){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,o=0;for(let c=0;n<this.children.length;n++){let f=this.children[n],r=c+f.size;if(r>e||f instanceof Mse){o=e-c;break}c=r}if(o)return this.children[n].domFromPos(o-this.children[n].border,i);for(let c;n&&!(c=this.children[n-1]).size&&c instanceof Nse&&c.side>=0;n--);if(i<=0){let c,f=!0;for(;c=n?this.children[n-1]:null,!(!c||c.dom.parentNode==this.contentDOM);n--,f=!1);return c&&i&&f&&!c.border&&!c.domAtom?c.domFromPos(c.size,i):{node:this.contentDOM,offset:c?rl(c.dom)+1:0}}else{let c,f=!0;for(;c=n<this.children.length?this.children[n]:null,!(!c||c.dom.parentNode==this.contentDOM);n++,f=!1);return c&&f&&!c.border&&!c.domAtom?c.domFromPos(0,i):{node:this.contentDOM,offset:c?rl(c.dom):this.contentDOM.childNodes.length}}}parseRange(e,i,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:i,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,c=-1;for(let f=n,r=0;;r++){let x=this.children[r],S=f+x.size;if(o==-1&&e<=S){let C=f+x.border;if(e>=C&&i<=S-x.border&&x.node&&x.contentDOM&&this.contentDOM.contains(x.contentDOM))return x.parseRange(e,i,C);e=f;for(let I=r;I>0;I--){let N=this.children[I-1];if(N.size&&N.dom.parentNode==this.contentDOM&&!N.emptyChildAt(1)){o=rl(N.dom)+1;break}e-=N.size}o==-1&&(o=0)}if(o>-1&&(S>i||r==this.children.length-1)){i=S;for(let C=r+1;C<this.children.length;C++){let I=this.children[C];if(I.size&&I.dom.parentNode==this.contentDOM&&!I.emptyChildAt(-1)){c=rl(I.dom);break}i+=I.size}c==-1&&(c=this.contentDOM.childNodes.length);break}f=S}return{node:this.contentDOM,from:e,to:i,fromOffset:o,toOffset:c}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let i=this.children[e<0?0:this.children.length-1];return i.size==0||i.emptyChildAt(e)}domAfterPos(e){let{node:i,offset:n}=this.domFromPos(e,0);if(i.nodeType!=1||n==i.childNodes.length)throw new RangeError("No node after pos "+e);return i.childNodes[n]}setSelection(e,i,n,o=!1){let c=Math.min(e,i),f=Math.max(e,i);for(let D=0,V=0;D<this.children.length;D++){let B=this.children[D],W=V+B.size;if(c>V&&f<W)return B.setSelection(e-V-B.border,i-V-B.border,n,o);V=W}let r=this.domFromPos(e,e?-1:1),x=i==e?r:this.domFromPos(i,i?-1:1),S=n.root.getSelection(),C=n.domSelectionRange(),I=!1;if((Ou||Il)&&e==i){let{node:D,offset:V}=r;if(D.nodeType==3){if(I=!!(V&&D.nodeValue[V-1]==` 3729`),I&&V==D.nodeValue.length)for(let B=D,W;B;B=B.parentNode){if(W=B.nextSibling){W.nodeName=="BR"&&(r=x={node:W.parentNode,offset:rl(W)+1});break}let $=B.pmViewDesc;if($&&$.node&&$.node.isBlock)break}}else{let B=D.childNodes[V-1];I=B&&(B.nodeName=="BR"||B.contentEditable=="false")}}if(Ou&&C.focusNode&&C.focusNode!=x.node&&C.focusNode.nodeType==1){let D=C.focusNode.childNodes[C.focusOffset];D&&D.contentEditable=="false"&&(o=!0)}if(!(o||I&&Il)&&J_(r.node,r.offset,C.anchorNode,C.anchorOffset)&&J_(x.node,x.offset,C.focusNode,C.focusOffset))return;let N=!1;if((S.extend||e==i)&&!(I&&Ou)){S.collapse(r.node,r.offset);try{e!=i&&S.extend(x.node,x.offset),N=!0}catch{}}if(!N){if(e>i){let V=r;r=x,x=V}let D=document.createRange();D.setEnd(x.node,x.offset),D.setStart(r.node,r.offset),S.removeAllRanges(),S.addRange(D)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,i){for(let n=0,o=0;o<this.children.length;o++){let c=this.children[o],f=n+c.size;if(n==f?e<=f&&i>=n:e<f&&i>n){let r=n+c.border,x=f-c.border;if(e>=r&&i<=x){this.dirty=e==n||i==f?i_:kH,e==r&&i==x&&(c.contentLost||c.dom.parentNode!=this.contentDOM)?c.dirty=Zh:c.markDirty(e-r,i-r);return}else c.dirty=c.dom==c.contentDOM&&c.dom.parentNode==this.contentDOM&&!c.children.length?i_:Zh}n=f}this.dirty=i_}markParentsDirty(){let e=1;for(let i=this.parent;i;i=i.parent,e++){let n=e==1?i_:kH;i.dirty<n&&(i.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Nse extends kE{constructor(e,i,n,o){let c,f=i.type.toDOM;if(typeof f=="function"&&(f=f(n,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)})),!i.type.spec.raw){if(f.nodeType!=1){let r=document.createElement("span");r.appendChild(f),f=r}f.contentEditable="false",f.classList.add("ProseMirror-widget")}super(e,[],f,null),this.widget=i,this.widget=i,c=this}matchesWidget(e){return this.dirty==Fu&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let i=this.widget.spec.stopEvent;return i?i(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class dNe extends kE{constructor(e,i,n,o){super(e,[],i,null),this.textDOM=n,this.text=o}get size(){return this.text.length}localPosFromDOM(e,i){return e!=this.textDOM?this.posAtStart+(i?this.size:0):this.posAtStart+i}
vendor: 5,147 bytes, line 3729
3729domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ev extends kE{constructor(e,i,n,o,c){super(e,[],n,o),this.mark=i,this.spec=c}static create(e,i,n,o){let c=o.nodeViews[i.type.name],f=c&&c(i,o,n);return(!f||!f.dom)&&(f=hv.renderSpec(document,i.type.spec.toDOM(i,n),null,i.attrs)),new ev(e,i,f.dom,f.contentDOM||f.dom,f)}parseRule(){return this.dirty&Zh||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Zh&&this.mark.eq(e)}markDirty(e,i){if(super.markDirty(e,i),this.dirty!=Fu){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=Fu}}slice(e,i,n){let o=ev.create(this.parent,this.mark,!0,n),c=this.children,f=this.size;i<f&&(c=$O(c,i,f,n)),e>0&&(c=$O(c,0,e,n));for(let r=0;r<c.length;r++)c[r].parent=o;return o.children=c,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lg extends kE{constructor(e,i,n,o,c,f,r,x,S){super(e,[],c,f),this.node=i,this.outerDeco=n,this.innerDeco=o,this.nodeDOM=r}static create(e,i,n,o,c,f){let r=c.nodeViews[i.type.name],x,S=r&&r(i,c,()=>{if(!x)return f;if(x.parent)return x.parent.posBeforeChild(x)},n,o),C=S&&S.dom,I=S&&S.contentDOM;if(i.isText){if(!C)C=document.createTextNode(i.text);else if(C.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else C||({dom:C,contentDOM:I}=hv.renderSpec(document,i.type.spec.toDOM(i),null,i.attrs));!I&&!i.isText&&C.nodeName!="BR"&&(C.hasAttribute("contenteditable")||(C.contentEditable="false"),i.type.spec.draggable&&(C.draggable=!0));let N=C;return C=jse(C,n,i),S?x=new hNe(e,i,n,o,C,I||null,N,S,c,f+1):i.isText?new MM(e,i,n,o,C,N,c):new lg(e,i,n,o,C,I||null,N,c,f+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let i=this.children.length-1;i>=0;i--){let n=this.children[i];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Si.empty)}return e}matchesNode(e,i,n){return this.dirty==Fu&&e.eq(this.node)&&_P(i,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,i){let n=this.node.inlineContent,o=i,c=e.composing?this.localCompositionInfo(e,i):null,f=c&&c.pos>-1?c:null,r=c&&c.pos<0,x=new fNe(this,f&&f.node,e);yNe(this.node,this.innerDeco,(S,C,I)=>{S.spec.marks?x.syncToMarks(S.spec.marks,n,e,C):S.type.side>=0&&!I&&x.syncToMarks(C==this.node.childCount?Ws.none:this.node.child(C).marks,n,e,C),x.placeWidget(S,e,o)},(S,C,I,N)=>{x.syncToMarks(S.marks,n,e,N);let D;x.findNodeMatch(S,C,I,N)||r&&e.state.selection.from>o&&e.state.selection.to<o+S.nodeSize&&(D=x.findIndexWithChild(c.node))>-1&&x.updateNodeAt(S,C,I,D,e)||x.updateNextNode(S,C,I,e,N,o)||x.addNode(S,C,I,e,o),o+=S.nodeSize}),x.syncToMarks([],n,e,0),this.node.isTextblock&&x.addTextblockHacks(),x.destroyRest(),(x.changed||this.dirty==i_)&&(f&&this.protectLocalComposition(e,f),Dse(this.contentDOM,this.children,e),zb&&_Ne(this.dom))}localCompositionInfo(e,i){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof br)||n<i||o>i+this.node.content.size)return null;let c=e.input.compositionNode;if(!c||!this.dom.contains(c.parentNode))return null;if(this.node.inlineContent){let f=c.nodeValue,r=vNe(this.node.content,f,n-i,o-i);return r<0?null:{node:c,pos:r,text:f}}else return{node:c,pos:-1,text:""}}protectLocalComposition(e,{node:i,pos:n,text:o}){if(this.getDesc(i))return;let c=i;for(;c.parentNode!=this.contentDOM;c=c.parentNode){for(;c.previousSibling;)c.parentNode.removeChild(c.previousSibling);for(;c.nextSibling;)c.parentNode.removeChild(c.nextSibling);c.pmViewDesc&&(c.pmViewDesc=void 0)}let f=new dNe(this,c,i,o);e.input.compositionNodes.push(f),this.children=$O(this.children,n,n+o.length,e,f)}update(e,i,n,o){return this.dirty==Zh||!e.sameMarkup(this.node)?!1:(this.updateInner(e,i,n,o),!0)}updateInner(e,i,n,o){this.updateOuterDeco(i),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Fu}updateOuterDeco(e){if(_P(e,this.outerDeco))return;let i=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Rse(this.dom,this.nodeDOM,VO(this.outerDeco,this.node,i),VO(e,this.node,i)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}
vendor: 6,380 bytes, line 3729
3729function PH(t,e,i,n,o){jse(n,e,t);let c=new lg(void 0,t,e,i,n,n,n,o,0);return c.contentDOM&&c.updateChildren(o,0),c}class MM extends lg{constructor(e,i,n,o,c,f,r){super(e,i,n,o,c,null,f,r,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,i,n,o){return this.dirty==Zh||this.dirty!=Fu&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(i),(this.dirty!=Fu||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Fu,!0)}inParent(){let e=this.parent.contentDOM;for(let i=this.nodeDOM;i;i=i.parentNode)if(i==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,i,n){return e==this.nodeDOM?this.posAtStart+Math.min(i,this.node.text.length):super.localPosFromDOM(e,i,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,i,n){let o=this.node.cut(e,i),c=document.createTextNode(o.text);return new MM(this.parent,o,this.outerDeco,this.innerDeco,c,c,n)}markDirty(e,i){super.markDirty(e,i),this.dom!=this.nodeDOM&&(e==0||i==this.nodeDOM.nodeValue.length)&&(this.dirty=Zh)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Mse extends kE{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Fu&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class hNe extends lg{constructor(e,i,n,o,c,f,r,x,S,C){super(e,i,n,o,c,f,r,S,C),this.spec=x}update(e,i,n,o){if(this.dirty==Zh)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let c=this.spec.update(e,i,n);return c&&this.updateInner(e,i,n,o),c}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,i,n,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,i,n,o){this.spec.setSelection?this.spec.setSelection(e,i,n.root):super.setSelection(e,i,n,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Dse(t,e,i){let n=t.firstChild,o=!1;for(let c=0;c<e.length;c++){let f=e[c],r=f.dom;if(r.parentNode==t){for(;r!=n;)n=NH(n),o=!0;n=n.nextSibling}else o=!0,t.insertBefore(r,n);if(f instanceof ev){let x=n?n.previousSibling:t.lastChild;Dse(f.contentDOM,f.children,i),n=x?x.nextSibling:t.firstChild}}for(;n;)n=NH(n),o=!0;o&&i.trackWrites==t&&(i.trackWrites=null)}const wT=function(t){t&&(this.nodeName=t)};wT.prototype=Object.create(null);const n_=[new wT];function VO(t,e,i){if(t.length==0)return n_;let n=i?n_[0]:new wT,o=[n];for(let c=0;c<t.length;c++){let f=t[c].type.attrs;if(f){f.nodeName&&o.push(n=new wT(f.nodeName));for(let r in f){let x=f[r];x!=null&&(i&&o.length==1&&o.push(n=new wT(e.isInline?"span":"div")),r=="class"?n.class=(n.class?n.class+" ":"")+x:r=="style"?n.style=(n.style?n.style+";":"")+x:r!="nodeName"&&(n[r]=x))}}}return o}function Rse(t,e,i,n){if(i==n_&&n==n_)return e;let o=e;for(let c=0;c<n.length;c++){let f=n[c],r=i[c];if(c){let x;r&&r.nodeName==f.nodeName&&o!=t&&(x=o.parentNode)&&x.nodeName.toLowerCase()==f.nodeName||(x=document.createElement(f.nodeName),x.pmIsDeco=!0,x.appendChild(o),r=n_[0]),o=x}pNe(o,r||n_[0],f)}return o}function pNe(t,e,i){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in i)&&t.removeAttribute(n);for(let n in i)n!="class"&&n!="style"&&n!="nodeName"&&i[n]!=e[n]&&t.setAttribute(n,i[n]);if(e.class!=i.class){let n=e.class?e.class.split(" ").filter(Boolean):[],o=i.class?i.class.split(" ").filter(Boolean):[];for(let c=0;c<n.length;c++)o.indexOf(n[c])==-1&&t.classList.remove(n[c]);for(let c=0;c<o.length;c++)n.indexOf(o[c])==-1&&t.classList.add(o[c]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=i.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=n.exec(e.style);)t.style.removeProperty(o[1])}i.style&&(t.style.cssText+=i.style)}}function jse(t,e,i){return Rse(t,t,n_,VO(e,i,t.nodeType!=1))}function _P(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].type.eq(e[i].type))return!1;return!0}function NH(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class fNe{constructor(e,i,n){this.lock=i,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=mNe(e.node.content,e)}destroyBetween(e,i){if(e!=i){for(let n=e;n<i;n++)this.top.children[n].destroy();this.top.children.splice(e,i-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,i,n,o){let c=0,f=this.stack.length>>1,r=Math.min(f,e.length);for(;c<r&&(c==f-1?this.top:this.stack[c+1<<1]).matchesMark(e[c])&&e[c].type.spec.spanning!==!1;)c++;for(;c<f;)this.destroyRest(),this.top.dirty=Fu,this.index=this.stack.pop(),this.top=this.stack.pop(),f--;for(;f<e.length;){this.stack.push(this.top,this.index+1);let x=-1,S=this.top.children.length;o<this.preMatch.index&&(S=Math.min(this.index+3,S));for(let C=this.index;C<S;C++){let I=this.top.children[C];if(I.matchesMark(e[f])&&!this.isLocked(I.dom)){x=C;break}}if(x>-1)x>this.index&&(this.changed=!0,this.destroyBetween(this.index,x)),this.top=this.top.children[this.index];else{let C=ev.create(this.top,e[f],i,n);this.top.children.splice(this.index,0,C),this.top=C,this.changed=!0}this.index=0,f++}}findNodeMatch(e,i,n,o){let c=-1,f;if(o>=this.preMatch.index&&(f=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&f.matchesNode(e,i,n))c=this.top.children.indexOf(f,this.index);else for(let r=this.index,x=Math.min(this.top.children.length,r+5);r<x;r++){let S=this.top.children[r];if(S.matchesNode(e,i,n)&&!this.preMatch.matched.has(S)){c=r;break}}return c<0?!1:(this.destroyBetween(this.index,c),this.index++,!0)}updateNodeAt(e,i,n,o,c){let f=this.top.children[o];return f.dirty==Zh&&f.dom==f.contentDOM&&(f.dirty=i_),f.update(e,i,n,c)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let i=e.parentNode;if(!i)return-1;if(i==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==n)return o}return-1}e=i}
vendor: 13,058 bytes, line 3729
3729}updateNextNode(e,i,n,o,c,f){for(let r=this.index;r<this.top.children.length;r++){let x=this.top.children[r];if(x instanceof lg){let S=this.preMatch.matched.get(x);if(S!=null&&S!=c)return!1;let C=x.dom,I,N=this.isLocked(C)&&!(e.isText&&x.node&&x.node.isText&&x.nodeDOM.nodeValue==e.text&&x.dirty!=Zh&&_P(i,x.outerDeco));if(!N&&x.update(e,i,n,o))return this.destroyBetween(this.index,r),x.dom!=C&&(this.changed=!0),this.index++,!0;if(!N&&(I=this.recreateWrapper(x,e,i,n,o,f)))return this.destroyBetween(this.index,r),this.top.children[this.index]=I,I.contentDOM&&(I.dirty=i_,I.updateChildren(o,f+1),I.dirty=Fu),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,i,n,o,c,f){if(e.dirty||i.isAtom||!e.children.length||!e.node.content.eq(i.content)||!_P(n,e.outerDeco)||!o.eq(e.innerDeco))return null;let r=lg.create(this.top,i,n,o,c,f);if(r.contentDOM){r.children=e.children,e.children=[];for(let x of r.children)x.parent=r}return e.destroy(),r}addNode(e,i,n,o,c){let f=lg.create(this.top,e,i,n,o,c);f.contentDOM&&f.updateChildren(o,c+1),this.top.children.splice(this.index++,0,f),this.changed=!0}placeWidget(e,i,n){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let c=new Nse(this.top,e,i,n);this.top.children.splice(this.index++,0,c),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],i=this.top;for(;e instanceof ev;)i=e,e=i.children[i.children.length-1];(!e||!(e instanceof MM)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Il||ol)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",i),this.addHackNode("BR",this.top))}addHackNode(e,i){if(i==this.top&&this.index<i.children.length&&i.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let o=new Mse(this.top,[],n,null);i!=this.top?i.children.push(o):i.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function mNe(t,e){let i=e,n=i.children.length,o=t.childCount,c=new Map,f=[];e:for(;o>0;){let r;for(;;)if(n){let S=i.children[n-1];if(S instanceof ev)i=S,n=S.children.length;else{r=S,n--;break}}else{if(i==e)break e;n=i.parent.children.indexOf(i),i=i.parent}let x=r.node;if(x){if(x!=t.child(o-1))break;--o,c.set(r,o),f.push(r)}}return{index:o,matched:c,matches:f.reverse()}}function gNe(t,e){return t.type.side-e.type.side}function yNe(t,e,i,n){let o=e.locals(t),c=0;if(o.length==0){for(let S=0;S<t.childCount;S++){let C=t.child(S);n(C,o,e.forChild(c,C),S),c+=C.nodeSize}return}let f=0,r=[],x=null;for(let S=0;;){let C,I;for(;f<o.length&&o[f].to==c;){let W=o[f++];W.widget&&(C?(I||(I=[C])).push(W):C=W)}if(C)if(I){I.sort(gNe);for(let W=0;W<I.length;W++)i(I[W],S,!!x)}else i(C,S,!!x);let N,D;if(x)D=-1,N=x,x=null;else if(S<t.childCount)D=S,N=t.child(S++);else break;for(let W=0;W<r.length;W++)r[W].to<=c&&r.splice(W--,1);for(;f<o.length&&o[f].from<=c&&o[f].to>c;)r.push(o[f++]);let V=c+N.nodeSize;if(N.isText){let W=V;f<o.length&&o[f].from<W&&(W=o[f].from);for(let $=0;$<r.length;$++)r[$].to<W&&(W=r[$].to);W<V&&(x=N.cut(W-c),N=N.cut(0,W-c),V=W,D=-1)}else for(;f<o.length&&o[f].to<V;)f++;let B=N.isInline&&!N.isLeaf?r.filter(W=>!W.inline):r.slice();n(N,B,e.forChild(c,N),D),c=V}}function _Ne(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function vNe(t,e,i,n){for(let o=0,c=0;o<t.childCount&&c<=n;){let f=t.child(o++),r=c;if(c+=f.nodeSize,!f.isText)continue;let x=f.text;for(;o<t.childCount;){let S=t.child(o++);if(c+=S.nodeSize,!S.isText)break;x+=S.text}if(c>=i){if(c>=n&&x.slice(n-e.length-r,n-r)==e)return n-e.length;let S=r<n?x.lastIndexOf(e,n-r-1):-1;if(S>=0&&S+e.length+r>=i)return r+S;if(i==n&&x.length>=n+e.length-r&&x.slice(n-r,n-r+e.length)==e)return n}}return-1}function $O(t,e,i,n,o){let c=[];for(let f=0,r=0;f<t.length;f++){let x=t[f],S=r,C=r+=x.size;S>=i||C<=e?c.push(x):(S<e&&c.push(x.slice(0,e-S,n)),o&&(c.push(o),o=void 0),C>i&&c.push(x.slice(i-S,x.size,n)))}return c}function J4(t,e=null){let i=t.domSelectionRange(),n=t.state.doc;if(!i.focusNode)return null;let o=t.docView.nearestDesc(i.focusNode),c=o&&o.size==0,f=t.docView.posFromDOM(i.focusNode,i.focusOffset,1);if(f<0)return null;let r=n.resolve(f),x,S;if(NM(i)){for(x=f;o&&!o.node;)o=o.parent;let I=o.node;if(o&&I.isAtom&&qn.isSelectable(I)&&o.parent&&!(I.isInline&&GPe(i.focusNode,i.focusOffset,o.dom))){let N=o.posBefore;S=new qn(f==N?r:n.resolve(N))}}else{if(i instanceof t.dom.ownerDocument.defaultView.Selection&&i.rangeCount>1){let I=f,N=f;for(let D=0;D<i.rangeCount;D++){let V=i.getRangeAt(D);I=Math.min(I,t.docView.posFromDOM(V.startContainer,V.startOffset,1)),N=Math.max(N,t.docView.posFromDOM(V.endContainer,V.endOffset,-1))}if(I<0)return null;[x,f]=N==t.state.selection.anchor?[N,I]:[I,N],r=n.resolve(f)}else x=t.docView.posFromDOM(i.anchorNode,i.anchorOffset,1);if(x<0)return null}let C=n.resolve(x);if(!S){let I=e=="pointer"||t.state.selection.head<r.pos&&!c?1:-1;S=eB(t,C,r,I)}return S}function zse(t){return t.editable?t.hasFocus():Ose(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Qp(t,e=!1){let i=t.state.selection;if(Lse(t,i),!!zse(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ol){let n=t.domSelectionRange(),o=t.domObserver.currentSelection;if(n.anchorNode&&o.anchorNode&&J_(n.anchorNode,n.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)bNe(t);else{let{anchor:n,head:o}=i,c,f;MH&&!(i instanceof br)&&(i.$from.parent.inlineContent||(c=DH(t,i.from)),!i.empty&&!i.$from.parent.inlineContent&&(f=DH(t,i.to))),t.docView.setSelection(n,o,t,e),MH&&(c&&RH(c),f&&RH(f)),i.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xNe(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const MH=Il||ol&&Sse<63;function DH(t,e){let{node:i,offset:n}=t.docView.domFromPos(e,0),o=n<i.childNodes.length?i.childNodes[n]:null,c=n?i.childNodes[n-1]:null;if(Il&&o&&o.contentEditable=="false")return lz(o);if((!o||o.contentEditable=="false")&&(!c||c.contentEditable=="false")){if(o)return lz(o);if(c)return lz(c)}}function lz(t){return t.contentEditable="true",Il&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function RH(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function xNe(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let i=t.domSelectionRange(),n=i.anchorNode,o=i.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(i.anchorNode!=n||i.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!zse(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function bNe(t){let e=t.domSelection();if(!e)return;let i=t.cursorWrapper.dom,n=i.nodeName=="IMG";n?e.collapse(i.parentNode,rl(i)+1):e.collapse(i,0),!n&&!t.state.selection.visible&&Fc&&ag<=11&&(i.disabled=!0,i.disabled=!1)}function Lse(t,e){if(e instanceof qn){let i=t.docView.descAt(e.from);i!=t.lastSelectedViewDesc&&(jH(t),i&&i.selectNode(),t.lastSelectedViewDesc=i)}else jH(t)}function jH(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function eB(t,e,i,n){return t.someProp("createSelectionBetween",o=>o(t,e,i))||br.between(e,i,n)}function zH(t){return t.editable&&!t.hasFocus()?!1:Ose(t)}function Ose(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function wNe(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),i=t.domSelectionRange();return J_(e.node,e.offset,i.anchorNode,i.anchorOffset)}function qO(t,e){let{$anchor:i,$head:n}=t.selection,o=e>0?i.max(n):i.min(n),c=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return c&&zr.findFrom(c,e)}function xm(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function LH(t,e,i){let n=t.state.selection;if(n instanceof br)if(i.indexOf("s")>-1){let{$head:o}=n,c=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!c||c.isText||!c.isLeaf)return!1;let f=t.state.doc.resolve(o.pos+c.nodeSize*(e<0?-1:1));return xm(t,new br(n.$anchor,f))}else if(n.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=qO(t.state,e);return o&&o instanceof qn?xm(t,o):!1}else if(!(Iu&&i.indexOf("m")>-1)){let o=n.$head,c=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,f;if(!c||c.isText)return!1;let r=e<0?o.pos-c.nodeSize:o.pos;return c.isAtom||(f=t.docView.descAt(r))&&!f.contentDOM?qn.isSelectable(c)?xm(t,new qn(e<0?t.state.doc.resolve(o.pos-c.nodeSize):o)):IE?xm(t,new br(t.state.doc.resolve(e<0?r:r+c.nodeSize))):!1:!1}}else return!1;else{if(n instanceof qn&&n.node.isInline)return xm(t,new br(e>0?n.$to:n.$from));{let o=qO(t.state,e);return o?xm(t,o):!1}}}function vP(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ST(t,e){let i=t.pmViewDesc;return i&&i.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Kx(t,e){return e<0?SNe(t):TNe(t)}function SNe(t){let e=t.domSelectionRange(),i=e.focusNode,n=e.focusOffset;if(!i)return;let o,c,f=!1;for(Ou&&i.nodeType==1&&n<vP(i)&&ST(i.childNodes[n],-1)&&(f=!0);;)if(n>0){if(i.nodeType!=1)break;{let r=i.childNodes[n-1];if(ST(r,-1))o=i,c=--n;else if(r.nodeType==3)i=r,n=i.nodeValue.length;else break}}else{if(Fse(i))break;{let r=i.previousSibling;for(;r&&ST(r,-1);)o=i.parentNode,c=rl(r),r=r.previousSibling;if(r)i=r,n=vP(i);else{if(i=i.parentNode,i==t.dom)break;n=0}}}f?HO(t,i,n):o&&HO(t,o,c)}function TNe(t){let e=t.domSelectionRange(),i=e.focusNode,n=e.focusOffset;if(!i)return;let o=vP(i),c,f;for(;;)if(n<o){if(i.nodeType!=1)break;let r=i.childNodes[n];if(ST(r,1))c=i,f=++n;else break}else{if(Fse(i))break;{let r=i.nextSibling;for(;r&&ST(r,1);)c=r.parentNode,f=rl(r)+1,r=r.nextSibling;if(r)i=r,n=0,o=vP(i);else{if(i=i.parentNode,i==t.dom)break;n=o=0}}}c&&HO(t,c,f)}function Fse(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function CNe(t,e){for(;t&&e==t.childNodes.length&&!AE(t);)e=rl(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let i=t.childNodes[e];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;t=i,e=0}}function ENe(t,e){for(;t&&!e&&!AE(t);)e=rl(t),t=t.parentNode;for(;t&&e;){let i=t.childNodes[e-1];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;t=i,e=t.childNodes.length}}function HO(t,e,i){if(e.nodeType!=3){let c,f;(f=CNe(e,i))?(e=f,i=0):(c=ENe(e,i))&&(e=c,i=c.nodeValue.length)}let n=t.domSelection();if(!n)return;if(NM(n)){let c=document.createRange();c.setEnd(e,i),c.setStart(e,i),n.removeAllRanges(),n.addRange(c)}else n.extend&&n.extend(e,i);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Qp(t)},50)}function OH(t,e){let i=t.state.doc.resolve(e);if(!(ol||Tse)&&i.parent.inlineContent){let o=t.coordsAtPos(e);if(e>i.start()){let c=t.coordsAtPos(e-1),f=(c.top+c.bottom)/2;if(f>o.top&&f<o.bottom&&Math.abs(c.left-o.left)>1)return c.left<o.left?"ltr":"rtl"}if(e<i.end()){let c=t.coordsAtPos(e+1),f=(c.top+c.bottom)/2;if(f>o.top&&f<o.bottom&&Math.abs(c.left-o.left)>1)return c.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function FH(t,e,i){let n=t.state.selection;if(n instanceof br&&!n.empty||i.indexOf("s")>-1||Iu&&i.indexOf("m")>-1)return!1;let{$from:o,$to:c}=n;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let f=qO(t.state,e);if(f&&f instanceof qn)return xm(t,f)}if(!o.parent.inlineContent){let f=e<0?o:c,r=n instanceof Lu?zr.near(f,e):zr.findFrom(f,e);return r?xm(t,r):!1}return!1}function BH(t,e){if(!(t.state.selection instanceof br))return!0;let{$head:i,$anchor:n,empty:o}=t.state.selection;if(!i.sameParent(n))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let c=!i.textOffset&&(e<0?i.nodeBefore:i.nodeAfter);if(c&&!c.isText){let f=t.state.tr;return e<0?f.delete(i.pos-c.nodeSize,i.pos):f.delete(i.pos,i.pos+c.nodeSize),t.dispatch(f),!0}return!1}function UH(t,e,i){t.domObserver.stop(),e.contentEditable=i,t.domObserver.start()}function ANe(t){if(!Il||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(e&&e.nodeType==1&&i==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;UH(t,n,"true"),setTimeout(()=>UH(t,n,"false"),20)}return!1}function INe(t){let e="";
vendor: 4,270 bytes, lines 3729-3732
3729return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function kNe(t,e){let i=e.keyCode,n=INe(e);if(i==8||Iu&&i==72&&n=="c")return BH(t,-1)||Kx(t,-1);if(i==46&&!e.shiftKey||Iu&&i==68&&n=="c")return BH(t,1)||Kx(t,1);if(i==13||i==27)return!0;if(i==37||Iu&&i==66&&n=="c"){let o=i==37?OH(t,t.state.selection.from)=="ltr"?-1:1:-1;return LH(t,o,n)||Kx(t,o)}else if(i==39||Iu&&i==70&&n=="c"){let o=i==39?OH(t,t.state.selection.from)=="ltr"?1:-1:1;return LH(t,o,n)||Kx(t,o)}else{if(i==38||Iu&&i==80&&n=="c")return FH(t,-1,n)||Kx(t,-1);if(i==40||Iu&&i==78&&n=="c")return ANe(t)||FH(t,1,n)||Kx(t,1);if(n==(Iu?"m":"c")&&(i==66||i==73||i==89||i==90))return!0}return!1}function tB(t,e){t.someProp("transformCopied",D=>{e=D(e,t)});let i=[],{content:n,openStart:o,openEnd:c}=e;for(;o>1&&c>1&&n.childCount==1&&n.firstChild.childCount==1;){o--,c--;let D=n.firstChild;i.push(D.type.name,D.attrs!=D.type.defaultAttrs?D.attrs:null),n=D.content}let f=t.someProp("clipboardSerializer")||hv.fromSchema(t.state.schema),r=Hse(),x=r.createElement("div");x.appendChild(f.serializeFragment(n,{document:r}));let S=x.firstChild,C,I=0;for(;S&&S.nodeType==1&&(C=qse[S.nodeName.toLowerCase()]);){for(let D=C.length-1;D>=0;D--){let V=r.createElement(C[D]);for(;x.firstChild;)V.appendChild(x.firstChild);x.appendChild(V),I++}S=x.firstChild}S&&S.nodeType==1&&S.setAttribute("data-pm-slice",`${o} ${c}${I?` -${I}`:""} ${JSON.stringify(i)}`);let N=t.someProp("clipboardTextSerializer",D=>D(e,t))||e.content.textBetween(0,e.content.size,` 3730 3731`);return{dom:x,text:N,slice:e}}function Bse(t,e,i,n,o){let c=o.parent.type.spec.code,f,r;if(!i&&!e)return null;let x=!!e&&(n||c||!i);if(x){if(t.someProp("transformPastedText",N=>{e=N(e,c||n,t)}),c)return r=new pn(Si.from(t.state.schema.text(e.replace(/\r\n?/g,` 3732`))),0,0),t.someProp("transformPasted",N=>{r=N(r,t,!0)}),r;let I=t.someProp("clipboardTextParser",N=>N(e,o,n,t));if(I)r=I;else{let N=o.marks(),{schema:D}=t.state,V=hv.fromSchema(D);f=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(B=>{let W=f.appendChild(document.createElement("p"));B&&W.appendChild(V.serializeNode(D.text(B,N)))})}}else t.someProp("transformPastedHTML",I=>{i=I(i,t)}),f=DNe(i),IE&&RNe(f);let S=f&&f.querySelector("[data-pm-slice]"),C=S&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(S.getAttribute("data-pm-slice")||"");if(C&&C[3])for(let I=+C[3];I>0;I--){let N=f.firstChild;for(;N&&N.nodeType!=1;)N=N.nextSibling;if(!N)break;f=N}if(r||(r=(t.someProp("clipboardParser")||t.someProp("domParser")||og.fromSchema(t.state.schema)).parseSlice(f,{preserveWhitespace:!!(x||C),context:o,ruleFromNode(N){return N.nodeName=="BR"&&!N.nextSibling&&N.parentNode&&!PNe.test(N.parentNode.nodeName)?{ignore:!0}:null}})),C)r=jNe(VH(r,+C[1],+C[2]),C[4]);else if(r=pn.maxOpen(NNe(r.content,o),!0),r.openStart||r.openEnd){let I=0,N=0;for(let D=r.content.firstChild;I<r.openStart&&!D.type.spec.isolating;I++,D=D.firstChild);for(let D=r.content.lastChild;N<r.openEnd&&!D.type.spec.isolating;N++,D=D.lastChild);r=VH(r,I,N)}return t.someProp("transformPasted",I=>{r=I(r,t,x)}),r}const PNe=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function NNe(t,e){if(t.childCount<2)return t;for(let i=e.depth;i>=0;i--){let o=e.node(i).contentMatchAt(e.index(i)),c,f=[];if(t.forEach(r=>{if(!f)return;let x=o.findWrapping(r.type),S;if(!x)return f=null;if(S=f.length&&c.length&&Vse(x,c,r,f[f.length-1],0))f[f.length-1]=S;else{f.length&&(f[f.length-1]=$se(f[f.length-1],c.length));let C=Use(r,x);f.push(C),o=o.matchType(C.type),c=x}}),f)return Si.from(f)}return t}function Use(t,e,i=0){for(let n=e.length-1;n>=i;n--)t=e[n].create(null,Si.from(t));return t}function Vse(t,e,i,n,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let c=Vse(t,e,i,n.lastChild,o+1);if(c)return n.copy(n.content.replaceChild(n.childCount-1,c));if(n.contentMatchAt(n.childCount).matchType(o==t.length-1?i.type:t[o+1]))return n.copy(n.content.append(Si.from(Use(i,t,o+1))))}}function $se(t,e){if(e==0)return t;let i=t.content.replaceChild(t.childCount-1,$se(t.lastChild,e-1)),n=t.contentMatchAt(t.childCount).fillBefore(Si.empty,!0);return t.copy(i.append(n))}function GO(t,e,i,n,o,c){let f=e<0?t.firstChild:t.lastChild,r=f.content;return t.childCount>
vendor: 10,392 bytes, line 3732
37321&&(c=0),o<n-1&&(r=GO(r,e,i,n,o+1,c)),o>=i&&(r=e<0?f.contentMatchAt(0).fillBefore(r,c<=o).append(r):r.append(f.contentMatchAt(f.childCount).fillBefore(Si.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,f.copy(r))}function VH(t,e,i){return e<t.openStart&&(t=new pn(GO(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),i<t.openEnd&&(t=new pn(GO(t.content,1,i,t.openEnd,0,0),t.openStart,i)),t}const qse={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let $H=null;function Hse(){return $H||($H=document.implementation.createHTMLDocument("title"))}let cz=null;function MNe(t){let e=window.trustedTypes;return e?(cz||(cz=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:i=>i})),cz.createHTML(t)):t}function DNe(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let i=Hse().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(t),o;if((o=n&&qse[n[1].toLowerCase()])&&(t=o.map(c=>"<"+c+">").join("")+t+o.map(c=>"</"+c+">").reverse().join("")),i.innerHTML=MNe(t),o)for(let c=0;c<o.length;c++)i=i.querySelector(o[c])||i;return i}function RNe(t){let e=t.querySelectorAll(ol?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<e.length;i++){let n=e[i];n.childNodes.length==1&&n.textContent=="Â "&&n.parentNode&&n.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),n)}}function jNe(t,e){if(!t.size)return t;let i=t.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return t}let{content:o,openStart:c,openEnd:f}=t;for(let r=n.length-2;r>=0;r-=2){let x=i.nodes[n[r]];if(!x||x.hasRequiredAttrs())break;o=Si.from(x.create(n[r+1],o)),c++,f++}return new pn(o,c,f)}const cc={},uc={},zNe={touchstart:!0,touchmove:!0};class LNe{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ONe(t){for(let e in cc){let i=cc[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=n=>{BNe(t,n)&&!iB(t,n)&&(t.editable||!(n.type in uc))&&i(t,n)},zNe[e]?{passive:!0}:void 0)}Il&&t.dom.addEventListener("input",()=>null),WO(t)}function Gm(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function FNe(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function WO(t){t.someProp("handleDOMEvents",e=>{for(let i in e)t.input.eventHandlers[i]||t.dom.addEventListener(i,t.input.eventHandlers[i]=n=>iB(t,n))})}function iB(t,e){return t.someProp("handleDOMEvents",i=>{let n=i[e.type];return n?n(t,e)||e.defaultPrevented:!1})}function BNe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target;i!=t.dom;i=i.parentNode)if(!i||i.nodeType==11||i.pmViewDesc&&i.pmViewDesc.stopEvent(e))return!1;return!0}function UNe(t,e){!iB(t,e)&&cc[e.type]&&(t.editable||!(e.type in uc))&&cc[e.type](t,e)}uc.keydown=(t,e)=>{let i=e;if(t.input.shiftKey=i.keyCode==16||i.shiftKey,!Wse(t,i)&&(t.input.lastKeyCode=i.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Kp&&ol&&i.keyCode==13)))if(i.keyCode!=229&&t.domObserver.forceFlush(),zb&&i.keyCode==13&&!i.ctrlKey&&!i.altKey&&!i.metaKey){let n=Date.now();t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",o=>o(t,Wy(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",n=>n(t,i))||kNe(t,i)?i.preventDefault():Gm(t,"key")};uc.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};uc.keypress=(t,e)=>{let i=e;if(Wse(t,i)||!i.charCode||i.ctrlKey&&!i.altKey||Iu&&i.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,i))){i.preventDefault();return}let n=t.state.selection;if(!(n instanceof br)||!n.$from.sameParent(n.$to)){let o=String.fromCharCode(i.charCode),c=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",f=>f(t,n.$from.pos,n.$to.pos,o,c))&&t.dispatch(c()),i.preventDefault()}};function DM(t){return{left:t.clientX,top:t.clientY}}function VNe(t,e){let i=e.x-t.clientX,n=e.y-t.clientY;return i*i+n*n<100}function nB(t,e,i,n,o){if(n==-1)return!1;let c=t.state.doc.resolve(n);for(let f=c.depth+1;f>0;f--)if(t.someProp(e,r=>f>c.depth?r(t,i,c.nodeAfter,c.before(f),o,!0):r(t,i,c.node(f),c.before(f),o,!1)))return!0;return!1}function M0(t,e,i){if(t.focused||t.focus(),t.state.selection.eq(e))return;let n=t.state.tr.setSelection(e);n.setMeta("pointer",!0),t.dispatch(n)}function $Ne(t,e){if(e==-1)return!1;let i=t.state.doc.resolve(e),n=i.nodeAfter;return n&&n.isAtom&&qn.isSelectable(n)?(M0(t,new qn(i)),!0):!1}function qNe(t,e){if(e==-1)return!1;let i=t.state.selection,n,o;i instanceof qn&&(n=i.node);let c=t.state.doc.resolve(e);for(let f=c.depth+1;f>0;f--){let r=f>c.depth?c.nodeAfter:c.node(f);if(qn.isSelectable(r)){n&&i.$from.depth>0&&f>=i.$from.depth&&c.before(i.$from.depth+1)==i.$from.pos?o=c.before(i.$from.depth):o=c.before(f);break}}return o!=null?(M0(t,qn.create(t.state.doc,o)),!0):!1}function HNe(t,e,i,n,o){return nB(t,"handleClickOn",e,i,n)||t.someProp("handleClick",c=>c(t,e,n))||(o?qNe(t,i):$Ne(t,i))}function GNe(t,e,i,n){return nB(t,"handleDoubleClickOn",e,i,n)||t.someProp("handleDoubleClick",o=>o(t,e,n))}function WNe(t,e,i,n){return nB(t,"handleTripleClickOn",e,i,n)||t.someProp("handleTripleClick",o=>o(t,e,n))||KNe(t,i,n)}function KNe(t,e,i){if(i.button!=0)return!1;let n=t.state.doc;if(e==-1)return n.inlineContent?(M0(t,br.create(n,0,n.content.size)),!0):!1;let o=n.resolve(e);for(let c=o.depth+1;c>0;c--){let f=c>o.depth?o.nodeAfter:o.node(c),r=o.before(c);if(f.inlineContent)M0(t,br.create(n,r+1,r+1+f.content.size));else if(qn.isSelectable(f))M0(t,qn.create(n,r));else continue;return!0}}function rB(t){return xP(t)}const Gse=Iu?"metaKey":"ctrlKey";cc.mousedown=(t,e)=>{let i=e;t.input.shiftKey=i.shiftKey;let n=rB(t),o=Date.now(),c="singleClick";o-t.input.lastClick.time<500&&VNe(i,t.input.lastClick)&&!i[Gse]&&t.input.lastClick.button==i.button&&(t.input.lastClick.type=="singleClick"?c="doubleClick":t.input.lastClick.type=="doubleClick"&&(c="tripleClick")),t.input.lastClick={time:o,x:i.clientX,y:i.clientY,type:c,button:i.button};let f=t.posAtCoords(DM(i));f&&(c=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new ZNe(t,f,i,!!n)):(c=="doubleClick"?GNe:WNe)(t,f.pos,f.inside,i)?i.preventDefault():Gm(t,"pointer"))};class ZNe{constructor(e,i,n,o){this.view=e,this.pos=i,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Gse],this.allowDefault=n.shiftKey;let c,f;if(i.inside>-1)c=e.state.doc.nodeAt(i.inside),f=i.inside;else{let C=e.state.doc.resolve(i.pos);c=C.parent,f=C.depth?C.before():0}const r=o?null:n.target,x=r?e.docView.nearestDesc(r,!0):null;this.target=x&&x.nodeDOM.nodeType==1?x.nodeDOM:null;let{selection:S}=e.state;(n.button==0&&c.type.spec.draggable&&c.type.spec.selectable!==!1||S instanceof qn&&S.from<=f&&S.to>f)&&(this.mightDrag={node:c,pos:f,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ou&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Gm(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qp(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let i=this.pos;this.view.state.doc!=this.startDoc&&(i=this.view.posAtCoords(DM(e))),this.updateAllowDefault(e),this.allowDefault||!i?Gm(this.view,"pointer"):HNe(this.view,i.pos,i.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Il&&this.mightDrag&&!this.mightDrag.node.isAtom||ol&&!this.view.state.selection.visible&&Math.min(Math.abs(i.pos-this.view.state.selection.from),Math.abs(i.pos-this.view.state.selection.to))<=2)?(M0(this.view,zr.near(this.view.state.doc.resolve(i.pos))),e.preventDefault()):Gm(this.view,"pointer")}move(e){this.updateAllowDefault(e),Gm(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}cc.touchstart=t=>{t.input.lastTouch=Date.now(),rB(t),Gm(t,"pointer")};cc.touchmove=t=>{t.input.lastTouch=Date.now(),Gm(t,"pointer")};cc.contextmenu=t=>rB(t);function Wse(t,e){return t.composing?!0:Il&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const XNe=Kp?5e3:-1;uc.compositionstart=uc.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,i=e.selection.$to;if(e.selection instanceof br&&(e.storedMarks||!i.textOffset&&i.parentOffset&&i.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||ol&&Tse&&YNe(t)))t.markCursor=t.state.storedMarks||i.marks(),xP(t,!0),t.markCursor=null;else if(xP(t,!e.selection.empty),Ou&&e.selection.empty&&i.parentOffset&&!i.textOffset&&i.nodeBefore.marks.length){let n=t.domSelectionRange();for(let o=n.focusNode,c=n.focusOffset;o&&o.nodeType==1&&c!=0;){let f=c<0?o.lastChild:o.childNodes[c-1];if(!f)break;
vendor: 5,605 bytes, line 3732
3732if(f.nodeType==3){let r=t.domSelection();r&&r.collapse(f,f.nodeValue.length);break}else o=f,c=-1}}t.input.composing=!0}Kse(t,XNe)};function YNe(t){let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(!e||e.nodeType!=1||i>=e.childNodes.length)return!1;let n=e.childNodes[i];return n.nodeType==1&&n.contentEditable=="false"}uc.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Kse(t,20))};function Kse(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>xP(t),e))}function Zse(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=JNe());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function QNe(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let i=qPe(e.focusNode,e.focusOffset),n=HPe(e.focusNode,e.focusOffset);if(i&&n&&i!=n){let o=n.pmViewDesc,c=t.domObserver.lastChangedTextNode;if(i==c||n==c)return c;if(!o||!o.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let f=i.pmViewDesc;if(!(!f||!f.isText(i.nodeValue)))return n}}return i||n}function JNe(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function xP(t,e=!1){if(!(Kp&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Zse(t),e||t.docView&&t.docView.dirty){let i=J4(t),n=t.state.selection;return i&&!i.eq(n)?t.dispatch(t.state.tr.setSelection(i)):(t.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function eMe(t,e){if(!t.dom.parentNode)return;let i=t.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(e),i.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),n.removeAllRanges(),n.addRange(o),setTimeout(()=>{i.parentNode&&i.parentNode.removeChild(i),t.focus()},50)}const wC=Fc&&ag<15||zb&&ZPe<604;cc.copy=uc.cut=(t,e)=>{let i=e,n=t.state.selection,o=i.type=="cut";if(n.empty)return;let c=wC?null:i.clipboardData,f=n.content(),{dom:r,text:x}=tB(t,f);c?(i.preventDefault(),c.clearData(),c.setData("text/html",r.innerHTML),c.setData("text/plain",x)):eMe(t,r),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tMe(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function iMe(t,e){if(!t.dom.parentNode)return;let i=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),i?SC(t,n.value,null,o,e):SC(t,n.textContent,n.innerHTML,o,e)},50)}function SC(t,e,i,n,o){let c=Bse(t,e,i,n,t.state.selection.$from);if(t.someProp("handlePaste",x=>x(t,o,c||pn.empty)))return!0;if(!c)return!1;let f=tMe(c),r=f?t.state.tr.replaceSelectionWith(f,n):t.state.tr.replaceSelection(c);return t.dispatch(r.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xse(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let i=t.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):""}uc.paste=(t,e)=>{let i=e;if(t.composing&&!Kp)return;let n=wC?null:i.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;n&&SC(t,Xse(n),n.getData("text/html"),o,i)?i.preventDefault():iMe(t,i)};class Yse{constructor(e,i,n){this.slice=e,this.move=i,this.node=n}}const nMe=Iu?"altKey":"ctrlKey";function Qse(t,e){let i=t.someProp("dragCopies",n=>!n(e));return i??!e[nMe]}cc.dragstart=(t,e)=>{let i=e,n=t.input.mouseDown;if(n&&n.done(),!i.dataTransfer)return;let o=t.state.selection,c=o.empty?null:t.posAtCoords(DM(i)),f;if(!(c&&c.pos>=o.from&&c.pos<=(o instanceof qn?o.to-1:o.to))){if(n&&n.mightDrag)f=qn.create(t.state.doc,n.mightDrag.pos);else if(i.target&&i.target.nodeType==1){let I=t.docView.nearestDesc(i.target,!0);I&&I.node.type.spec.draggable&&I!=t.docView&&(f=qn.create(t.state.doc,I.posBefore))}}let r=(f||t.state.selection).content(),{dom:x,text:S,slice:C}=tB(t,r);(!i.dataTransfer.files.length||!ol||Sse>120)&&i.dataTransfer.clearData(),i.dataTransfer.setData(wC?"Text":"text/html",x.innerHTML),i.dataTransfer.effectAllowed="copyMove",wC||i.dataTransfer.setData("text/plain",S),t.dragging=new Yse(C,Qse(t,i),f)};cc.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};uc.dragover=uc.dragenter=(t,e)=>e.preventDefault();uc.drop=(t,e)=>{try{rMe(t,e,t.dragging)}finally{t.dragging=null}};function rMe(t,e,i){if(!e.dataTransfer)return;let n=t.posAtCoords(DM(e));if(!n)return;let o=t.state.doc.resolve(n.pos),c=i&&i.slice;c?t.someProp("transformPasted",D=>{c=D(c,t,!1)}):c=Bse(t,Xse(e.dataTransfer),wC?null:e.dataTransfer.getData("text/html"),!1,o);let f=!!(i&&Qse(t,e));if(t.someProp("handleDrop",D=>D(t,e,c||pn.empty,f))){e.preventDefault();return}if(!c)return;e.preventDefault();let r=c?lse(t.state.doc,o.pos,c):o.pos;r==null&&(r=o.pos);let x=t.state.tr;if(f){let{node:D}=i;D?D.replace(x):x.deleteSelection()}let S=x.mapping.map(r),C=c.openStart==0&&c.openEnd==0&&c.content.childCount==1,I=x.doc;
vendor: 7,198 bytes, line 3732
3732if(C?x.replaceRangeWith(S,S,c.content.firstChild):x.replaceRange(S,S,c),x.doc.eq(I))return;let N=x.doc.resolve(S);if(C&&qn.isSelectable(c.content.firstChild)&&N.nodeAfter&&N.nodeAfter.sameMarkup(c.content.firstChild))x.setSelection(new qn(N));else{let D=x.mapping.map(r);x.mapping.maps[x.mapping.maps.length-1].forEach((V,B,W,$)=>D=$),x.setSelection(eB(t,N,x.doc.resolve(D)))}t.focus(),t.dispatch(x.setMeta("uiEvent","drop"))}cc.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Qp(t)},20))};cc.blur=(t,e)=>{let i=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),i.relatedTarget&&t.dom.contains(i.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};cc.beforeinput=(t,e)=>{if(ol&&Kp&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",c=>c(t,Wy(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in uc)cc[t]=uc[t];function TC(t,e){if(t==e)return!0;for(let i in t)if(t[i]!==e[i])return!1;for(let i in e)if(!(i in t))return!1;return!0}class bP{constructor(e,i){this.toDOM=e,this.spec=i||P_,this.side=this.spec.side||0}map(e,i,n,o){let{pos:c,deleted:f}=e.mapResult(i.from+o,this.side<0?-1:1);return f?null:new nc(c-n,c-n,this)}valid(){return!0}eq(e){return this==e||e instanceof bP&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&TC(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class cg{constructor(e,i){this.attrs=e,this.spec=i||P_}map(e,i,n,o){let c=e.map(i.from+o,this.spec.inclusiveStart?-1:1)-n,f=e.map(i.to+o,this.spec.inclusiveEnd?1:-1)-n;return c>=f?null:new nc(c,f,this)}valid(e,i){return i.from<i.to}eq(e){return this==e||e instanceof cg&&TC(this.attrs,e.attrs)&&TC(this.spec,e.spec)}static is(e){return e.type instanceof cg}destroy(){}}class sB{constructor(e,i){this.attrs=e,this.spec=i||P_}map(e,i,n,o){let c=e.mapResult(i.from+o,1);if(c.deleted)return null;let f=e.mapResult(i.to+o,-1);return f.deleted||f.pos<=c.pos?null:new nc(c.pos-n,f.pos-n,this)}valid(e,i){let{index:n,offset:o}=e.content.findIndex(i.from),c;return o==i.from&&!(c=e.child(n)).isText&&o+c.nodeSize==i.to}eq(e){return this==e||e instanceof sB&&TC(this.attrs,e.attrs)&&TC(this.spec,e.spec)}destroy(){}}class nc{constructor(e,i,n){this.from=e,this.to=i,this.type=n}copy(e,i){return new nc(e,i,this.type)}eq(e,i=0){return this.type.eq(e.type)&&this.from+i==e.from&&this.to+i==e.to}map(e,i,n){return this.type.map(e,this,i,n)}static widget(e,i,n){return new nc(e,e,new bP(i,n))}static inline(e,i,n,o){return new nc(e,i,new cg(n,o))}static node(e,i,n,o){return new nc(e,i,new sB(n,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof cg}get widget(){return this.type instanceof bP}}const e0=[],P_={};class Co{constructor(e,i){this.local=e.length?e:e0,this.children=i.length?i:e0}static create(e,i){return i.length?wP(i,e,0,P_):wl}find(e,i,n){let o=[];return this.findInner(e??0,i??1e9,o,0,n),o}findInner(e,i,n,o,c){for(let f=0;f<this.local.length;f++){let r=this.local[f];r.from<=i&&r.to>=e&&(!c||c(r.spec))&&n.push(r.copy(r.from+o,r.to+o))}for(let f=0;f<this.children.length;f+=3)if(this.children[f]<i&&this.children[f+1]>e){let r=this.children[f]+1;this.children[f+2].findInner(e-r,i-r,n,o+r,c)}}map(e,i,n){return this==wl||e.maps.length==0?this:this.mapInner(e,i,0,0,n||P_)}mapInner(e,i,n,o,c){let f;for(let r=0;r<this.local.length;r++){let x=this.local[r].map(e,n,o);x&&x.type.valid(i,x)?(f||(f=[])).push(x):c.onRemove&&c.onRemove(this.local[r].spec)}return this.children.length?sMe(this.children,f||[],e,i,n,o,c):f?new Co(f.sort(N_),e0):wl}add(e,i){return i.length?this==wl?Co.create(e,i):this.addInner(e,i,0):this}addInner(e,i,n){let o,c=0;e.forEach((r,x)=>{let S=x+n,C;if(C=eoe(i,r,S)){for(o||(o=this.children.slice());c<o.length&&o[c]<x;)c+=3;o[c]==x?o[c+2]=o[c+2].addInner(r,C,S+1):o.splice(c,0,x,x+r.nodeSize,wP(C,r,S+1,P_)),c+=3}});let f=Jse(c?toe(i):i,-n);for(let r=0;r<f.length;r++)f[r].type.valid(e,f[r])||f.splice(r--,1);return new Co(f.length?this.local.concat(f).sort(N_):this.local,o||this.children)}remove(e){return e.length==0||this==wl?this:this.removeInner(e,0)}removeInner(e,i){let n=this.children,o=this.local;for(let c=0;c<n.length;c+=3){let f,r=n[c]+i,x=n[c+1]+i;for(let C=0,I;C<e.length;C++)(I=e[C])&&I.from>r&&I.to<x&&(e[C]=null,(f||(f=[])).push(I));if(!f)continue;n==this.children&&(n=this.children.slice());let S=n[c+2].removeInner(f,r+1);S!=wl?n[c+2]=S:(n.splice(c,3),c-=3)}if(o.length){for(let c=0,f;c<e.length;c++)if(f=e[c])for(let r=0;r<o.length;r++)o[r].eq(f,i)&&(o==this.local&&(o=this.local.slice()),o.splice(r--,1))}return n==this.children&&o==this.local?this:o.length||n.length?new Co(o,n):wl}forChild(e,i){if(this==wl)return this;if(i.isLeaf)return Co.empty;let n,o;for(let r=0;r<this.children.length;r+=3)if(this.children[r]>=e){this.children[r]==e&&(n=this.children[r+2]);break}let c=e+1,f=c+i.content.size;for(let r=0;r<this.local.length;r++){let x=this.local[r];if(x.from<f&&x.to>c&&x.type instanceof cg){let S=Math.max(c,x.from)-c,C=Math.min(f,x.to)-c;S<C&&(o||(o=[])).push(x.copy(S,C))}}if(o){let r=new Co(o.sort(N_),e0);return n?new Am([r,n]):r}return n||wl}eq(e){if(this==e)return!0;if(!(e instanceof Co)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let i=0;i<this.local.length;i++)if(!this.local[i].eq(e.local[i]))return!1;for(let i=0;i<this.children.length;i+=3)if(this.children[i]!=e.children[i]||this.children[i+1]!=e.children[i+1]||!this.children[i+2].eq(e.children[i+2]))return!1;return!0}locals(e){return oB(this.localsInner(e))}localsInner(e){if(this==wl)return e0;if(e.inlineContent||!this.local.some(cg.is))return this.local;let i=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof cg||i.push(this.local[n]);return i}forEachSet(e){e(this)}}Co.empty=new Co([],[]);Co.removeOverlap=oB;const wl=Co.empty;class Am{constructor(e){this.members=e}map(e,i){const n=this.members.map(o=>o.map(e,i,P_));return Am.from(n)}forChild(e,i){if(i.isLeaf)return Co.empty;let n=[];for(let o=0;o<this.members.length;o++){let c=this.members[o].forChild(e,i);c!=wl&&(c instanceof Am?n=n.concat(c.members):n.push(c))}return Am.from(n)}eq(e){if(!(e instanceof Am)||e.members.length!=this.members.length)return!1;for(let i=0;i<this.members.length;i++)if(!this.members[i].eq(e.members[i]))return!1;return!0}locals(e){let i,n=!0;for(let o=0;o<this.members.length;o++){let c=this.members[o].localsInner(e);if(c.length)if(!i)i=c;else{n&&(i=i.slice(),n=!1);for(let f=0;f<c.length;f++)i.push(c[f])}}return i?oB(n?i:i.sort(N_)):e0}static from(e){switch(e.length){case 0:return wl;case 1:return e[0];default:return new Am(e.every(i=>i instanceof Co)?e:e.reduce((i,n)=>i.concat(n instanceof Co?n:n.members),[]))}}forEachSet(e){for(let i=0;i<this.members.length;
vendor: 11,100 bytes, line 3732
3732i++)this.members[i].forEachSet(e)}}function sMe(t,e,i,n,o,c,f){let r=t.slice();for(let S=0,C=c;S<i.maps.length;S++){let I=0;i.maps[S].forEach((N,D,V,B)=>{let W=B-V-(D-N);for(let $=0;$<r.length;$+=3){let G=r[$+1];if(G<0||N>G+C-I)continue;let te=r[$]+C-I;D>=te?r[$+1]=N<=te?-2:-1:N>=C&&W&&(r[$]+=W,r[$+1]+=W)}I+=W}),C=i.maps[S].map(C,-1)}let x=!1;for(let S=0;S<r.length;S+=3)if(r[S+1]<0){if(r[S+1]==-2){x=!0,r[S+1]=-1;continue}let C=i.map(t[S]+c),I=C-o;if(I<0||I>=n.content.size){x=!0;continue}let N=i.map(t[S+1]+c,-1),D=N-o,{index:V,offset:B}=n.content.findIndex(I),W=n.maybeChild(V);if(W&&B==I&&B+W.nodeSize==D){let $=r[S+2].mapInner(i,W,C+1,t[S]+c+1,f);$!=wl?(r[S]=I,r[S+1]=D,r[S+2]=$):(r[S+1]=-2,x=!0)}else x=!0}if(x){let S=oMe(r,t,e,i,o,c,f),C=wP(S,n,0,f);e=C.local;for(let I=0;I<r.length;I+=3)r[I+1]<0&&(r.splice(I,3),I-=3);for(let I=0,N=0;I<C.children.length;I+=3){let D=C.children[I];for(;N<r.length&&r[N]<D;)N+=3;r.splice(N,0,C.children[I],C.children[I+1],C.children[I+2])}}return new Co(e.sort(N_),r)}function Jse(t,e){if(!e||!t.length)return t;let i=[];for(let n=0;n<t.length;n++){let o=t[n];i.push(new nc(o.from+e,o.to+e,o.type))}return i}function oMe(t,e,i,n,o,c,f){function r(x,S){for(let C=0;C<x.local.length;C++){let I=x.local[C].map(n,o,S);I?i.push(I):f.onRemove&&f.onRemove(x.local[C].spec)}for(let C=0;C<x.children.length;C+=3)r(x.children[C+2],x.children[C]+S+1)}for(let x=0;x<t.length;x+=3)t[x+1]==-1&&r(t[x+2],e[x]+c+1);return i}function eoe(t,e,i){if(e.isLeaf)return null;let n=i+e.nodeSize,o=null;for(let c=0,f;c<t.length;c++)(f=t[c])&&f.from>i&&f.to<n&&((o||(o=[])).push(f),t[c]=null);return o}function toe(t){let e=[];for(let i=0;i<t.length;i++)t[i]!=null&&e.push(t[i]);return e}function wP(t,e,i,n){let o=[],c=!1;e.forEach((r,x)=>{let S=eoe(t,r,x+i);if(S){c=!0;let C=wP(S,r,i+x+1,n);C!=wl&&o.push(x,x+r.nodeSize,C)}});let f=Jse(c?toe(t):t,-i).sort(N_);for(let r=0;r<f.length;r++)f[r].type.valid(e,f[r])||(n.onRemove&&n.onRemove(f[r].spec),f.splice(r--,1));return f.length||o.length?new Co(f,o):wl}function N_(t,e){return t.from-e.from||t.to-e.to}function oB(t){let e=t;for(let i=0;i<e.length-1;i++){let n=e[i];if(n.from!=n.to)for(let o=i+1;o<e.length;o++){let c=e[o];if(c.from==n.from){c.to!=n.to&&(e==t&&(e=t.slice()),e[o]=c.copy(c.from,n.to),qH(e,o+1,c.copy(n.to,c.to)));continue}else{c.from<n.to&&(e==t&&(e=t.slice()),e[i]=n.copy(n.from,c.from),qH(e,o,n.copy(c.from,n.to)));break}}}return e}function qH(t,e,i){for(;e<t.length&&N_(i,t[e])>0;)e++;t.splice(e,0,i)}function uz(t){let e=[];return t.someProp("decorations",i=>{let n=i(t.state);n&&n!=wl&&e.push(n)}),t.cursorWrapper&&e.push(Co.create(t.state.doc,[t.cursorWrapper.deco])),Am.from(e)}const aMe={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lMe=Fc&&ag<=11;class cMe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class uMe{constructor(e,i){this.view=e,this.handleDOMChange=i,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cMe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let o=0;o<n.length;o++)this.queue.push(n[o]);Fc&&ag<=11&&n.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():Il&&e.composing&&n.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lMe&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,aMe)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let i=0;i<e.length;i++)this.queue.push(e[i]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(zH(this.view)){if(this.suppressingSelectionUpdates)return Qp(this.view);if(Fc&&ag<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&J_(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let i=new Set,n;for(let c=e.focusNode;c;c=jb(c))i.add(c);for(let c=e.anchorNode;c;c=jb(c))if(i.has(c)){n=c;break}let o=n&&this.view.docView.nearestDesc(n);if(o&&o.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let i=this.pendingRecords();i.length&&(this.queue=[]);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&zH(e)&&!this.ignoreSelectionChange(n),c=-1,f=-1,r=!1,x=[];if(e.editable)for(let C=0;C<i.length;C++){let I=this.registerMutation(i[C],x);I&&(c=c<0?I.from:Math.min(I.from,c),f=f<0?I.to:Math.max(I.to,f),I.typeOver&&(r=!0))}if(x.some(C=>C.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let C of x)if(C.nodeName=="BR"&&C.parentNode){let I=C.nextSibling;I&&I.nodeType==1&&I.contentEditable=="false"&&C.parentNode.removeChild(C)}}else if(Ou&&x.length){let C=x.filter(I=>I.nodeName=="BR");if(C.length==2){let[I,N]=C;I.parentNode&&I.parentNode.parentNode==N.parentNode?N.remove():I.remove()}else{let{focusNode:I}=this.currentSelection;for(let N of C){let D=N.parentNode;D&&D.nodeName=="LI"&&(!I||pMe(e,I)!=D)&&N.remove()}}}let S=null;c<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&NM(n)&&(S=J4(e))&&S.eq(zr.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Qp(e),this.currentSelection.set(n),e.scrollToSelection()):(c>-1||o)&&(c>-1&&(e.docView.markDirty(c,f),dMe(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,fMe(e,x)),this.handleDOMChange(c,f,r,x),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Qp(e),this.currentSelection.set(n))}registerMutation(e,i){if(i.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let C=0;C<e.addedNodes.length;C++){let I=e.addedNodes[C];i.push(I),I.nodeType==3&&(this.lastChangedTextNode=I)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let o=e.previousSibling,c=e.nextSibling;if(Fc&&ag<=11&&e.addedNodes.length)for(let C=0;C<e.addedNodes.length;C++){let{previousSibling:I,nextSibling:N}=e.addedNodes[C];(!I||Array.prototype.indexOf.call(e.addedNodes,I)<0)&&(o=I),(!N||Array.prototype.indexOf.call(e.addedNodes,N)<0)&&(c=N)}let f=o&&o.parentNode==e.target?rl(o)+1:0,r=n.localPosFromDOM(e.target,f,-1),x=c&&c.parentNode==e.target?rl(c):e.target.childNodes.length,S=n.localPosFromDOM(e.target,x,1);return{from:r,to:S}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let HH=new WeakMap,GH=!1;function dMe(t){if(!HH.has(t)&&(HH.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ou,GH)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),GH=!0}}function WH(t,e){let i=e.startContainer,n=e.startOffset,o=e.endContainer,c=e.endOffset,f=t.domAtPos(t.state.selection.anchor);return J_(f.node,f.offset,o,c)&&([i,n,o,c]=[o,c,i,n]),{anchorNode:i,anchorOffset:n,focusNode:o,focusOffset:c}}function hMe(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return WH(t,o)}let i;function n(o){o.preventDefault(),o.stopImmediatePropagation(),i=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0),i?WH(t,i):null}function pMe(t,e){for(let i=e.parentNode;i&&i!=t.dom;i=i.parentNode){let n=t.docView.nearestDesc(i,!0);if(n&&n.node.isBlock)return i}return null}function fMe(t,e){var i;let{focusNode:n,focusOffset:o}=t.domSelectionRange();for(let c of e)if(((i=c.parentNode)===null||i===void 0?void 0:i.nodeName)=="TR"){let f=c.nextSibling;for(;f&&f.nodeName!="TD"&&f.nodeName!="TH";)f=f.nextSibling;if(f){let r=f;for(;;){let x=r.firstChild;if(!x||x.nodeType!=1||x.contentEditable=="false"||/^(BR|IMG)$/.test(x.nodeName))break;r=x}r.insertBefore(c,r.firstChild),n==c&&t.domSelection().collapse(c,o)}else c.parentNode.removeChild(c)}}function mMe(t,e,i){let{node:n,fromOffset:o,toOffset:c,from:f,to:r}=t.docView.parseRange(e,i),x=t.domSelectionRange(),S,C=x.anchorNode;if(C&&t.dom.contains(C.nodeType==1?C:C.parentNode)&&(S=[{node:C,offset:x.anchorOffset}],NM(x)||S.push({node:x.focusNode,offset:x.focusOffset})),ol&&t.input.lastKeyCode===8)for(let W=c;W>o;W--){let $=n.childNodes[W-1],G=$.pmViewDesc;if($.nodeName=="BR"&&!G){c=W;break}if(!G||G.size)break}let I=t.state.doc,N=t.someProp("domParser")||og.fromSchema(t.state.schema),D=I.resolve(f),V=null,B=N.parse(n,{topNode:D.parent,topMatch:D.parent.contentMatchAt(D.index()),topOpen:!0,from:o,to:c,preserveWhitespace:D.parent.type.whitespace=="pre"?"full":!0,findPositions:S,ruleFromNode:gMe,context:D});if(S&&S[0].pos!=null){let W=S[0].pos,$=S[1]&&S[1].pos;$==null&&($=W),V={anchor:W+f,head:$+f}}return{doc:B,sel:V,from:f,to:r}}function gMe(t){let e=t.pmViewDesc;if(e)return e.parseRule();
vendor: 4,469 bytes, line 3732
3732if(t.nodeName=="BR"&&t.parentNode){if(Il&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let i=document.createElement("div");return i.appendChild(document.createElement("li")),{skip:i}}else if(t.parentNode.lastChild==t||Il&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const yMe=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function _Me(t,e,i,n,o){let c=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let we=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,Ne=J4(t,we);if(Ne&&!t.state.selection.eq(Ne)){if(ol&&Kp&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",Pe=>Pe(t,Wy(13,"Enter"))))return;let pe=t.state.tr.setSelection(Ne);we=="pointer"?pe.setMeta("pointer",!0):we=="key"&&pe.scrollIntoView(),c&&pe.setMeta("composition",c),t.dispatch(pe)}return}let f=t.state.doc.resolve(e),r=f.sharedDepth(i);e=f.before(r+1),i=t.state.doc.resolve(i).after(r+1);let x=t.state.selection,S=mMe(t,e,i),C=t.state.doc,I=C.slice(S.from,S.to),N,D;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(N=t.state.selection.to,D="end"):(N=t.state.selection.from,D="start"),t.input.lastKeyCode=null;let V=bMe(I.content,S.doc.content,S.from,N,D);if(V&&t.input.domChangeCount++,(zb&&t.input.lastIOSEnter>Date.now()-225||Kp)&&o.some(we=>we.nodeType==1&&!yMe.test(we.nodeName))&&(!V||V.endA>=V.endB)&&t.someProp("handleKeyDown",we=>we(t,Wy(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!V)if(n&&x instanceof br&&!x.empty&&x.$head.sameParent(x.$anchor)&&!t.composing&&!(S.sel&&S.sel.anchor!=S.sel.head))V={start:x.from,endA:x.to,endB:x.to};else{if(S.sel){let we=KH(t,t.state.doc,S.sel);if(we&&!we.eq(t.state.selection)){let Ne=t.state.tr.setSelection(we);c&&Ne.setMeta("composition",c),t.dispatch(Ne)}}return}t.state.selection.from<t.state.selection.to&&V.start==V.endB&&t.state.selection instanceof br&&(V.start>t.state.selection.from&&V.start<=t.state.selection.from+2&&t.state.selection.from>=S.from?V.start=t.state.selection.from:V.endA<t.state.selection.to&&V.endA>=t.state.selection.to-2&&t.state.selection.to<=S.to&&(V.endB+=t.state.selection.to-V.endA,V.endA=t.state.selection.to)),Fc&&ag<=11&&V.endB==V.start+1&&V.endA==V.start&&V.start>S.from&&S.doc.textBetween(V.start-S.from-1,V.start-S.from+1)==" Â "&&(V.start--,V.endA--,V.endB--);let B=S.doc.resolveNoCache(V.start-S.from),W=S.doc.resolveNoCache(V.endB-S.from),$=C.resolve(V.start),G=B.sameParent(W)&&B.parent.inlineContent&&$.end()>=V.endA;if((zb&&t.input.lastIOSEnter>Date.now()-225&&(!G||o.some(we=>we.nodeName=="DIV"||we.nodeName=="P"))||!G&&B.pos<S.doc.content.size&&(!B.sameParent(W)||!B.parent.inlineContent)&&B.pos<W.pos&&!/\S/.test(S.doc.textBetween(B.pos,W.pos,"","")))&&t.someProp("handleKeyDown",we=>we(t,Wy(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>V.start&&xMe(C,V.start,V.endA,B,W)&&t.someProp("handleKeyDown",we=>we(t,Wy(8,"Backspace")))){Kp&&ol&&t.domObserver.suppressSelectionUpdates();return}ol&&V.endB==V.start&&(t.input.lastChromeDelete=Date.now()),Kp&&!G&&B.start()!=W.start()&&W.parentOffset==0&&B.depth==W.depth&&S.sel&&S.sel.anchor==S.sel.head&&S.sel.head==V.endA&&(V.endB-=2,W=S.doc.resolveNoCache(V.endB-S.from),setTimeout(()=>{t.someProp("handleKeyDown",function(we){return we(t,Wy(13,"Enter"))})},20));let te=V.start,ce=V.endA,_e=we=>{let Ne=we||t.state.tr.replace(te,ce,S.doc.slice(V.start-S.from,V.endB-S.from));if(S.sel){let pe=KH(t,Ne.doc,S.sel);pe&&!(ol&&t.composing&&pe.empty&&(V.start!=V.endB||t.input.lastChromeDelete<Date.now()-100)&&(pe.head==te||pe.head==Ne.mapping.map(ce)-1)||Fc&&pe.empty&&pe.head==te)&&Ne.setSelection(pe)}return c&&Ne.setMeta("composition",c),Ne.scrollIntoView()},Te;if(G)if(B.pos==W.pos){Fc&&ag<=11&&B.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Qp(t),20));let we=_e(t.state.tr.delete(te,ce)),Ne=C.resolve(V.start).marksAcross(C.resolve(V.endA));Ne&&we.ensureMarks(Ne),t.dispatch(we)}else if(V.endA==V.endB&&(Te=vMe(B.parent.content.cut(B.parentOffset,W.parentOffset),$.parent.content.cut($.parentOffset,V.endA-$.start())))){let we=_e(t.state.tr);Te.type=="add"?we.addMark(te,ce,Te.mark):we.removeMark(te,ce,Te.mark),t.dis
vendor: 12,842 bytes, line 3732
3732patch(we)}else if(B.parent.child(B.index()).isText&&B.index()==W.index()-(W.textOffset?0:1)){let we=B.parent.textBetween(B.parentOffset,W.parentOffset),Ne=()=>_e(t.state.tr.insertText(we,te,ce));t.someProp("handleTextInput",pe=>pe(t,te,ce,we,Ne))||t.dispatch(Ne())}else t.dispatch(_e());else t.dispatch(_e())}function KH(t,e,i){return Math.max(i.anchor,i.head)>e.content.size?null:eB(t,e.resolve(i.anchor),e.resolve(i.head))}function vMe(t,e){let i=t.firstChild.marks,n=e.firstChild.marks,o=i,c=n,f,r,x;for(let C=0;C<n.length;C++)o=n[C].removeFromSet(o);for(let C=0;C<i.length;C++)c=i[C].removeFromSet(c);if(o.length==1&&c.length==0)r=o[0],f="add",x=C=>C.mark(r.addToSet(C.marks));else if(o.length==0&&c.length==1)r=c[0],f="remove",x=C=>C.mark(r.removeFromSet(C.marks));else return null;let S=[];for(let C=0;C<e.childCount;C++)S.push(x(e.child(C)));if(Si.from(S).eq(t))return{mark:r,type:f}}function xMe(t,e,i,n,o){if(i-e<=o.pos-n.pos||dz(n,!0,!1)<o.pos)return!1;let c=t.resolve(e);if(!n.parent.isTextblock){let r=c.nodeAfter;return r!=null&&i==e+r.nodeSize}if(c.parentOffset<c.parent.content.size||!c.parent.isTextblock)return!1;let f=t.resolve(dz(c,!0,!0));return!f.parent.isTextblock||f.pos>i||dz(f,!0,!1)<i?!1:n.parent.content.cut(n.parentOffset).eq(f.parent.content)}function dz(t,e,i){let n=t.depth,o=e?t.end():t.pos;for(;n>0&&(e||t.indexAfter(n)==t.node(n).childCount);)n--,o++,e=!1;if(i){let c=t.node(n).maybeChild(t.indexAfter(n));for(;c&&!c.isLeaf;)c=c.firstChild,o++}return o}function bMe(t,e,i,n,o){let c=t.findDiffStart(e,i);if(c==null)return null;let{a:f,b:r}=t.findDiffEnd(e,i+t.size,i+e.size);if(o=="end"){let x=Math.max(0,c-Math.min(f,r));n-=f+x-c}if(f<c&&t.size<e.size){let x=n<=c&&n>=f?c-n:0;c-=x,c&&c<e.size&&ZH(e.textBetween(c-1,c+1))&&(c+=x?1:-1),r=c+(r-f),f=c}else if(r<c){let x=n<=c&&n>=r?c-n:0;c-=x,c&&c<t.size&&ZH(t.textBetween(c-1,c+1))&&(c+=x?1:-1),f=c+(f-r),r=c}return{start:c,endA:f,endB:r}}function ZH(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),i=t.charCodeAt(1);return e>=56320&&e<=57343&&i>=55296&&i<=56319}class ioe{constructor(e,i){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new LNe,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=i,this.state=i.state,this.directPlugins=i.plugins||[],this.directPlugins.forEach(eG),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=QH(this),YH(this),this.nodeViews=JH(this),this.docView=PH(this.state.doc,XH(this),uz(this),this.dom,this),this.domObserver=new uMe(this,(n,o,c,f)=>_Me(this,n,o,c,f)),this.domObserver.start(),ONe(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let i in e)this._props[i]=e[i];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&WO(this);let i=this._props;this._props=e,e.plugins&&(e.plugins.forEach(eG),this.directPlugins=e.plugins),this.updateStateInner(e.state,i)}setProps(e){let i={};for(let n in this._props)i[n]=this._props[n];i.state=this.state;for(let n in e)i[n]=e[n];this.update(i)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,i){var n;let o=this.state,c=!1,f=!1;e.storedMarks&&this.composing&&(Zse(this),f=!0),this.state=e;let r=o.plugins!=e.plugins||this._props.plugins!=i.plugins;if(r||this._props.plugins!=i.plugins||this._props.nodeViews!=i.nodeViews){let D=JH(this);SMe(D,this.nodeViews)&&(this.nodeViews=D,c=!0)}(r||i.handleDOMEvents!=this._props.handleDOMEvents)&&WO(this),this.editable=QH(this),YH(this);let x=uz(this),S=XH(this),C=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",I=c||!this.docView.matchesNode(e.doc,S,x);(I||!e.selection.eq(o.selection))&&(f=!0);let N=C=="preserve"&&f&&this.dom.style.overflowAnchor==null&&QPe(this);if(f){this.domObserver.stop();let D=I&&(Fc||ol)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&wMe(o.selection,e.selection);if(I){let V=ol?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=QNe(this)),(c||!this.docView.update(e.doc,S,x,this))&&(this.docView.updateOuterDeco(S),this.docView.destroy(),this.docView=PH(e.doc,S,x,this.dom,this)),V&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(D=!0)}D||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wNe(this))?Qp(this,D):(Lse(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((n=this.dragging)===null||n===void 0)&&n.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),C=="reset"?this.dom.scrollTop=0:C=="to selection"?this.scrollToSelection():N&&JPe(N)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",i=>i(this)))if(this.state.selection instanceof qn){let i=this.docView.domAfterPos(this.state.selection.from);i.nodeType==1&&TH(this,i.getBoundingClientRect(),e)}else TH(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let i=0;i<this.directPlugins.length;i++){let n=this.directPlugins[i];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let i=0;i<this.state.plugins.length;i++){let n=this.state.plugins[i];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let i=0;i<this.pluginViews.length;i++){let n=this.pluginViews[i];n.update&&n.update(this,e)}}updateDraggedNode(e,i){let n=e.node,o=-1;if(this.state.doc.nodeAt(n.from)==n.node)o=n.from;else{let c=n.from+(this.state.doc.content.size-i.doc.content.size);(c>0&&this.state.doc.nodeAt(c))==n.node&&(o=c)}this.dragging=new Yse(e.slice,e.move,o<0?void 0:qn.create(this.state.doc,o))}someProp(e,i){let n=this._props&&this._props[e],o;if(n!=null&&(o=i?i(n):n))return o;for(let f=0;f<this.directPlugins.length;f++){let r=this.directPlugins[f].props[e];if(r!=null&&(o=i?i(r):r))return o}let c=this.state.plugins;if(c)for(let f=0;f<c.length;f++){let r=c[f].props[e];if(r!=null&&(o=i?i(r):r))return o}}hasFocus(){if(Fc){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&eNe(this.dom),Qp(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let i=this.dom.parentNode;i;i=i.parentNode)if(i.nodeType==9||i.nodeType==11&&i.host)return i.getSelection||(Object.getPrototypeOf(i).getSelection=()=>i.ownerDocument.getSelection()),this._root=i}return e||document}updateRoot(){this._root=null}posAtCoords(e){return sNe(this,e)}coordsAtPos(e,i=1){return kse(this,e,i)}domAtPos(e,i=0){return this.docView.domFromPos(e,i)}nodeDOM(e){let i=this.docView.descAt(e);return i?i.nodeDOM:null}posAtDOM(e,i,n=-1){let o=this.docView.posFromDOM(e,i,n);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,i){return uNe(this,i||this.state,e)}pasteHTML(e,i){return SC(this,"",e,!1,i||new ClipboardEvent("paste"))}pasteText(e,i){return SC(this,e,null,!0,i||new ClipboardEvent("paste"))}serializeForClipboard(e){return tB(this,e)}destroy(){this.docView&&(FNe(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],uz(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,VPe())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return UNe(this,e)}domSelectionRange(){let e=this.domSelection();return e?Il&&this.root.nodeType===11&&WPe(this.dom.ownerDocument)==this.dom&&hMe(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ioe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function XH(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",i=>{if(typeof i=="function"&&(i=i(t.state)),i)for(let n in i)n=="class"?e.class+=" "+i[n]:n=="style"?e.style=(e.style?e.style+";":"")+i[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(i[n]))}),e.translate||(e.translate="no"),[nc.node(0,t.state.doc.content.size,e)]}function YH(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:nc.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function QH(t){return!t.someProp("editable",e=>e(t.state)===!1)}function wMe(t,e){let i=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(i)!=e.$anchor.start(i)}function JH(t){let e=Object.create(null);function i(n){for(let o in n)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=n[o])}return t.someProp("nodeViews",i),t.someProp("markViews",i),e}function SMe(t,e){let i=0,n=0;for(let o in t){if(t[o]!=e[o])return!0;i++}for(let o in e)n++;return i!=n}function eG(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Cg={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},SP={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TMe=typeof navigator<"u"&&/Mac/.test(navigator.platform),CMe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var sl=0;sl<10;sl++)Cg[48+sl]=Cg[96+sl]=String(sl);for(var sl=1;sl<=24;sl++)Cg[sl+111]="F"+sl;for(var sl=65;sl<=90;sl++)Cg[sl]=String.fromCharCode(sl+32),SP[sl]=String.fromCharCode(sl);for(var hz in Cg)SP.hasOwnProperty(hz)||(SP[hz]=Cg[hz]);function EMe(t){var e=TMe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||CMe&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?SP:Cg)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}const AMe=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),IMe=typeof navigator<"u"&&/Win/.test(navigator.platform);function kMe(t){let e=t.split(/-(?!$)/),i=e[e.length-1];i=="Space"&&(i=" ");let n,o,c,f;for(let r=0;r<e.length-1;r++){let x=e[r];if(/^(cmd|meta|m)$/i.test(x))f=!0;else if(/^a(lt)?$/i.test(x))n=!0;else if(/^(c|ctrl|control)$/i.test(x))o=!0;else if(/^s(hift)?$/i.test(x))c=!0;else if(/^mod$/i.test(x))AMe?f=!0:o=!0;else throw new Error("Unrecognized modifier name: "+x)}return n&&(i="Alt-"+i),o&&(i="Ctrl-"+i),f&&(i="Meta-"+i),c&&(i="Shift-"+i),i}function PMe(t){let e=Object.create(null);for(let i in t)e[kMe(i)]=t[i];return e}function pz(t,e,i=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),i&&e.shiftKey&&(t="Shift-"+t),t}function NMe(t){return new Po({props:{handleKeyDown:noe(t)}})}function noe(t){let e=PMe(t);return function(i,n){let o=EMe(n),c,f=e[pz(o,n)];if(f&&f(i.state,i.dispatch,i))return!0;if(o.length==1&&o!=" "){if(n.shiftKey){let r=e[pz(o,n,!1)];if(r&&r(i.state,i.dispatch,i))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(IMe&&n.ctrlKey&&n.altKey)&&(c=Cg[n.keyCode])&&c!=o){let r=e[pz(c,n)];if(r&&r(i.state,i.dispatch,i))return!0}}return!1}}var MMe=Object.defineProperty,aB=(t,e)=>{for(var i in e)MMe(t,i,{get:e[i],enumerable:!0})};function RM(t){const{state:e,transaction:i}=t;let{selection:n}=i,{doc:o}=i,{storedMarks:c}=i;
vendor: 21,218 bytes, lines 3732-3733
3732return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return c},get selection(){return n},get doc(){return o},get tr(){return n=i.selection,o=i.doc,c=i.storedMarks,i}}}var jM=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:i}=this,{view:n}=e,{tr:o}=i,c=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([f,r])=>[f,(...S)=>{const C=r(...S)(c);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(o),C}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:i,editor:n,state:o}=this,{view:c}=n,f=[],r=!!t,x=t||o.tr,S=()=>(!r&&e&&!x.getMeta("preventDispatch")&&!this.hasCustomState&&c.dispatch(x),f.every(I=>I===!0)),C={...Object.fromEntries(Object.entries(i).map(([I,N])=>[I,(...V)=>{const B=this.buildProps(x,e),W=N(...V)(B);return f.push(W),C}])),run:S};return C}createCan(t){const{rawCommands:e,state:i}=this,n=!1,o=t||i.tr,c=this.buildProps(o,n);return{...Object.fromEntries(Object.entries(e).map(([r,x])=>[r,(...S)=>x(...S)({...c,dispatch:void 0})])),chain:()=>this.createChain(o,n)}}buildProps(t,e=!0){const{rawCommands:i,editor:n,state:o}=this,{view:c}=n,f={tr:t,editor:n,view:c,state:RM({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(i).map(([r,x])=>[r,(...S)=>x(...S)(f)]))}};return f}},roe={};aB(roe,{blur:()=>DMe,clearContent:()=>RMe,clearNodes:()=>jMe,command:()=>zMe,createParagraphNear:()=>LMe,cut:()=>OMe,deleteCurrentNode:()=>FMe,deleteNode:()=>BMe,deleteRange:()=>UMe,deleteSelection:()=>VMe,enter:()=>$Me,exitCode:()=>qMe,extendMarkRange:()=>HMe,first:()=>GMe,focus:()=>KMe,forEach:()=>ZMe,insertContent:()=>XMe,insertContentAt:()=>JMe,joinBackward:()=>iDe,joinDown:()=>tDe,joinForward:()=>nDe,joinItemBackward:()=>rDe,joinItemForward:()=>sDe,joinTextblockBackward:()=>oDe,joinTextblockForward:()=>aDe,joinUp:()=>eDe,keyboardShortcut:()=>cDe,lift:()=>uDe,liftEmptyBlock:()=>dDe,liftListItem:()=>hDe,newlineInCode:()=>pDe,resetAttributes:()=>fDe,scrollIntoView:()=>mDe,selectAll:()=>gDe,selectNodeBackward:()=>yDe,selectNodeForward:()=>_De,selectParentNode:()=>vDe,selectTextblockEnd:()=>xDe,selectTextblockStart:()=>bDe,setContent:()=>wDe,setMark:()=>VDe,setMeta:()=>$De,setNode:()=>qDe,setNodeSelection:()=>HDe,setTextDirection:()=>GDe,setTextSelection:()=>WDe,sinkListItem:()=>KDe,splitBlock:()=>ZDe,splitListItem:()=>XDe,toggleList:()=>YDe,toggleMark:()=>QDe,toggleNode:()=>JDe,toggleWrap:()=>eRe,undoInputRule:()=>tRe,unsetAllMarks:()=>iRe,unsetMark:()=>nRe,unsetTextDirection:()=>rRe,updateAttributes:()=>sRe,wrapIn:()=>oRe,wrapInList:()=>aRe});var DMe=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var i;t.isDestroyed||(e.dom.blur(),(i=window==null?void 0:window.getSelection())==null||i.removeAllRanges())}),!0),RMe=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),jMe=()=>({state:t,tr:e,dispatch:i})=>{const{selection:n}=e,{ranges:o}=n;return i&&o.forEach(({$from:c,$to:f})=>{t.doc.nodesBetween(c.pos,f.pos,(r,x)=>{if(r.type.isText)return;const{doc:S,mapping:C}=e,I=S.resolve(C.map(x)),N=S.resolve(C.map(x+r.nodeSize)),D=I.blockRange(N);if(!D)return;const V=l1(D);if(r.type.isTextblock){const{defaultType:B}=I.parent.contentMatchAt(I.index());e.setNodeMarkup(D.start,B)}(V||V===0)&&e.lift(D,V)})}),!0},zMe=t=>e=>t(e),LMe=()=>({state:t,dispatch:e})=>IPe(t,e),OMe=(t,e)=>({editor:i,tr:n})=>{const{state:o}=i,c=o.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const f=n.mapping.map(e);return n.insert(f,c.content),n.setSelection(new br(n.doc.resolve(Math.max(f-1,0)))),!0},FMe=()=>({tr:t,dispatch:e})=>{const{selection:i}=t,n=i.$anchor.node();if(n.content.size>0)return!1;const o=t.selection.$anchor;for(let c=o.depth;c>0;c-=1)if(o.node(c).type===n.type){if(e){const r=o.before(c),x=o.after(c);t.delete(r,x).scrollIntoView()}return!0}return!1};function ma(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var BMe=t=>({tr:e,state:i,dispatch:n})=>{const o=ma(t,i.schema),c=e.selection.$anchor;for(let f=c.depth;f>0;f-=1)if(c.node(f).type===o){if(n){const x=c.before(f),S=c.after(f);e.delete(x,S).scrollIntoView()}return!0}return!1},UMe=t=>({tr:e,dispatch:i})=>{const{from:n,to:o}=t;return i&&e.delete(n,o),!0},VMe=()=>({state:t,dispatch:e})=>gPe(t,e),$Me=()=>({commands:t})=>t.keyboardShortcut("Enter"),qMe=()=>({state:t,dispatch:e})=>APe(t,e);function lB(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function TP(t,e,i={strict:!0}){const n=Object.keys(e);return n.length?n.every(o=>i.strict?e[o]===t[o]:lB(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function soe(t,e,i={}){return t.find(n=>n.type===e&&TP(Object.fromEntries(Object.keys(i).map(o=>[o,n.attrs[o]])),i))}function tG(t,e,i={}){return!!soe(t,e,i)}function cB(t,e,i){var n;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(C=>C.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(C=>C.type===e)||(i=i||((n=o.node.marks[0])==null?void 0:n.attrs),!soe([...o.node.marks],e,i)))return;let f=o.index,r=t.start()+o.offset,x=f+1,S=r+o.node.nodeSize;for(;f>0&&tG([...t.parent.child(f-1).marks],e,i);)f-=1,r-=t.parent.child(f).nodeSize;for(;x<t.parent.childCount&&tG([...t.parent.child(x).marks],e,i);)S+=t.parent.child(x).nodeSize,x+=1;return{from:r,to:S}}function ff(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var HMe=(t,e={})=>({tr:i,state:n,dispatch:o})=>{const c=ff(t,n.schema),{doc:f,selection:r}=i,{$from:x,from:S,to:C}=r;if(o){const I=cB(x,c,e);if(I&&I.from<=S&&I.to>=C){const N=br.create(f,I.from,I.to);i.setSelection(N)}}return!0},GMe=t=>e=>{const i=typeof t=="function"?t(e):t;for(let n=0;n<i.length;n+=1)if(i[n](e))return!0;return!1};function ooe(t){return t instanceof br}function r_(t=0,e=0,i=0){return Math.min(Math.max(t,e),i)}function aoe(t,e=null){if(!e)return null;const i=zr.atStart(t),n=zr.atEnd(t);if(e==="start"||e===!0)return i;if(e==="end")return n;const o=i.from,c=n.to;return e==="all"?br.create(t,r_(0,o,c),r_(t.content.size,o,c)):br.create(t,r_(e,o,c),r_(e,o,c))}function iG(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function CP(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function WMe(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var KMe=(t=null,e={})=>({editor:i,view:n,tr:o,dispatch:c})=>{e={scrollIntoView:!0,...e};const f=()=>{(CP()||iG())&&n.dom.focus(),WMe()&&!CP()&&!iG()&&n.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{i.isDestroyed||(n.focus(),e!=null&&e.scrollIntoView&&i.commands.scrollIntoView())})};try{if(n.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(c&&t===null&&!ooe(i.state.selection))return f(),!0;const r=aoe(o.doc,t)||i.state.selection,x=i.state.selection.eq(r);return c&&(x||o.setSelection(r),x&&o.storedMarks&&o.setStoredMarks(o.storedMarks),f()),!0},ZMe=(t,e)=>i=>t.every((n,o)=>e(n,{...i,index:o})),XMe=(t,e)=>({tr:i,commands:n})=>n.insertContentAt({from:i.selection.from,to:i.selection.to},t,e),loe=t=>{const e=t.childNodes;for(let i=e.length-1;i>=0;i-=1){const n=e[i];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):n.nodeType===1&&loe(n)}return t};function cI(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,i=new window.DOMParser().parseFromString(e,"text/html").body;return loe(i)}function CC(t,e,i){if(t instanceof sg||t instanceof Si)return t;i={slice:!0,parseOptions:{},...i};const n=typeof t=="object"&&t!==null,o=typeof t=="string";if(n)try{if(Array.isArray(t)&&t.length>0)return Si.fromArray(t.map(r=>e.nodeFromJSON(r)));const f=e.nodeFromJSON(t);return i.errorOnInvalidContent&&f.check(),f}catch(c){if(i.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:c});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",c),CC("",e,i)}if(o){if(i.errorOnInvalidContent){let f=!1,r="";const x=new Yre({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:S=>(f=!0,r=typeof S=="string"?S:S.outerHTML,null)}]}})});if(i.slice?og.fromSchema(x).parseSlice(cI(t),i.parseOptions):og.fromSchema(x).parse(cI(t),i.parseOptions),i.errorOnInvalidContent&&f)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${r}`)})}const c=og.fromSchema(e);return i.slice?c.parseSlice(cI(t),i.parseOptions).content:c.parse(cI(t),i.parseOptions)}return CC("",e,i)}function YMe(t,e,i){const n=t.steps.length-1;if(n<e)return;const o=t.steps[n];if(!(o instanceof Ba||o instanceof qa))return;const c=t.mapping.maps[n];let f=0;c.forEach((r,x,S,C)=>{f===0&&(f=C)}),t.setSelection(zr.near(t.doc.resolve(f),i))}var QMe=t=>!("type"in t),JMe=(t,e,i)=>({tr:n,dispatch:o,editor:c})=>{var f;if(o){i={parseOptions:c.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...i};let r;const x=W=>{c.emit("contentError",{editor:c,error:W,disableCollaboration:()=>{"collaboration"in c.storage&&typeof c.storage.collaboration=="object"&&c.storage.collaboration&&(c.storage.collaboration.isDisabled=!0)}})},S={preserveWhitespace:"full",...i.parseOptions};if(!i.errorOnInvalidContent&&!c.options.enableContentCheck&&c.options.emitContentError)try{CC(e,c.schema,{parseOptions:S,errorOnInvalidContent:!0})}catch(W){x(W)}try{r=CC(e,c.schema,{parseOptions:S,errorOnInvalidContent:(f=i.errorOnInvalidContent)!=null?f:c.options.enableContentCheck})}catch(W){return x(W),!1}let{from:C,to:I}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},N=!0,D=!0;if((QMe(r)?r:[r]).forEach(W=>{W.check(),N=N?W.isText&&W.marks.length===0:!1,D=D?W.isBlock:!1}),C===I&&D){const{parent:W}=n.doc.resolve(C);W.isTextblock&&!W.type.spec.code&&!W.childCount&&(C-=1,I+=1)}let B;if(N){if(Array.isArray(e))B=e.map(W=>W.text||"").join("");else if(e instanceof Si){let W="";e.forEach($=>{$.text&&(W+=$.text)}),B=W}else typeof e=="object"&&e&&e.text?B=e.text:B=e;n.insertText(B,C,I)}else{B=r;const W=n.doc.resolve(C),$=W.node(),G=W.parentOffset===0,te=$.isText||$.isTextblock,ce=$.content.size>0;G&&te&&ce&&(C=Math.max(0,C-1)),n.replaceWith(C,I,B)}i.updateSelection&&YMe(n,n.steps.length-1,-1),i.applyInputRules&&n.setMeta("applyInputRules",{from:C,text:B}),i.applyPasteRules&&n.setMeta("applyPasteRules",{from:C,text:B})}return!0},eDe=()=>({state:t,dispatch:e})=>SPe(t,e),tDe=()=>({state:t,dispatch:e})=>TPe(t,e),iDe=()=>({state:t,dispatch:e})=>yPe(t,e),nDe=()=>({state:t,dispatch:e})=>bPe(t,e),rDe=()=>({state:t,dispatch:e,tr:i})=>{try{const n=IM(t.doc,t.selection.$from.pos,-1);return n==null?!1:(i.join(n,2),e&&e(i),!0)}catch{return!1}},sDe=()=>({state:t,dispatch:e,tr:i})=>{try{const n=IM(t.doc,t.selection.$from.pos,1);return n==null?!1:(i.join(n,2),e&&e(i),!0)}catch{return!1}},oDe=()=>({state:t,dispatch:e})=>_Pe(t,e),aDe=()=>({state:t,dispatch:e})=>vPe(t,e);function coe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lDe(t){const e=t.split(/-(?!$)/);let i=e[e.length-1];i==="Space"&&(i=" ");let n,o,c,f;for(let r=0;r<e.length-1;r+=1){const x=e[r];if(/^(cmd|meta|m)$/i.test(x))f=!0;else if(/^a(lt)?$/i.test(x))n=!0;else if(/^(c|ctrl|control)$/i.test(x))o=!0;else if(/^s(hift)?$/i.test(x))c=!0;else if(/^mod$/i.test(x))CP()||coe()?f=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${x}`)}return n&&(i=`Alt-${i}`),o&&(i=`Ctrl-${i}`),f&&(i=`Meta-${i}`),c&&(i=`Shift-${i}`),i}var cDe=t=>({editor:e,view:i,tr:n,dispatch:o})=>{const c=lDe(t).split(/-(?!$)/),f=c.find(S=>!["Alt","Ctrl","Meta","Shift"].includes(S)),r=new KeyboardEvent("keydown",{key:f==="Space"?" ":f,altKey:c.includes("Alt"),ctrlKey:c.includes("Ctrl"),metaKey:c.includes("Meta"),shiftKey:c.includes("Shift"),bubbles:!0,cancelable:!0}),x=e.captureTransaction(()=>{i.someProp("handleKeyDown",S=>S(i,r))});return x==null||x.steps.forEach(S=>{const C=S.map(n.mapping);C&&o&&n.maybeStep(C)}),!0};function Eg(t,e,i={}){const{from:n,to:o,empty:c}=t.selection,f=e?ma(e,t.schema):null,r=[];t.doc.nodesBetween(n,o,(I,N)=>{if(I.isText)return;const D=Math.max(n,N),V=Math.min(o,N+I.nodeSize);r.push({node:I,from:D,to:V})});const x=o-n,S=r.filter(I=>f?f.name===I.node.type.name:!0).filter(I=>TP(I.node.attrs,i,{strict:!1}));return c?!!S.length:S.reduce((I,N)=>I+N.to-N.from,0)>=x}var uDe=(t,e={})=>({state:i,dispatch:n})=>{const o=ma(t,i.schema);return Eg(i,o,e)?CPe(i,n):!1},dDe=()=>({state:t,dispatch:e})=>kPe(t,e),hDe=t=>({state:e,dispatch:i})=>{const n=ma(t,e.schema);return OPe(n)(e,i)},pDe=()=>({state:t,dispatch:e})=>EPe(t,e);function zM(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function nG(t,e){const i=typeof e=="string"?[e]:e;return Object.keys(t).reduce((n,o)=>(i.includes(o)||(n[o]=t[o]),n),{})}var fDe=(t,e)=>({tr:i,state:n,dispatch:o})=>{let c=null,f=null;const r=zM(typeof t=="string"?t:t.name,n.schema);if(!r)return!1;r==="node"&&(c=ma(t,n.schema)),r==="mark"&&(f=ff(t,n.schema));let x=!1;return i.selection.ranges.forEach(S=>{n.doc.nodesBetween(S.$from.pos,S.$to.pos,(C,I)=>{c&&c===C.type&&(x=!0,o&&i.setNodeMarkup(I,void 0,nG(C.attrs,e))),f&&C.marks.length&&C.marks.forEach(N=>{f===N.type&&(x=!0,o&&i.addMark(I,I+C.nodeSize,f.create(nG(N.attrs,e))))})})}),x},mDe=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),gDe=()=>({tr:t,dispatch:e})=>{if(e){const i=new Lu(t.doc);t.setSelection(i)}return!0},yDe=()=>({state:t,dispatch:e})=>xPe(t,e),_De=()=>({state:t,dispatch:e})=>wPe(t,e),vDe=()=>({state:t,dispatch:e})=>PPe(t,e),xDe=()=>({state:t,dispatch:e})=>DPe(t,e),bDe=()=>({state:t,dispatch:e})=>MPe(t,e);function KO(t,e,i={},n={}){return CC(t,e,{slice:!1,parseOptions:i,errorOnInvalidContent:n.errorOnInvalidContent})}var wDe=(t,{errorOnInvalidContent:e,emitUpdate:i=!0,parseOptions:n={}}={})=>({editor:o,tr:c,dispatch:f,commands:r})=>{const{doc:x}=c;if(n.preserveWhitespace!=="full"){const S=KO(t,o.schema,n,{errorOnInvalidContent:e??o.options.enableContentCheck});return f&&c.replaceWith(0,x.content.size,S).setMeta("preventUpdate",!i),!0}return f&&c.setMeta("preventUpdate",!i),r.insertContentAt({from:0,to:x.content.size},t,{parseOptions:n,errorOnInvalidContent:e??o.options.enableContentCheck})};function uoe(t,e){const i=ff(e,t.schema),{from:n,to:o,empty:c}=t.selection,f=[];c?(t.storedMarks&&f.push(...t.storedMarks),f.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,o,x=>{f.push(...x.marks)});const r=f.find(x=>x.type.name===i.name);return r?{...r.attrs}:{}}function doe(t,e){const i=new pse(t);return e.forEach(n=>{n.steps.forEach(o=>{i.step(o)})}),i}function SDe(t){for(let e=0;e<t.edgeCount;e+=1){const{type:i}=t.edge(e);if(i.isTextblock&&!i.hasRequiredAttrs())return i}return null}function TDe(t,e,i){const n=[];return t.nodesBetween(e.from,e.to,(o,c)=>{i(o)&&n.push({node:o,pos:c})}),n}function CDe(t,e){for(let i=t.depth;i>0;i-=1){const n=t.node(i);if(e(n))return{pos:i>0?t.before(i):0,start:t.start(i),depth:i,node:n}}}function LM(t){return e=>CDe(e.$from,t)}function Rn(t,e,i){return t.config[e]===void 0&&t.parent?Rn(t.parent,e,i):typeof t.config[e]=="function"?t.config[e].bind({...i,parent:t.parent?Rn(t.parent,e,i):null}):t.config[e]}function uB(t){return t.map(e=>{const i={name:e.name,options:e.options,storage:e.storage},n=Rn(e,"addExtensions",i);return n?[e,...uB(n())]:e}).flat(10)}function dB(t,e){const i=hv.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(i),o.innerHTML}function hoe(t){return typeof t=="function"}function Bs(t,e=void 0,...i){return hoe(t)?e?t.bind(e)(...i):t(...i):t}function EDe(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Lb(t){const e=t.filter(o=>o.type==="extension"),i=t.filter(o=>o.type==="node"),n=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:i,markExtensions:n}}function poe(t){const e=[],{nodeExtensions:i,markExtensions:n}=Lb(t),o=[...i,...n],c={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(f=>{const r={name:f.name,options:f.options,storage:f.storage,extensions:o},x=Rn(f,"addGlobalAttributes",r);if(!x)return;x().forEach(C=>{C.types.forEach(I=>{Object.entries(C.attributes).forEach(([N,D])=>{e.push({type:I,name:N,attribute:{...c,...D}})})})})}),o.forEach(f=>{const r={name:f.name,options:f.options,storage:f.storage},x=Rn(f,"addAttributes",r);if(!x)return;const S=x();Object.entries(S).forEach(([C,I])=>{const N={...c,...I};typeof(N==null?void 0:N.default)=="function"&&(N.default=N.default()),N!=null&&N.isRequired&&(N==null?void 0:N.default)===void 0&&delete N.default,e.push({type:f.name,name:C,attribute:N})})}),e}function ea(...t){return t.filter(e=>!!e).reduce((e,i)=>{const n={...e};return Object.entries(i).forEach(([o,c])=>{if(!n[o]){n[o]=c;return}if(o==="class"){const r=c?String(c).split(" "):[],x=n[o]?n[o].split(" "):[],S=r.filter(C=>!x.includes(C));n[o]=[...x,...S].join(" ")}else if(o==="style"){const r=c?c.split(";").map(C=>C.trim()).filter(Boolean):[],x=n[o]?n[o].split(";").map(C=>C.trim()).filter(Boolean):[],S=new Map;x.forEach(C=>{const[I,N]=C.split(":").map(D=>D.trim());S.set(I,N)}),r.forEach(C=>{const[I,N]=C.split(":").map(D=>D.trim());S.set(I,N)}),n[o]=Array.from(S.entries()).map(([C,I])=>`${C}: ${I}`).join("; ")}else n[o]=c}),n},{})}function EC(t,e){return e.filter(i=>i.type===t.type.name).filter(i=>i.attribute.rendered).map(i=>i.attribute.renderHTML?i.attribute.renderHTML(t.attrs)||{}:{[i.name]:t.attrs[i.name]}).reduce((i,n)=>ea(i,n),{})}function ADe(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function rG(t,e){return"style"in t?t:{...t,getAttrs:i=>{const n=t.getAttrs?t.getAttrs(i):t.attrs;if(n===!1)return!1;const o=e.reduce((c,f)=>{const r=f.attribute.parseHTML?f.attribute.parseHTML(i):ADe(i.getAttribute(f.name));return r==null?c:{...c,[f.name]:r}},{});return{...n,...o}}}}function sG(t){return Object.fromEntries(Object.entries(t).filter(([e,i])=>e==="attrs"&&EDe(i)?!1:i!=null))}function oG(t){var e,i;const n={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(n.default=t.attribute.default),((i=t==null?void 0:t.attribute)==null?void 0:i.validate)!==void 0&&(n.validate=t.attribute.validate),[t.name,n]}function IDe(t,e){var i;const n=poe(t),{nodeExtensions:o,markExtensions:c}=Lb(t),f=(i=o.find(S=>Rn(S,"topNode")))==null?void 0:i.name,r=Object.fromEntries(o.map(S=>{const C=n.filter($=>$.type===S.name),I={name:S.name,options:S.options,storage:S.storage,editor:e},N=t.reduce(($,G)=>{const te=Rn(G,"extendNodeSchema",I);return{...$,...te?te(S):{}}},{}),D=sG({...N,content:Bs(Rn(S,"content",I)),marks:Bs(Rn(S,"marks",I)),group:Bs(Rn(S,"group",I)),inline:Bs(Rn(S,"inline",I)),atom:Bs(Rn(S,"atom",I)),selectable:Bs(Rn(S,"selectable",I)),draggable:Bs(Rn(S,"draggable",I)),code:Bs(Rn(S,"code",I)),whitespace:Bs(Rn(S,"whitespace",I)),linebreakReplacement:Bs(Rn(S,"linebreakReplacement",I)),defining:Bs(Rn(S,"defining",I)),isolating:Bs(Rn(S,"isolating",I)),attrs:Object.fromEntries(C.map(oG))}),V=Bs(Rn(S,"parseHTML",I));V&&(D.parseDOM=V.map($=>rG($,C)));const B=Rn(S,"renderHTML",I);B&&(D.toDOM=$=>B({node:$,HTMLAttributes:EC($,C)}));const W=Rn(S,"renderText",I);return W&&(D.toText=W),[S.name,D]})),x=Object.fromEntries(c.map(S=>{const C=n.filter(W=>W.type===S.name),I={name:S.name,options:S.options,storage:S.storage,editor:e},N=t.reduce((W,$)=>{const G=Rn($,"extendMarkSchema",I);return{...W,...G?G(S):{}}},{}),D=sG({...N,inclusive:Bs(Rn(S,"inclusive",I)),excludes:Bs(Rn(S,"excludes",I)),group:Bs(Rn(S,"group",I)),spanning:Bs(Rn(S,"spanning",I)),code:Bs(Rn(S,"code",I)),attrs:Object.fromEntries(C.map(oG))}),V=Bs(Rn(S,"parseHTML",I));V&&(D.parseDOM=V.map(W=>rG(W,C)));const B=Rn(S,"renderHTML",I);return B&&(D.toDOM=W=>B({mark:W,HTMLAttributes:EC(W,C)})),[S.name,D]}));return new Yre({topNode:f,nodes:r,marks:x})}function kDe(t){const e=t.filter((i,n)=>t.indexOf(i)!==n);return Array.from(new Set(e))}function EP(t){return t.sort((i,n)=>{const o=Rn(i,"priority")||100,c=Rn(n,"priority")||100;return o>c?-1:o<c?1:0})}function foe(t){const e=EP(uB(t)),i=kDe(e.map(n=>n.name));return i.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${i.map(n=>`'${n}'`).join(", ")}]. This can lead to issues.`),e}function moe(t,e,i){const{from:n,to:o}=e,{blockSeparator:c=` 3733
3734`,textSerializers:f={}}=i||{};let r="";return t.nodesBetween(n,o,(x,S,C,I)=>{var N;x.isBlock&&S>n&&(r+=c);const D=f==null?void 0:f[x.type.name];if(D)return C&&(r+=D({node:x,pos:S,parent:C,index:I,range:e})),!1;x.isText&&(r+=(N=x==null?void 0:x.text)==null?void 0:N.slice(Math.max(n,S)-S,o-S))}),r}function PDe(t,e){const i={from:0,to:t.content.size};return moe(t,i,e)}function goe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,i])=>[e,i.spec.toText]))}function NDe(t,e){const i=ma(e,t.schema),{from:n,to:o}=t.selection,c=[];t.doc.nodesBetween(n,o,r=>{c.push(r)});const f=c.reverse().find(r=>r.type.name===i.name);return f?{...f.attrs}:{}}function yoe(t,e){const i=zM(typeof e=="string"?e:e.name,t.schema);return i==="node"?NDe(t,e):i==="mark"?uoe(t,e):{}}function MDe(t,e=JSON.stringify){const i={};return t.filter(n=>{const o=e(n);return Object.prototype.hasOwnProperty.call(i,o)?!1:i[o]=!0})}function DDe(t){const e=MDe(t);return e.length===1?e:e.filter((i,n)=>!e.filter((c,f)=>f!==n).some(c=>i.oldRange.from>=c.oldRange.from&&i.oldRange.to<=c.oldRange.to&&i.newRange.from>=c.newRange.from&&i.newRange.to<=c.newRange.to))}function _oe(t){const{mapping:e,steps:i}=t,n=[];return e.maps.forEach((o,c)=>{const f=[];if(o.ranges.length)o.forEach((r,x)=>{f.push({from:r,to:x})});else{const{from:r,to:x}=i[c];if(r===void 0||x===void 0)return;f.push({from:r,to:x})}f.forEach(({from:r,to:x})=>{const S=e.slice(c).map(r,-1),C=e.slice(c).map(x),I=e.invert().map(S,-1),N=e.invert().map(C);n.push({oldRange:{from:I,to:N},newRange:{from:S,to:C}})})}),DDe(n)}function hB(t,e,i){const n=[];return t===e?i.resolve(t).marks().forEach(o=>{const c=i.resolve(t),f=cB(c,o.type);f&&n.push({mark:o,...f})}):i.nodesBetween(t,e,(o,c)=>{!o||(o==null?void 0:o.nodeSize)===void 0||n.push(...o.marks.map(f=>({from:c,to:c+o.nodeSize,mark:f})))}),n}var RDe=(t,e,i,n=20)=>{const o=t.doc.resolve(i);let c=n,f=null;for(;c>0&&f===null;){const r=o.node(c);(r==null?void 0:r.type.name)===e?f=r:c-=1}return[f,c]};function uI(t,e){return e.nodes[t]||e.marks[t]||null}function ek(t,e,i){return Object.fromEntries(Object.entries(i).filter(([n])=>{const o=t.find(c=>c.type===e&&c.name===n);return o?o.attribute.keepOnSplit:!1}))}var jDe=(t,e=500)=>{let i="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-e),n,(o,c,f,r)=>{var x,S;const C=((S=(x=o.type.spec).toText)==null?void 0:S.call(x,{node:o,pos:c,parent:f,index:r}))||o.textContent||"%leaf%";i+=o.isAtom&&!o.isText?C:C.slice(0,Math.max(0,n-c))}),i};function ZO(t,e,i={}){const{empty:n,ranges:o}=t.selection,c=e?ff(e,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(I=>c?c.name===I.type.name:!0).find(I=>TP(I.attrs,i,{strict:!1}));let f=0;const r=[];if(o.forEach(({$from:I,$to:N})=>{const D=I.pos,V=N.pos;t.doc.nodesBetween(D,V,(B,W)=>{if(!B.isText&&!B.marks.length)return;const $=Math.max(D,W),G=Math.min(V,W+B.nodeSize),te=G-$;f+=te,r.push(...B.marks.map(ce=>({mark:ce,from:$,to:G})))})}),f===0)return!1;const x=r.filter(I=>c?c.name===I.mark.type.name:!0).filter(I=>TP(I.mark.attrs,i,{strict:!1})).reduce((I,N)=>I+N.to-N.from,0),S=r.filter(I=>c?I.mark.type!==c&&I.mark.type.excludes(c):!0).reduce((I,N)=>I+N.to-N.from,0);return(x>0?x+S:x)>=f}function zDe(t,e,i={}){if(!e)return Eg(t,null,i)||ZO(t,null,i);const n=zM(e,t.schema);return n==="node"?Eg(t,e,i):n==="mark"?ZO(t,e,i):!1}var LDe=(t,e)=>{const{$from:i,$to:n,$anchor:o}=t.selection;if(e){const c=LM(r=>r.type.name===e)(t.selection);if(!c)return!1;const f=t.doc.resolve(c.pos+1);return o.pos+1===f.end()}return!(n.parentOffset<n.parent.nodeSize-2||i.pos!==n.pos)},ODe=t=>{const{$from:e,$to:i}=t.selection;return!(e.parentOffset>0||e.pos!==i.pos)};function aG(t,e){return Array.isArray(e)?e.some(i=>(typeof i=="string"?i:i.name)===t.name):e}function lG(t,e){const{nodeExtensions:i}=Lb(e),n=i.find(f=>f.name===t);if(!n)return!1;const o={name:n.name,options:n.options,storage:n.storage},c=Bs(Rn(n,"group",o));return typeof c!="string"?!1:c.split(" ").includes("list")}function OM(t,{checkChildren:e=!0,ignoreWhitespace:i=!1}={}){var n;if(i){if(t.type.name==="hardBreak")return!0;
vendor: 29,968 bytes, lines 3734-3775
3734if(t.isText)return/^\s*$/m.test((n=t.text)!=null?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(c=>{o!==!1&&(OM(c,{ignoreWhitespace:i,checkChildren:e})||(o=!1))}),o}return!1}function voe(t){return t instanceof qn}var xoe=class boe{constructor(e){this.position=e}static fromJSON(e){return new boe(e.position)}toJSON(){return{position:this.position}}};function FDe(t,e){const i=e.mapping.mapResult(t.position);return{position:new xoe(i.pos),mapResult:i}}function BDe(t){return new xoe(t)}function UDe(t,e,i){var n;const{selection:o}=e;let c=null;if(ooe(o)&&(c=o.$cursor),c){const r=(n=t.storedMarks)!=null?n:c.marks();return c.parent.type.allowsMarkType(i)&&(!!i.isInSet(r)||!r.some(S=>S.type.excludes(i)))}const{ranges:f}=o;return f.some(({$from:r,$to:x})=>{let S=r.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(i):!1;return t.doc.nodesBetween(r.pos,x.pos,(C,I,N)=>{if(S)return!1;if(C.isInline){const D=!N||N.type.allowsMarkType(i),V=!!i.isInSet(C.marks)||!C.marks.some(B=>B.type.excludes(i));S=D&&V}return!S}),S})}var VDe=(t,e={})=>({tr:i,state:n,dispatch:o})=>{const{selection:c}=i,{empty:f,ranges:r}=c,x=ff(t,n.schema);if(o)if(f){const S=uoe(n,x);i.addStoredMark(x.create({...S,...e}))}else r.forEach(S=>{const C=S.$from.pos,I=S.$to.pos;n.doc.nodesBetween(C,I,(N,D)=>{const V=Math.max(D,C),B=Math.min(D+N.nodeSize,I);N.marks.find($=>$.type===x)?N.marks.forEach($=>{x===$.type&&i.addMark(V,B,x.create({...$.attrs,...e}))}):i.addMark(V,B,x.create(e))})});return UDe(n,i,x)},$De=(t,e)=>({tr:i})=>(i.setMeta(t,e),!0),qDe=(t,e={})=>({state:i,dispatch:n,chain:o})=>{const c=ma(t,i.schema);let f;return i.selection.$anchor.sameParent(i.selection.$head)&&(f=i.selection.$anchor.parent.attrs),c.isTextblock?o().command(({commands:r})=>bH(c,{...f,...e})(i)?!0:r.clearNodes()).command(({state:r})=>bH(c,{...f,...e})(r,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},HDe=t=>({tr:e,dispatch:i})=>{if(i){const{doc:n}=e,o=r_(t,0,n.content.size),c=qn.create(n,o);e.setSelection(c)}return!0},GDe=(t,e)=>({tr:i,state:n,dispatch:o})=>{const{selection:c}=n;let f,r;return typeof e=="number"?(f=e,r=e):e&&"from"in e&&"to"in e?(f=e.from,r=e.to):(f=c.from,r=c.to),o&&i.doc.nodesBetween(f,r,(x,S)=>{x.isText||i.setNodeMarkup(S,void 0,{...x.attrs,dir:t})}),!0},WDe=t=>({tr:e,dispatch:i})=>{if(i){const{doc:n}=e,{from:o,to:c}=typeof t=="number"?{from:t,to:t}:t,f=br.atStart(n).from,r=br.atEnd(n).to,x=r_(o,f,r),S=r_(c,f,r),C=br.create(n,x,S);e.setSelection(C)}return!0},KDe=t=>({state:e,dispatch:i})=>{const n=ma(t,e.schema);return UPe(n)(e,i)};function cG(t,e){const i=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(i){const n=i.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(n)}}var ZDe=({keepMarks:t=!0}={})=>({tr:e,state:i,dispatch:n,editor:o})=>{const{selection:c,doc:f}=e,{$from:r,$to:x}=c,S=o.extensionManager.attributes,C=ek(S,r.node().type.name,r.node().attrs);if(c instanceof qn&&c.node.isBlock)return!r.parentOffset||!P0(f,r.pos)?!1:(n&&(t&&cG(i,o.extensionManager.splittableMarks),e.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;const I=x.parentOffset===x.parent.content.size,N=r.depth===0?void 0:SDe(r.node(-1).contentMatchAt(r.indexAfter(-1)));let D=I&&N?[{type:N,attrs:C}]:void 0,V=P0(e.doc,e.mapping.map(r.pos),1,D);if(!D&&!V&&P0(e.doc,e.mapping.map(r.pos),1,N?[{type:N}]:void 0)&&(V=!0,D=N?[{type:N,attrs:C}]:void 0),n){if(V&&(c instanceof br&&e.deleteSelection(),e.split(e.mapping.map(r.pos),1,D),N&&!I&&!r.parentOffset&&r.parent.type!==N)){const B=e.mapping.map(r.before()),W=e.doc.resolve(B);r.node(-1).canReplaceWith(W.index(),W.index()+1,N)&&e.setNodeMarkup(e.mapping.map(r.before()),N)}t&&cG(i,o.extensionManager.splittableMarks),e.scrollIntoView()}return V},XDe=(t,e={})=>({tr:i,state:n,dispatch:o,editor:c})=>{var f;const r=ma(t,n.schema),{$from:x,$to:S}=n.selection,C=n.selection.node;if(C&&C.isBlock||x.depth<2||!x.sameParent(S))return!1;const I=x.node(-1);if(I.type!==r)return!1;const N=c.extensionManager.attributes;if(x.parent.content.size===0&&x.node(-1).childCount===x.indexAfter(-1)){if(x.depth===2||x.node(-3).type!==r||x.index(-2)!==x.node(-2).childCount-1)return!1;if(o){let $=Si.empty;const G=x.index(-1)?1:x.index(-2)?2:3;for(let Ne=x.depth-G;Ne>=x.depth-3;Ne-=1)$=Si.from(x.node(Ne).copy($));const te=x.indexAfter(-1)<x.node(-2).childCount?1:x.indexAfter(-2)<x.node(-3).childCount?2:3,ce={...ek(N,x.node().type.name,x.node().attrs),...e},_e=((f=r.contentMatch.defaultType)==null?void 0:f.createAndFill(ce))||void 0;$=$.append(Si.from(r.createAndFill(null,_e)||void 0));const Te=x.before(x.depth-(G-1));i.replace(Te,x.after(-te),new pn($,4-G,0));let we=-1;i.doc.nodesBetween(Te,i.doc.content.size,(Ne,pe)=>{if(we>-1)return!1;Ne.isTextblock&&Ne.content.size===0&&(we=pe+1)}),we>-1&&i.setSelection(br.near(i.doc.resolve(we))),i.scrollIntoView()}return!0}const D=S.pos===x.end()?I.contentMatchAt(0).defaultType:null,V={...ek(N,I.type.name,I.attrs),...e},B={...ek(N,x.node().type.name,x.node().attrs),...e};i.delete(x.pos,S.pos);const W=D?[{type:r,attrs:V},{type:D,attrs:B}]:[{type:r,attrs:V}];if(!P0(i.doc,x.pos,2))return!1;if(o){const{selection:$,storedMarks:G}=n,{splittableMarks:te}=c.extensionManager,ce=G||$.$to.parentOffset&&$.$from.marks();if(i.split(x.pos,2,W).scrollIntoView(),!ce||!o)return!0;const _e=ce.filter(Te=>te.includes(Te.type.name));i.ensureMarks(_e)}return!0},fz=(t,e)=>{const i=LM(f=>f.type===e)(t.selection);if(!i)return!0;const n=t.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(n===void 0)return!0;const o=t.doc.nodeAt(n);return i.node.type===(o==null?void 0:o.type)&&Og(t.doc,i.pos)&&t.join(i.pos),!0},mz=(t,e)=>{const i=LM(f=>f.type===e)(t.selection);if(!i)return!0;const n=t.doc.resolve(i.start).after(i.depth);if(n===void 0)return!0;const o=t.doc.nodeAt(n);return i.node.type===(o==null?void 0:o.type)&&Og(t.doc,n)&&t.join(n),!0},YDe=(t,e,i,n={})=>({editor:o,tr:c,state:f,dispatch:r,chain:x,commands:S,can:C})=>{const{extensions:I,splittableMarks:N}=o.extensionManager,D=ma(t,f.schema),V=ma(e,f.schema),{selection:B,storedMarks:W}=f,{$from:$,$to:G}=B,te=$.blockRange(G),ce=W||B.$to.parentOffset&&B.$from.marks();if(!te)return!1;const _e=LM(Te=>lG(Te.type.name,I))(B);if(te.depth>=1&&_e&&te.depth-_e.depth<=1){if(_e.node.type===D)return S.liftListItem(V);if(lG(_e.node.type.name,I)&&D.validContent(_e.node.content)&&r)return x().command(()=>(c.setNodeMarkup(_e.pos,D),!0)).command(()=>fz(c,D)).command(()=>mz(c,D)).run()}return!i||!ce||!r?x().command(()=>C().wrapInList(D,n)?!0:S.clearNodes()).wrapInList(D,n).command(()=>fz(c,D)).command(()=>mz(c,D)).run():x().command(()=>{const Te=C().wrapInList(D,n),we=ce.filter(Ne=>N.includes(Ne.type.name));return c.ensureMarks(we),Te?!0:S.clearNodes()}).wrapInList(D,n).command(()=>fz(c,D)).command(()=>mz(c,D)).run()},QDe=(t,e={},i={})=>({state:n,commands:o})=>{const{extendEmptyMarkRange:c=!1}=i,f=ff(t,n.schema);return ZO(n,f,e)?o.unsetMark(f,{extendEmptyMarkRange:c}):o.setMark(f,e)},JDe=(t,e,i={})=>({state:n,commands:o})=>{const c=ma(t,n.schema),f=ma(e,n.schema),r=Eg(n,c,i);let x;return n.selection.$anchor.sameParent(n.selection.$head)&&(x=n.selection.$anchor.parent.attrs),r?o.setNode(f,x):o.setNode(c,{...x,...i})},eRe=(t,e={})=>({state:i,commands:n})=>{const o=ma(t,i.schema);return Eg(i,o,e)?n.lift(o):n.wrapIn(o,e)},tRe=()=>({state:t,dispatch:e})=>{const i=t.plugins;for(let n=0;n<i.length;n+=1){const o=i[n];let c;if(o.spec.isInputRules&&(c=o.getState(t))){if(e){const f=t.tr,r=c.transform;for(let x=r.steps.length-1;x>=0;x-=1)f.step(r.steps[x].invert(r.docs[x]));if(c.text){const x=f.doc.resolve(c.from).marks();f.replaceWith(c.from,c.to,t.schema.text(c.text,x))}else f.delete(c.from,c.to)}return!0}}return!1},iRe=()=>({tr:t,dispatch:e})=>{const{selection:i}=t,{empty:n,ranges:o}=i;return n||e&&o.forEach(c=>{t.removeMark(c.$from.pos,c.$to.pos)}),!0},nRe=(t,e={})=>({tr:i,state:n,dispatch:o})=>{var c;const{extendEmptyMarkRange:f=!1}=e,{selection:r}=i,x=ff(t,n.schema),{$from:S,empty:C,ranges:I}=r;if(!o)return!0;if(C&&f){let{from:N,to:D}=r;const V=(c=S.marks().find(W=>W.type===x))==null?void 0:c.attrs,B=cB(S,x,V);B&&(N=B.from,D=B.to),i.removeMark(N,D,x)}else I.forEach(N=>{i.removeMark(N.$from.pos,N.$to.pos,x)});return i.removeStoredMark(x),!0},rRe=t=>({tr:e,state:i,dispatch:n})=>{const{selection:o}=i;let c,f;return typeof t=="number"?(c=t,f=t):t&&"from"in t&&"to"in t?(c=t.from,f=t.to):(c=o.from,f=o.to),n&&e.doc.nodesBetween(c,f,(r,x)=>{if(r.isText)return;const S={...r.attrs};delete S.dir,e.setNodeMarkup(x,void 0,S)}),!0},sRe=(t,e={})=>({tr:i,state:n,dispatch:o})=>{let c=null,f=null;const r=zM(typeof t=="string"?t:t.name,n.schema);if(!r)return!1;r==="node"&&(c=ma(t,n.schema)),r==="mark"&&(f=ff(t,n.schema));let x=!1;return i.selection.ranges.forEach(S=>{const C=S.$from.pos,I=S.$to.pos;let N,D,V,B;i.selection.empty?n.doc.nodesBetween(C,I,(W,$)=>{c&&c===W.type&&(x=!0,V=Math.max($,C),B=Math.min($+W.nodeSize,I),N=$,D=W)}):n.doc.nodesBetween(C,I,(W,$)=>{$<C&&c&&c===W.type&&(x=!0,V=Math.max($,C),B=Math.min($+W.nodeSize,I),N=$,D=W),$>=C&&$<=I&&(c&&c===W.type&&(x=!0,o&&i.setNodeMarkup($,void 0,{...W.attrs,...e})),f&&W.marks.length&&W.marks.forEach(G=>{if(f===G.type&&(x=!0,o)){const te=Math.max($,C),ce=Math.min($+W.nodeSize,I);i.addMark(te,ce,f.create({...G.attrs,...e}))}}))}),D&&(N!==void 0&&o&&i.setNodeMarkup(N,void 0,{...D.attrs,...e}),f&&D.marks.length&&D.marks.forEach(W=>{f===W.type&&o&&i.addMark(V,B,f.create({...W.attrs,...e}))}))}),x},oRe=(t,e={})=>({state:i,dispatch:n})=>{const o=ma(t,i.schema);return RPe(o,e)(i,n)},aRe=(t,e={})=>({state:i,dispatch:n})=>{const o=ma(t,i.schema);return jPe(o,e)(i,n)},lRe=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const i=this.callbacks[t];return i&&i.forEach(n=>n.apply(this,e)),this}off(t,e){const i=this.callbacks[t];return i&&(e?this.callbacks[t]=i.filter(n=>n!==e):delete this.callbacks[t]),this}once(t,e){const i=(...n)=>{this.off(t,i),e.apply(this,n)};return this.on(t,i)}removeAllListeners(){this.callbacks={}}},FM=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},cRe=(t,e)=>{if(lB(e))return e.exec(t);const i=e(t);if(!i)return null;const n=[i.text];return n.index=i.index,n.input=t,n.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(i.replaceWith)),n};function dI(t){var e;const{editor:i,from:n,to:o,text:c,rules:f,plugin:r}=t,{view:x}=i;if(x.composing)return!1;const S=x.state.doc.resolve(n);if(S.parent.type.spec.code||(e=S.nodeBefore||S.nodeAfter)!=null&&e.marks.find(N=>N.type.spec.code))return!1;let C=!1;const I=jDe(S)+c;return f.forEach(N=>{if(C)return;const D=cRe(I,N.find);if(!D)return;const V=x.state.tr,B=RM({state:x.state,transaction:V}),W={from:n-(D[0].length-c.length),to:o},{commands:$,chain:G,can:te}=new jM({editor:i,state:B});N.handler({state:B,range:W,match:D,commands:$,chain:G,can:te})===null||!V.steps.length||(N.undoable&&V.setMeta(r,{transform:V,from:n,to:o,text:c}),x.dispatch(V),C=!0)}),C}function uRe(t){const{editor:e,rules:i}=t,n=new Po({state:{init(){return null},apply(o,c,f){const r=o.getMeta(n);if(r)return r;const x=o.getMeta("applyInputRules");return!!x&&setTimeout(()=>{let{text:C}=x;typeof C=="string"?C=C:C=dB(Si.from(C),f.schema);const{from:I}=x,N=I+C.length;dI({editor:e,from:I,to:N,text:C,rules:i,plugin:n})}),o.selectionSet||o.docChanged?null:c}},props:{handleTextInput(o,c,f,r){return dI({editor:e,from:c,to:f,text:r,rules:i,plugin:n})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:c}=o.state.selection;c&&dI({editor:e,from:c.pos,to:c.pos,text:"",rules:i,plugin:n})}),!1)},handleKeyDown(o,c){if(c.key!=="Enter")return!1;const{$cursor:f}=o.state.selection;return f?dI({editor:e,from:f.pos,to:f.pos,text:` 3735`,rules:i,plugin:n}):!1}},isInputRules:!0});return n}function dRe(t){return Object.prototype.toString.call(t).slice(8,-1)}function hI(t){return dRe(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function woe(t,e){const i={...t};return hI(t)&&hI(e)&&Object.keys(e).forEach(n=>{hI(e[n])&&hI(t[n])?i[n]=woe(t[n],e[n]):i[n]=e[n]}),i}var pB=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Bs(Rn(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Bs(Rn(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>woe(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Bg=class Soe extends pB{constructor(){super(...arguments),this.type="mark"}static create(e={}){const i=typeof e=="function"?e():e;return new Soe(i)}static handleExit({editor:e,mark:i}){const{tr:n}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const f=o.marks();if(!!!f.find(S=>(S==null?void 0:S.type.name)===i.name))return!1;const x=f.find(S=>(S==null?void 0:S.type.name)===i.name);return x&&n.removeStoredMark(x),n.insertText(" ",o.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const i=typeof e=="function"?e():e;return super.extend(i)}};function hRe(t){return typeof t=="number"}var pRe=class{constructor(t){this.find=t.find,this.handler=t.handler}},fRe=(t,e,i)=>{if(lB(e))return[...t.matchAll(e)];const n=e(t,i);return n?n.map(o=>{const c=[o.text];return c.index=o.index,c.input=t,c.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),c.push(o.replaceWith)),c}):[]};function mRe(t){const{editor:e,state:i,from:n,to:o,rule:c,pasteEvent:f,dropEvent:r}=t,{commands:x,chain:S,can:C}=new jM({editor:e,state:i}),I=[];return i.doc.nodesBetween(n,o,(D,V)=>{var B,W,$,G,te;if((W=(B=D.type)==null?void 0:B.spec)!=null&&W.code||!(D.isText||D.isTextblock||D.isInline))return;const ce=(te=(G=($=D.content)==null?void 0:$.size)!=null?G:D.nodeSize)!=null?te:0,_e=Math.max(n,V),Te=Math.min(o,V+ce);if(_e>=Te)return;const we=D.isText?D.text||"":D.textBetween(_e-V,Te-V,void 0,"");fRe(we,c.find,f).forEach(pe=>{if(pe.index===void 0)return;const Pe=_e+pe.index+1,De=Pe+pe[0].length,Je={from:i.tr.mapping.map(Pe),to:i.tr.mapping.map(De)},dt=c.handler({state:i,range:Je,match:pe,commands:x,chain:S,can:C,pasteEvent:f,dropEvent:r});I.push(dt)})}),I.every(D=>D!==null)}var pI=null,gRe=t=>{var e;const i=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=i.clipboardData)==null||e.setData("text/html",t),i};function yRe(t){const{editor:e,rules:i}=t;let n=null,o=!1,c=!1,f=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,r;try{r=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{r=null}const x=({state:C,from:I,to:N,rule:D,pasteEvt:V})=>{const B=C.tr,W=RM({state:C,transaction:B});if(!(!mRe({editor:e,state:W,from:Math.max(I-1,0),to:N.b-1,rule:D,pasteEvent:V,dropEvent:r})||!B.steps.length)){try{r=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{r=null}return f=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,B}};return i.map(C=>new Po({view(I){const N=V=>{var B;n=(B=I.dom.parentElement)!=null&&B.contains(V.target)?I.dom.parentElement:null,n&&(pI=e)},D=()=>{pI&&(pI=null)};return window.addEventListener("dragstart",N),window.addEventListener("dragend",D),{destroy(){window.removeEventListener("dragstart",N),window.removeEventListener("dragend",D)}}},props:{handleDOMEvents:{drop:(I,N)=>{if(c=n===I.dom.parentElement,r=N,!c){const D=pI;D!=null&&D.isEditable&&setTimeout(()=>{const V=D.state.selection;V&&D.commands.deleteRange({from:V.from,to:V.to})},10)}return!1},paste:(I,N)=>{var D;const V=(D=N.clipboardData)==null?void 0:D.getData("text/html");return f=N,o=!!(V!=null&&V.includes("data-pm-slice")),!1}}},appendTransaction:(I,N,D)=>{const V=I[0],B=V.getMeta("uiEvent")==="paste"&&!o,W=V.getMeta("uiEvent")==="drop"&&!c,$=V.getMeta("applyPasteRules"),G=!!$;if(!B&&!W&&!G)return;if(G){let{text:_e}=$;typeof _e=="string"?_e=_e:_e=dB(Si.from(_e),D.schema);const{from:Te}=$,we=Te+_e.length,Ne=gRe(_e);return x({rule:C,state:D,from:Te,to:{b:we},pasteEvt:Ne})}const te=N.doc.content.findDiffStart(D.doc.content),ce=N.doc.content.findDiffEnd(D.doc.content);if(!(!hRe(te)||!ce||te===ce.b))return x({rule:C,state:D,from:te,to:ce,pasteEvt:f})}}))}var BM=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=foe(t),this.schema=IDe(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:uI(e.name,this.schema)},n=Rn(e,"addCommands",i);return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this;return EP([...this.extensions].reverse()).flatMap(n=>{const o={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:uI(n.name,this.schema)},c=[],f=Rn(n,"addKeyboardShortcuts",o);let r={};if(n.type==="mark"&&Rn(n,"exitable",o)&&(r.ArrowRight=()=>Bg.handleExit({editor:t,mark:n})),f){const N=Object.fromEntries(Object.entries(f()).map(([D,V])=>[D,()=>V({editor:t})]));r={...r,...N}}const x=NMe(r);c.push(x);const S=Rn(n,"addInputRules",o);if(aG(n,t.options.enableInputRules)&&S){const N=S();if(N&&N.length){const D=uRe({editor:t,rules:N}),V=Array.isArray(D)?D:[D];c.push(...V)}}const C=Rn(n,"addPasteRules",o);if(aG(n,t.options.enablePasteRules)&&C){const N=C();if(N&&N.length){const D=yRe({editor:t,rules:N});c.push(...D)}}const I=Rn(n,"addProseMirrorPlugins",o);if(I){const N=I();c.push(...N)}return c})}get attributes(){return poe(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Lb(this.extensions);return Object.fromEntries(e.filter(i=>!!Rn(i,"addNodeView")).map(i=>{const n=this.attributes.filter(x=>x.type===i.name),o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:ma(i.name,this.schema)},c=Rn(i,"addNodeView",o);if(!c)return[];const f=c();if(!f)return[];const r=(x,S,C,I,N)=>{const D=EC(x,n);return f({node:x,view:S,getPos:C,decorations:I,innerDecorations:N,editor:t,extension:i,HTMLAttributes:D})};return[i.name,r]}))}dispatchTransaction(t){const{editor:e}=this;return EP([...this.extensions].reverse()).reduceRight((n,o)=>{const c={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:e,type:uI(o.name,this.schema)},f=Rn(o,"dispatchTransaction",c);return f?r=>{f.call(c,{transaction:r,next:n})}:n},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Lb(this.extensions);return Object.fromEntries(e.filter(i=>!!Rn(i,"addMarkView")).map(i=>{const n=this.attributes.filter(r=>r.type===i.name),o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:ff(i.name,this.schema)},c=Rn(i,"addMarkView",o);if(!c)return[];const f=(r,x,S)=>{const C=EC(r,n);return c()({mark:r,view:x,inline:S,editor:t,extension:i,HTMLAttributes:C,updateAttributes:I=>{NRe(r,t,I)}})};return[i.name,f]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var i;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:uI(e.name,this.schema)};e.type==="mark"&&((i=Bs(Rn(e,"keepOnSplit",n)))==null||i)&&this.splittableMarks.push(e.name);const o=Rn(e,"onBeforeCreate",n),c=Rn(e,"onCreate",n),f=Rn(e,"onUpdate",n),r=Rn(e,"onSelectionUpdate",n),x=Rn(e,"onTransaction",n),S=Rn(e,"onFocus",n),C=Rn(e,"onBlur",n),I=Rn(e,"onDestroy",n);o&&this.editor.on("beforeCreate",o),c&&this.editor.on("create",c),f&&this.editor.on("update",f),r&&this.editor.on("selectionUpdate",r),x&&this.editor.on("transaction",x),S&&this.editor.on("focus",S),C&&this.editor.on("blur",C),I&&this.editor.on("destroy",I)})}};BM.resolve=foe;BM.sort=EP;BM.flatten=uB;var _Re={};aB(_Re,{ClipboardTextSerializer:()=>Coe,Commands:()=>Eoe,Delete:()=>Aoe,Drop:()=>Ioe,Editable:()=>koe,FocusEvents:()=>Noe,Keymap:()=>Moe,Paste:()=>Doe,Tabindex:()=>Roe,TextDirection:()=>joe,focusEventsPluginKey:()=>Poe});var $s=class Toe extends pB{constructor(){super(...arguments),this.type="extension"}static create(e={}){const i=typeof e=="function"?e():e;return new Toe(i)}configure(e){return super.configure(e)}extend(e){const i=typeof e=="function"?e():e;return super.extend(i)}},Coe=$s.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Po({key:new Aa("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:i}=t,{doc:n,selection:o}=e,{ranges:c}=o,f=Math.min(...c.map(C=>C.$from.pos)),r=Math.max(...c.map(C=>C.$to.pos)),x=goe(i);return moe(n,{from:f,to:r},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:x})}}})]}}),Eoe=$s.create({name:"commands",addCommands(){return{...roe}}}),Aoe=$s.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var i,n,o;const c=()=>{var f,r,x,S;if((S=(x=(r=(f=this.editor.options.coreExtensionOptions)==null?void 0:f.delete)==null?void 0:r.filterTransaction)==null?void 0:x.call(r,t))!=null?S:t.getMeta("y-sync$"))return;const C=doe(t.before,[t,...e]);_oe(C).forEach(D=>{C.mapping.mapResult(D.oldRange.from).deletedAfter&&C.mapping.mapResult(D.oldRange.to).deletedBefore&&C.before.nodesBetween(D.oldRange.from,D.oldRange.to,(V,B)=>{const W=B+V.nodeSize-2,$=D.oldRange.from<=B&&W<=D.oldRange.to;this.editor.emit("delete",{type:"node",node:V,from:B,to:W,newFrom:C.mapping.map(B),newTo:C.mapping.map(W),deletedRange:D.oldRange,newRange:D.newRange,partial:!$,editor:this.editor,transaction:t,combinedTransform:C})})});const N=C.mapping;C.steps.forEach((D,V)=>{var B,W;if(D instanceof Nd){const $=N.slice(V).map(D.from,-1),G=N.slice(V).map(D.to),te=N.invert().map($,-1),ce=N.invert().map(G),_e=(B=C.doc.nodeAt($-1))==null?void 0:B.marks.some(we=>we.eq(D.mark)),Te=(W=C.doc.nodeAt(G))==null?void 0:W.marks.some(we=>we.eq(D.mark));this.editor.emit("delete",{type:"mark",mark:D.mark,from:D.from,to:D.to,deletedRange:{from:te,to:ce},newRange:{from:$,to:G},partial:!!(Te||_e),editor:this.editor,transaction:t,combinedTransform:C})}})};(o=(n=(i=this.editor.options.coreExtensionOptions)==null?void 0:i.delete)==null?void 0:n.async)==null||o?setTimeout(c,0):c()}}),Ioe=$s.create({name:"drop",addProseMirrorPlugins(){return[new Po({key:new Aa("tiptapDrop"),props:{handleDrop:(t,e,i,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:i,moved:n})}}})]}}),koe=$s.create({name:"editable",addProseMirrorPlugins(){return[new Po({key:new Aa("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Poe=new Aa("focusEvents"),Noe=$s.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Po({key:Poe,props:{handleDOMEvents:{focus:(e,i)=>{t.isFocused=!0;const n=t.state.tr.setMeta("focus",{event:i}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,i)=>{t.isFocused=!1;const n=t.state.tr.setMeta("blur",{event:i}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Moe=$s.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:f})=>[()=>f.undoInputRule(),()=>f.command(({tr:r})=>{const{selection:x,doc:S}=r,{empty:C,$anchor:I}=x,{pos:N,parent:D}=I,V=I.parent.isTextblock&&N>0?r.doc.resolve(N-1):I,B=V.parent.type.spec.isolating,W=I.pos-I.parentOffset,$=B&&V.parent.childCount===1?W===I.pos:zr.atStart(S).from===N;return!C||!D.type.isTextblock||D.textContent.length||!$||$&&I.parent.type.name==="paragraph"?!1:f.clearNodes()}),()=>f.deleteSelection(),()=>f.joinBackward(),()=>f.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:f})=>[()=>f.deleteSelection(),()=>f.deleteCurrentNode(),()=>f.joinForward(),()=>f.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:f})=>[()=>f.newlineInCode(),()=>f.createParagraphNear(),()=>f.liftEmptyBlock(),()=>f.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},c={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return CP()||coe()?c:o},addProseMirrorPlugins(){return[new Po({key:new Aa("clearDocument"),appendTransaction:(t,e,i)=>{if(t.some(B=>B.getMeta("composition")))return;const n=t.some(B=>B.docChanged)&&!e.doc.eq(i.doc),o=t.some(B=>B.getMeta("preventClearDocument"));if(!n||o)return;const{empty:c,from:f,to:r}=e.selection,x=zr.atStart(e.doc).from,S=zr.atEnd(e.doc).to;if(c||!(f===x&&r===S)||!OM(i.doc))return;const N=i.tr,D=RM({state:i,transaction:N}),{commands:V}=new jM({editor:this.editor,state:D});if(V.clearNodes(),!!N.steps.length)return N}})]}}),Doe=$s.create({name:"paste",addProseMirrorPlugins(){return[new Po({key:new Aa("tiptapPaste"),props:{handlePaste:(t,e,i)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:i})}}})]}}),Roe=$s.create({name:"tabindex",addProseMirrorPlugins(){return[new Po({key:new Aa("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),joe=$s.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Lb(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const i=e.getAttribute("dir");return i&&(i==="ltr"||i==="rtl"||i==="auto")?i:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Po({key:new Aa("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),vRe=class XS{constructor(e,i,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=i,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let i=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}i=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:i,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),i=this.resolvedPos.doc.resolve(e);return new XS(i,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new XS(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new XS(e,this.editor)}get children(){const e=[];return this.node.content.forEach((i,n)=>{const o=i.isBlock&&!i.isTextblock,c=i.isAtom&&!i.isText,f=i.isInline,r=this.pos+n+(c?0:1);if(r<0||r>this.resolvedPos.doc.nodeSize-2)return;const x=this.resolvedPos.doc.resolve(r);if(!o&&!f&&x.depth<=this.depth)return;const S=new XS(x,this.editor,o,o||f?i:null);o&&(S.actualDepth=this.depth+1),e.push(S)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,i={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===e)if(Object.keys(i).length>0){const c=o.node.attrs,f=Object.keys(i);for(let r=0;r<f.length;r+=1){const x=f[r];if(c[x]!==i[x])break}}else n=o;o=o.parent}return n}querySelector(e,i={}){return this.querySelectorAll(e,i,!0)[0]||null}querySelectorAll(e,i={},n=!1){let o=[];if(!this.children||this.children.length===0)return o;const c=Object.keys(i);return this.children.forEach(f=>{n&&o.length>0||(f.node.type.name===e&&c.every(x=>i[x]===f.node.attrs[x])&&o.push(f),!(n&&o.length>0)&&(o=o.concat(f.querySelectorAll(e,i,n))))}),o}setAttribute(e){const{tr:i}=this.editor.state;i.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(i)}},xRe=`.ProseMirror { 3736 position: relative; 3737} 3738 3739.ProseMirror { 3740 word-wrap: break-word; 3741 white-space: pre-wrap; 3742 white-space: break-spaces; 3743 -webkit-font-variant-ligatures: none; 3744 font-variant-ligatures: none; 3745 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 3746} 3747 3748.ProseMirror [contenteditable="false"] { 3749 white-space: normal; 3750} 3751 3752.ProseMirror [contenteditable="false"] [contenteditable="true"] { 3753 white-space: pre-wrap; 3754} 3755 3756.ProseMirror pre { 3757 white-space: pre-wrap; 3758} 3759 3760img.ProseMirror-separator { 3761 display: inline !important; 3762 border: none !important; 3763 margin: 0 !important; 3764 width: 0 !important; 3765 height: 0 !important; 3766} 3767 3768.ProseMirror-gapcursor { 3769 display: none; 3770 pointer-events: none; 3771 position: absolute; 3772 margin: 0; 3773} 3774 3775.ProseMirror-gapcursor:after {
3776 content: ""; 3777 display: block; 3778 position: absolute; 3779 top: -2px; 3780 width: 20px; 3781 border-top: 1px solid black; 3782 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 3783} 3784 3785@keyframes ProseMirror-cursor-blink { 3786 to { 3787 visibility: hidden; 3788 } 3789} 3790 3791.ProseMirror-hideselection *::selection { 3792 background: transparent; 3793} 3794 3795.ProseMirror-hideselection *::-moz-selection { 3796 background: transparent; 3797} 3798 3799.ProseMirror-hideselection * { 3800 caret-color: transparent; 3801} 3802 3803.ProseMirror-focused .ProseMirror-gapcursor { 3804 display: block; 3805}`;function bRe(t,e,i){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var wRe=class extends lRe{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:FDe,createMappablePosition:BDe},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:o,moved:c})=>this.options.onDrop(n,o,c)),this.on("paste",({event:n,slice:o})=>this.options.onPaste(n,o)),this.on("delete",this.options.onDelete);const e=this.createDoc(),i=aoe(e,this.options.autofocus);this.editorState=m0.create({doc:e,schema:this.schema,selection:i||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=bRe(xRe,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}
vendor: 8,210 bytes, lines 3805-3807
3805),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const i=hoe(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let i=e;if([].concat(t).forEach(o=>{const c=typeof o=="string"?`${o}$`:o.key;i=i.filter(f=>!f.key.startsWith(c))}),e.length===i.length)return;const n=this.state.reconfigure({plugins:i});return this.view.updateState(n),n}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[koe,Coe.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Eoe,Noe,Moe,Roe,Ioe,Doe,Aoe,joe.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new BM(n,this)}createCommandManager(){this.commandManager=new jM({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=KO(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(i=>i.name!=="collaboration"),this.createExtensionManager()}}),t=KO(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:i}=this.options,n=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=i?this.extensionManager.dispatchTransaction(n):n;this.editorView=new ioe(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const f=this.view.dom;f.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(S=>{var C;return(C=this.capturedTransaction)==null?void 0:C.step(S)});return}const{state:e,transactions:i}=this.state.applyTransaction(t),n=!this.state.selection.eq(e.selection),o=i.includes(t),c=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:i.slice(1)}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const f=i.findLast(S=>S.getMeta("focus")||S.getMeta("blur")),r=f==null?void 0:f.getMeta("focus"),x=f==null?void 0:f.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:f}),x&&this.emit("blur",{editor:this,event:x.event,transaction:f}),!(t.getMeta("preventUpdate")||!i.some(S=>S.docChanged)||c.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:i.slice(1)})}getAttributes(t){return yoe(this.state,t)}isActive(t,e){const i=typeof t=="string"?t:null,n=typeof t=="string"?e:t;return zDe(this.state,i,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dB(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` 3806 3807`,textSerializers:i={}}=t||{};return PDe(this.state.doc,{blockSeparator:e,textSerializers:{...goe(this.schema),...i}})}get isEmpty(){return OM(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var i;return((i=this.$doc)==null?void 0:i.querySelector(t,e))||null}$nodes(t,e){var i;return((i=this.$doc)==null?void 0:i.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new vRe(e,this)}get $doc(){return this.$pos(0)}};function Ob(t){return new FM({find:t.find,handler:({state:e,range:i,match:n})=>{const o=Bs(t.getAttributes,void 0,n);if(o===!1||o===null)return null;const{tr:c}=e,f=n[n.length-1],r=n[0];if(f){const x=r.search(/\S/),S=i.from+r.indexOf(f),C=S+f.length;if(hB(i.from,i.to,e.doc).filter(D=>D.mark.type.excluded.find(B=>B===t.type&&B!==D.mark.type)).filter(D=>D.to>S).length)return null;C<i.to&&c.delete(C,i.to),S>i.from&&c.delete(i.from+x,S);const N=i.from+x+f.length;c.addMark(i.from+x,N,t.type.create(o||{})),c.removeStoredMark(t.type)}},undoable:t.undoable})}function SRe(t){return new FM({find:t.find,handler:({state:e,range:i,match:n})=>{const o=Bs(t.getAttributes,void 0,n)||{},{tr:c}=e,f=i.from;let r=i.to;const x=t.type.create(o);if(n[1]){const S=n[0].lastIndexOf(n[1]);let C=f+S;C>r?C=r:r=C+n[1].length;const I=n[0][n[0].length-1];c.insertText(I,f+n[0].length-1),c.replaceWith(C,r,x)}else if(n[0]){const S=t.type.isInline?f:f-1;c.insert(S,t.type.create(o)).delete(c.mapping.map(f),c.mapping.map(r))}c.scrollIntoView()},undoable:t.undoable})}function XO(t){return new FM({find:t.find,handler:({state:e,range:i,match:n})=>{const o=e.doc.resolve(i.from),c=Bs(t.getAttributes,void 0,n)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(i.from,i.to).setBlockType(i.from,i.from,t.type,c)},undoable:t.undoable})}function Fb(t){return new FM({find:t.find,handler:({state:e,range:i,match:n,chain:o})=>{const c=Bs(t.getAttributes,void 0,n)||{},f=e.tr.delete(i.from,i.to),x=f.doc.resolve(i.from).blockRange(),S=x&&K4(x,t.type,c);if(!S)return null;if(f.wrap(x,S),t.keepMarks&&t.editor){const{selection:I,storedMarks:N}=e,{splittableMarks:D}=t.editor.extensionManager,V=N||I.$to.parentOffset&&I.$from.marks();if(V){const B=V.filter(W=>D.includes(W.type.name));f.ensureMarks(B)}}if(t.keepAttributes){const I=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(I,c).run()}const C=f.doc.resolve(i.from-1).nodeBefore;C&&C.type===t.type&&Og(f.doc,i.from-1)&&(!t.joinPredicate||t.joinPredicate(n,C))&&f.join(i.from-1)},undoable:t.undoable})}function TRe(t,e){const{selection:i}=t,{$from:n}=i;if(i instanceof qn){const c=n.index();return n.parent.canReplaceWith(c,c+1,e)}let o=n.depth;for(;o>=0;){const c=n.index(o);if(n.node(o).contentMatchAt(c).matchType(e))return!0;o-=1}return!1}var CRe={};aB(CRe,{createAtomBlockMarkdownSpec:()=>ERe,createBlockMarkdownSpec:()=>ARe,createInlineMarkdownSpec:()=>PRe,parseAttributes:()=>fB,parseIndentedBlocks:()=>YO,renderNestedMarkdownContent:()=>gB,serializeAttributes:()=>mB});function fB(t){if(!(t!=null&&t.trim()))return{};const e={},i=[],n=t.replace(/["']([^"']*)["']/g,S=>(i.push(S),`__QUOTED_${i.length-1}
3807__`)),o=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const S=o.map(C=>C.trim().slice(1));e.class=S.join(" ")}const c=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);c&&(e.id=c[1]);const f=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(f)).forEach(([,S,C])=>{var I;const N=parseInt(((I=C.match(/__QUOTED_(\d+)__/))==null?void 0:I[1])||"0",10),D=i[N];D&&(e[S]=D.slice(1,-1))});const x=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return x&&x.split(/\s+/).filter(Boolean).forEach(C=>{C.match(/^[a-zA-Z][\w-]*$/)&&(e[C]=!0)}),e}function mB(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([i,n])=>{i==="class"||i==="id"||(n===!0?e.push(i):n!==!1&&n!=null&&e.push(`${i}="${String(n)}"`))}),e.join(" ")}function ERe(t){const{nodeName:e,name:i,parseAttributes:n=fB,serializeAttributes:o=mB,defaultAttributes:c={},requiredAttributes:f=[],allowedAttributes:r}=t,x=i||e,S=C=>{if(!r)return C;const I={};return r.forEach(N=>{N in C&&(I[N]=C[N])}),I};return{parseMarkdown:(C,I)=>{const N={...c,...C.attributes};return I.createNode(e,N,[])},markdownTokenizer:{name:e,level:"block",start(C){var I;const N=new RegExp(`^:::${x}(?:\\s|$)`,"m"),D=(I=C.match(N))==null?void 0:I.index;return D!==void 0?D:-1},tokenize(C,I,N){const D=new RegExp(`^:::${x}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),V=C.match(D);if(!V)return;const B=V[1]||"",W=n(B);if(!f.find(G=>!(G in W)))return{type:e,raw:V[0],attributes:W}}},renderMarkdown:C=>{const I=S(C.attrs||{}),N=o(I),D=N?` {${N}}`:"";return`:::${x}${D} :::`}}}function ARe(t){const{nodeName:e,name:i,getContent:n,parseAttributes:o=fB,serializeAttributes:c=mB,defaultAttributes:f={},content:r="block",allowedAttributes:x}=t,S=i||e,C=I=>{if(!x)return I;const N={};return x.forEach(D=>{D in I&&(N[D]=I[D])}),N};return{parseMarkdown:(I,N)=>{let D;if(n){const B=n(I);D=typeof B=="string"?[{type:"text",text:B}]:B}else r==="block"?D=N.parseChildren(I.tokens||[]):D=N.parseInline(I.tokens||[]);const V={...f,...I.attributes};return N.createNode(e,V,D)},markdownTokenizer:{name:e,level:"block",start(I){var N;const D=new RegExp(`^:::${S}`,"m"),V=(N=I.match(D))==null?void 0:N.index;return V!==void 0?V:-1},tokenize(I,N,D){var V;const B=new RegExp(`^:::${S}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),W=I.match(B);if(!W)return;const[$,G=""]=W,te=o(G);let ce=1;const _e=$.length;let Te="";const we=/^:::([\w-]*)(\s.*)?/gm,Ne=I.slice(_e);for(we.lastIndex=0;;){const pe=we.exec(Ne);if(pe===null)break;const Pe=pe.index,De=pe[1];if(!((V=pe[2])!=null&&V.endsWith(":::"))){if(De)ce+=1;else if(ce-=1,ce===0){const Je=Ne.slice(0,Pe);Te=Je.trim();const dt=I.slice(0,_e+Pe+pe[0].length);let At=[];if(Te)if(r==="block")for(At=D.blockTokens(Je),At.forEach(qt=>{qt.text&&(!qt.tokens||qt.tokens.length===0)&&(qt.tokens=D.inlineTokens(qt.text))});At.length>0;){const qt=At[At.length-1];if(qt.type==="paragraph"&&(!qt.text||qt.text.trim()===""))At.pop();else break}else At=D.inlineTokens(Te);return{type:e,raw:dt,attributes:te,content:Te,tokens:At}}}}}},renderMarkdown:(I,N)=>{const D=C(I.attrs||{}),V=c(D),B=V?` {${V}}`:"",W=N.renderChildren(I.content||[],` 3808 3809`);return`:::${S}${B} 3810 3811${W} 3812 3813:::`}}}function IRe(t){if(!t.trim())return{};const e={},i=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=i.exec(t);for(;n!==null;){const[,o,c,f]=n;e[o]=c||f,n=i.exec(t)}return e}function kRe(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,i])=>`${e}="${i}"`).join(" ")}function PRe(t){const{nodeName:e,name:i,getContent:n,parseAttributes:o=IRe,serializeAttributes:c=kRe,defaultAttributes:f={},selfClosing:r=!1,allowedAttributes:x}=t,S=i||e,C=N=>{if(!x)return N;const D={};return x.forEach(V=>{const B=typeof V=="string"?V:V.name,W=typeof V=="string"?void 0:V.skipIfDefault;if(B in N){const $=N[B];if(W!==void 0&&$===W)return;D[B]=$}}),D},I=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(N,D)=>{const V={...f,...N.attributes};if(r)return D.createNode(e,V);
vendor: 2,326 bytes, lines 3813-3822
3813const B=n?n(N):N.content||"";return B?D.createNode(e,V,[D.createTextNode(B)]):D.createNode(e,V,[])},markdownTokenizer:{name:e,level:"inline",start(N){const D=r?new RegExp(`\\[${I}\\s*[^\\]]*\\]`):new RegExp(`\\[${I}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${I}\\]`),V=N.match(D),B=V==null?void 0:V.index;return B!==void 0?B:-1},tokenize(N,D,V){const B=r?new RegExp(`^\\[${I}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${I}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${I}\\]`),W=N.match(B);if(!W)return;let $="",G="";if(r){const[,ce]=W;G=ce}else{const[,ce,_e]=W;G=ce,$=_e||""}const te=o(G.trim());return{type:e,raw:W[0],content:$.trim(),attributes:te}}},renderMarkdown:N=>{let D="";n?D=n(N):N.content&&N.content.length>0&&(D=N.content.filter($=>$.type==="text").map($=>$.text).join(""));const V=C(N.attrs||{}),B=c(V),W=B?` ${B}`:"";return r?`[${S}${W}]`:`[${S}${W}]${D}[/${S}]`}}}function YO(t,e,i){var n,o,c,f;const r=t.split(` 3814`),x=[];let S="",C=0;const I=e.baseIndentSize||2;for(;C<r.length;){const N=r[C],D=N.match(e.itemPattern);if(!D){if(x.length>0)break;if(N.trim()===""){C+=1,S=`${S}${N} 3815`;continue}else return}const V=e.extractItemData(D),{indentLevel:B,mainContent:W}=V;S=`${S}${N} 3816`;const $=[W];for(C+=1;C<r.length;){const _e=r[C];if(_e.trim()===""){const we=r.slice(C+1).findIndex(Pe=>Pe.trim()!=="");if(we===-1)break;if((((o=(n=r[C+1+we].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:o.length)||0)>B){$.push(_e),S=`${S}${_e} 3817`,C+=1;continue}else break}if((((f=(c=_e.match(/^(\s*)/))==null?void 0:c[1])==null?void 0:f.length)||0)>B)$.push(_e),S=`${S}${_e} 3818`,C+=1;else break}let G;const te=$.slice(1);if(te.length>0){const _e=te.map(Te=>Te.slice(B+I)).join(` 3819`);_e.trim()&&(e.customNestedParser?G=e.customNestedParser(_e):G=i.blockTokens(_e))}const ce=e.createToken(V,G);x.push(ce)}if(x.length!==0)return{items:x,raw:S}}function gB(t,e,i,n){if(!t||!Array.isArray(t.content))return"";const o=typeof i=="function"?i(n):i,[c,...f]=t.content,r=e.renderChildren([c]),x=[`${o}${r}`];return f&&f.length>0&&f.forEach(S=>{const C=e.renderChildren([S]);if(C){const I=C.split(` 3820`).map(N=>N?e.indent(N):"").join(` 3821`);x.push(I)}}),x.join(` 3822`)}function NRe(t,e,i={}){const{state:n}=e,{doc:o,tr:c}=n,f=t;o.descendants((r,x)=>{const S=c.mapping.map(x),C=c.mapping.map(x)+r.nodeSize;let I=null;if(r.marks.forEach(D=>{if(D!==f)return!1;I=D}),!I)return;let N=!1;
3822if(Object.keys(i).forEach(D=>{i[D]!==I.attrs[D]&&(N=!0)}),N){const D=t.type.create({...t.attrs,...i});c.removeMark(S,C,t.type),c.addMark(S,C,D)}}),c.docChanged&&e.view.dispatch(c)}var du=class zoe extends pB{constructor(){super(...arguments),this.type="node"}static create(e={}){const i=typeof e=="function"?e():e;return new zoe(i)}configure(e){return super.configure(e)}extend(e){const i=typeof e=="function"?e():e;return super.extend(i)}};function tv(t){return new pRe({find:t.find,handler:({state:e,range:i,match:n,pasteEvent:o})=>{const c=Bs(t.getAttributes,void 0,n,o);if(c===!1||c===null)return null;const{tr:f}=e,r=n[n.length-1],x=n[0];let S=i.to;if(r){const C=x.search(/\S/),I=i.from+x.indexOf(r),N=I+r.length;if(hB(i.from,i.to,e.doc).filter(V=>V.mark.type.excluded.find(W=>W===t.type&&W!==V.mark.type)).filter(V=>V.to>I).length)return null;N<i.to&&f.delete(N,i.to),I>i.from&&f.delete(i.from+C,I),S=i.from+C+r.length,f.addMark(i.from+C,S,t.type.create(c||{})),f.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:MRe,getOwnPropertySymbols:DRe}=Object,{hasOwnProperty:RRe}=Object.prototype;function gz(t,e){return function(n,o,c){return t(n,o,c)&&e(n,o,c)}}function fI(t){return function(i,n,o){if(!i||!n||typeof i!="object"||typeof n!="object")return t(i,n,o);const{cache:c}=o,f=c.get(i),r=c.get(n);if(f&&r)return f===n&&r===i;c.set(i,n),c.set(n,i);const x=t(i,n,o);return c.delete(i),c.delete(n),x}}function jRe(t){return t!=null?t[Symbol.toStringTag]:void 0}function uG(t){return MRe(t).concat(DRe(t))}const zRe=Object.hasOwn||((t,e)=>RRe.call(t,e));function pv(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const LRe="__v",ORe="__o",FRe="_owner",{getOwnPropertyDescriptor:dG,keys:hG}=Object;function BRe(t,e){return t.byteLength===e.byteLength&&AP(new Uint8Array(t),new Uint8Array(e))}function URe(t,e,i){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!i.equals(t[n],e[n],n,n,t,e,i))return!1;return!0}function VRe(t,e){return t.byteLength===e.byteLength&&AP(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function $Re(t,e){return pv(t.getTime(),e.getTime())}function qRe(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function HRe(t,e){return t===e}function pG(t,e,i){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const o=new Array(n),c=t.entries();let f,r,x=0;for(;(f=c.next())&&!f.done;){const S=e.entries();let C=!1,I=0;for(;(r=S.next())&&!r.done;){if(o[I]){I++;continue}const N=f.value,D=r.value;if(i.equals(N[0],D[0],x,I,t,e,i)&&i.equals(N[1],D[1],N[0],D[0],t,e,i)){C=o[I]=!0;break}I++}if(!C)return!1;x++}return!0}const GRe=pv;function WRe(t,e,i){const n=hG(t);let o=n.length;if(hG(e).length!==o)return!1;for(;o-- >0;)if(!Loe(t,e,i,n[o]))return!1;return!0}function NS(t,e,i){const n=uG(t);let o=n.length;if(uG(e).length!==o)return!1;let c,f,r;for(;o-- >0;)if(c=n[o],!Loe(t,e,i,c)||(f=dG(t,c),r=dG(e,c),(f||r)&&(!f||!r||f.configurable!==r.configurable||f.enumerable!==r.enumerable||f.writable!==r.writable)))return!1;return!0}function KRe(t,e){return pv(t.valueOf(),e.valueOf())}function ZRe(t,e){return t.source===e.source&&t.flags===e.flags}function fG(t,e,i){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const o=new Array(n),c=t.values();let f,r;for(;(f=c.next())&&!f.done;){const x=e.values();let S=!1,C=0;for(;(r=x.next())&&!r.done;){if(!o[C]&&i.equals(f.value,r.value,f.value,r.value,t,e,i)){S=o[C]=!0;break}C++}if(!S)return!1}return!0}function AP(t,e){let i=t.byteLength;if(e.byteLength!==i||t.byteOffset!==e.byteOffset)return!1;for(;i-- >0;)if(t[i]!==e[i])return!1;return!0}function XRe(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function Loe(t,e,i,n){return(n===FRe||n===ORe||n===LRe)&&(t.$$typeof||e.$$typeof)?!0:zRe(e,n)&&i.equals(t[n],e[n],n,n,t,e,i)}const YRe="[object ArrayBuffer]",QRe="[object Arguments]",JRe="[object Boolean]",eje="[object DataView]",tje="[object Date]",ije="[object Error]",nje="[object Map]",rje="[object Number]",
3822sje="[object Object]",oje="[object RegExp]",aje="[object Set]",lje="[object String]",cje={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},uje="[object URL]",dje=Object.prototype.toString;function hje({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:i,areDatesEqual:n,areErrorsEqual:o,areFunctionsEqual:c,areMapsEqual:f,areNumbersEqual:r,areObjectsEqual:x,arePrimitiveWrappersEqual:S,areRegExpsEqual:C,areSetsEqual:I,areTypedArraysEqual:N,areUrlsEqual:D,unknownTagComparators:V}){return function(W,$,G){if(W===$)return!0;if(W==null||$==null)return!1;const te=typeof W;if(te!==typeof $)return!1;if(te!=="object")return te==="number"?r(W,$,G):te==="function"?c(W,$,G):!1;const ce=W.constructor;if(ce!==$.constructor)return!1;if(ce===Object)return x(W,$,G);if(Array.isArray(W))return e(W,$,G);if(ce===Date)return n(W,$,G);if(ce===RegExp)return C(W,$,G);if(ce===Map)return f(W,$,G);if(ce===Set)return I(W,$,G);const _e=dje.call(W);if(_e===tje)return n(W,$,G);if(_e===oje)return C(W,$,G);if(_e===nje)return f(W,$,G);if(_e===aje)return I(W,$,G);if(_e===sje)return typeof W.then!="function"&&typeof $.then!="function"&&x(W,$,G);if(_e===uje)return D(W,$,G);if(_e===ije)return o(W,$,G);if(_e===QRe)return x(W,$,G);if(cje[_e])return N(W,$,G);if(_e===YRe)return t(W,$,G);if(_e===eje)return i(W,$,G);if(_e===JRe||_e===rje||_e===lje)return S(W,$,G);if(V){let Te=V[_e];if(!Te){const we=jRe(W);we&&(Te=V[we])}if(Te)return Te(W,$,G)}return!1}}function pje({circular:t,createCustomConfig:e,strict:i}){let n={areArrayBuffersEqual:BRe,areArraysEqual:i?NS:URe,areDataViewsEqual:VRe,areDatesEqual:$Re,areErrorsEqual:qRe,areFunctionsEqual:HRe,areMapsEqual:i?gz(pG,NS):pG,areNumbersEqual:GRe,areObjectsEqual:i?NS:WRe,arePrimitiveWrappersEqual:KRe,areRegExpsEqual:ZRe,areSetsEqual:i?gz(fG,NS):fG,areTypedArraysEqual:i?gz(AP,NS):AP,areUrlsEqual:XRe,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const o=fI(n.areArraysEqual),c=fI(n.areMapsEqual),f=fI(n.areObjectsEqual),r=fI(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:o,areMapsEqual:c,areObjectsEqual:f,areSetsEqual:r})}return n}function fje(t){return function(e,i,n,o,c,f,r){return t(e,i,r)}}function mje({circular:t,comparator:e,createState:i,equals:n,strict:o}){if(i)return function(r,x){const{cache:S=t?new WeakMap:void 0,meta:C}=i();return e(r,x,{cache:S,equals:n,meta:C,strict:o})};if(t)return function(r,x){return e(r,x,{cache:new WeakMap,equals:n,meta:void 0,strict:o})};const c={cache:void 0,equals:n,meta:void 0,strict:o};return function(r,x){return e(r,x,c)}}const gje=Ug();Ug({strict:!0});Ug({circular:!0});Ug({circular:!0,strict:!0});Ug({createInternalComparator:()=>pv});Ug({strict:!0,createInternalComparator:()=>pv});Ug({circular:!0,createInternalComparator:()=>pv});Ug({circular:!0,createInternalComparator:()=>pv,strict:!0});function Ug(t={}){const{circular:e=!1,createInternalComparator:i,createState:n,strict:o=!1}=t,c=pje(t),f=hje(c),r=i?i(f):fje(f);return mje({circular:e,comparator:f,createState:n,equals:r,strict:o})}var Ooe={exports:{}},Foe={};/** 3823 * @license React 3824 * use-sync-external-store-shim/with-selector.production.js 3825 * 3826 * Copyright (c) Meta Platforms, Inc. and affiliates. 3827 * 3828 * This source code is licensed under the MIT license found in the 3829 * LICENSE file in the root directory of this source tree. 3830 */var UM=K,yje=cE;function _je(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var vje=typeof Object.is=="function"?Object.is:_je,xje=yje.useSyncExternalStore,bje=UM.useRef,wje=UM.useEffect,Sje=UM.useMemo,Tje=UM.useDebugValue;Foe.useSyncExternalStoreWithSelector=function(t,e,i,n,o){var c=bje(null);if(c.current===null){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=Sje(function(){function x(D){if(!S){if(S=!0,C=D,D=n(D),o!==void 0&&f.hasValue){var V=f.value;if(o(V,D))return I=V}return I=D}if(V=I,vje(C,D))return V;var B=n(D);return o!==void 0&&o(V,B)?(C=D,V):(C=D,I=B)}var S=!1,C,I,N=i===void 0?null:i;return[function(){return x(e())},N===null?void 0:function(){return x(N())}]},[e,i,n,o]);var r=xje(t,c[0],c[1]);return wje(function(){f.hasValue=!0,f.value=r},[r]),Tje(r),r};Ooe.exports=Foe;var Cje=Ooe.exports,Eje=(...t)=>e=>{t.forEach(i=>
3830{typeof i=="function"?i(e):i&&(i.current=e)})},Aje=({contentComponent:t})=>{const e=cE.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return d.jsx(d.Fragment,{children:Object.values(e)})};function Ije(){const t=new Set;let e={};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,n){e={...e,[i]:gQ.createPortal(n.reactElement,n.element,i)},t.forEach(o=>o())},removeRenderer(i){const n={...e};delete n[i],e=n,t.forEach(o=>o())}}}var kje=class extends Tn.Component{constructor(t){var e;super(t),this.editorContentRef=Tn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const i=this.editorContentRef.current;i.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:i}),e.contentComponent=Ije(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const i=document.createElement("div");i.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:i})}catch{}}}render(){const{editor:t,innerRef:e,...i}=this.props;return d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:Eje(e,this.editorContentRef),...i}),(t==null?void 0:t.contentComponent)&&d.jsx(Aje,{contentComponent:t.contentComponent})]})}},Pje=K.forwardRef((t,e)=>{const i=Tn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Tn.createElement(kje,{key:i,innerRef:e,...t})}),Boe=Tn.memo(Pje),Nje=typeof window<"u"?K.useLayoutEffect:K.useEffect,Mje=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(n=>n())},i=this.editor;return i.on("transaction",e),()=>{i.off("transaction",e)}}}};function Dje(t){var e;const[i]=K.useState(()=>new Mje(t.editor)),n=Cje.useSyncExternalStoreWithSelector(i.subscribe,i.getSnapshot,i.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:gje);return Nje(()=>i.watch(t.editor),[t.editor,i]),K.useDebugValue(n),n}var Rje=!1,QO=typeof window>"u",jje=QO||!!(typeof window<"u"&&window.next),zje=class Uoe{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(i=>
3830i())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return QO||jje?null:this.createEditor();if(this.options.current.immediatelyRender&&QO&&Rje)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var o,c;return(c=(o=this.options.current).onBeforeCreate)==null?void 0:c.call(o,...n)},onBlur:(...n)=>{var o,c;return(c=(o=this.options.current).onBlur)==null?void 0:c.call(o,...n)},onCreate:(...n)=>{var o,c;return(c=(o=this.options.current).onCreate)==null?void 0:c.call(o,...n)},onDestroy:(...n)=>{var o,c;return(c=(o=this.options.current).onDestroy)==null?void 0:c.call(o,...n)},onFocus:(...n)=>{var o,c;return(c=(o=this.options.current).onFocus)==null?void 0:c.call(o,...n)},onSelectionUpdate:(...n)=>{var o,c;return(c=(o=this.options.current).onSelectionUpdate)==null?void 0:c.call(o,...n)},onTransaction:(...n)=>{var o,c;return(c=(o=this.options.current).onTransaction)==null?void 0:c.call(o,...n)},onUpdate:(...n)=>{var o,c;return(c=(o=this.options.current).onUpdate)==null?void 0:c.call(o,...n)},onContentError:(...n)=>{var o,c;return(c=(o=this.options.current).onContentError)==null?void 0:c.call(o,...n)},onDrop:(...n)=>{var o,c;return(c=(o=this.options.current).onDrop)==null?void 0:c.call(o,...n)},onPaste:(...n)=>{var o,c;return(c=(o=this.options.current).onPaste)==null?void 0:c.call(o,...n)},onDelete:(...n)=>{var o,c;return(c=(o=this.options.current).onDelete)==null?void 0:c.call(o,...n)}};return new wRe(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,i){return Object.keys(e).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&e.extensions&&i.extensions?e.extensions.length!==i.extensions.length?!1:e.extensions.every((o,c)=>{var f;return o===((f=i.extensions)==null?void 0:f[c])}):e[n]===i[n])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Uoe.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,o)=>n===e[o]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,i=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){i&&i.setOptions(this.options.current);return}i&&!i.isDestroyed&&(i.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Lje(t={},e=[]){const i=K.useRef(t);i.current=t;const[n]=K.useState(()=>new zje(i)),o=cE.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return K.useDebugValue(o),K.useEffect(n.onRender(e)),Dje({editor:o,selector:({transactionNumber:c})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&c===0?0:c+1}),o}var Voe=K.createContext({editor:null});Voe.Consumer;var Oje=K.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Fje=()=>K.useContext(Oje);Tn.forwardRef((t,e)=>{const{onDragStart:i}=Fje(),n=t.as||"div";return d.jsx(n,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:i,style:{whiteSpace:"normal",...t.style}})});Tn.createContext({markViewContentRef:()=>{}});var yB=K.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});yB.displayName="TiptapContext";var Bje=()=>K.useContext(yB);function $oe({editor:t,instance:e,children:i}){const n=t??e;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const o=K.useMemo(()=>({editor:n}),[n]),c=K.useMemo(()=>({editor:n}),[n]);return d.jsx(Voe.Provider,{value:c,children:d.jsx(yB.Provider,{value:o,children:i})})}$oe.displayName="Tiptap";function qoe({...t}){const{editor:e}=Bje();return d.jsx(Boe,{editor:e,...t})}qoe.displayName="Tiptap.Content";Object.assign($oe,{Content:qoe});var IP=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:i,...n}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,n,i]},Uje=/^\s*>\s$/,Vje=du.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return IP("blockquote",{...ea(this.options.HTMLAttributes,t),children:IP("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const i=">",n=[];return t.content.forEach(o=>{const r=e.renderChildren([o]).split(` 3831`).map(x=>x.trim()===""?i:`${i} ${x}`);n.push(r.join(` 3832`))}),n.join(` 3833${i} 3834`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}}
vendor: 14,700 bytes, lines 3834-3855
3834,addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Fb({find:Uje,type:this.type})]}}),$je=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,qje=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Hje=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Gje=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Wje=Bg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return IP("strong",{...ea(this.options.HTMLAttributes,t),children:IP("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ob({find:$je,type:this.type}),Ob({find:Hje,type:this.type})]},addPasteRules(){return[tv({find:qje,type:this.type}),tv({find:Gje,type:this.type})]}}),Kje=/(^|[^`])`([^`]+)`(?!`)$/,Zje=/(^|[^`])`([^`]+)`(?!`)/g,Xje=Bg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ea(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ob({find:Kje,type:this.type})]},addPasteRules(){return[tv({find:Zje,type:this.type})]}}),yz=4,Yje=/^```([a-z]+)?[\s\n]$/,Qje=/^~~~([a-z]+)?[\s\n]$/,Jje=du.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:yz,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:i}=this.options;if(!i)return null;const c=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(f=>f.startsWith(i)).map(f=>f.replace(i,""))[0];return c||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ea(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var i;return((i=t.raw)==null?void 0:i.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var i;let n="";const o=((i=t.attrs)==null?void 0:i.language)||"";return t.content?n=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(` 3835`):n=`\`\`\`${o} 3836 3837\`\`\``,n},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,i=e.pos===1;return!t||e.parent.type.name!==this.name?!1:i||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const i=(e=this.options.tabSize)!=null?e:yz,{state:n}=t,{selection:o}=n,{$from:c,empty:f}=o;if(c.parent.type!==this.type)return!1;const r=" ".repeat(i);return f?t.commands.insertContent(r):t.commands.command(({tr:x})=>{const{from:S,to:C}=o,D=n.doc.textBetween(S,C,` 3838`,` 3839`).split(` 3840`).map(V=>r+V).join(` 3841`);return x.replaceWith(S,C,n.schema.text(D)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const i=(e=this.options.tabSize)!=null?e:yz,{state:n}=t,{selection:o}=n,{$from:c,empty:f}=o;return c.parent.type!==this.type?!1:f?t.commands.command(({tr:r})=>{var x;const{pos:S}=c,C=c.start(),I=c.end(),D=n.doc.textBetween(C,I,` 3842`,` 3843`).split(` 3844`);let V=0,B=0;const W=S-C;for(let Te=0;Te<D.length;Te+=1){if(B+D[Te].length>=W){V=Te;break}B+=D[Te].length+1}const G=((x=D[V].match(/^ */))==null?void 0:x[0])||"",te=Math.min(G.length,i);if(te===0)return!0;let ce=C;for(let Te=0;Te<V;Te+=1)ce+=D[Te].length+1;return r.delete(ce,ce+te),S-ce<=te&&r.setSelection(br.create(r.doc,ce)),!0}):t.commands.command(({tr:r})=>{const{from:x,to:S}=o,N=n.doc.textBetween(x,S,` 3845`,` 3846`).split(` 3847`).map(D=>{var V;const B=((V=D.match(/^ */))==null?void 0:V[0])||"",W=Math.min(B.length,i);return D.slice(W)}).join(` 3848`);return r.replaceWith(x,S,n.schema.text(N)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:i}=e,{$from:n,empty:o}=i;if(!o||n.parent.type!==this.type)return!1;const c=n.parentOffset===n.parent.nodeSize-2,f=n.parent.textContent.endsWith(` 3849 3850`);return!c||!f?!1:t.chain().command(({tr:r})=>(r.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:i,doc:n}=e,{$from:o,empty:c}=i;if(!c||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const r=o.after();return r===void 0?!1:n.nodeAt(r)?t.commands.command(({tr:S})=>(S.setSelection(zr.near(n.resolve(r))),!0)):t.commands.exitCode()}}},addInputRules(){return[XO({find:Yje,type:this.type,getAttributes:t=>({language:t[1]})}),XO({find:Qje,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Po({key:new Aa("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const i=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),o=n?JSON.parse(n):void 0,c=o==null?void 0:o.mode;if(!i||!c)return!1;const{tr:f,schema:r}=t.state,x=r.text(i.replace(/\r\n?/g,` 3851`));return f.replaceSelectionWith(this.type.create({language:c},x)),f.selection.$from.parent.type!==this.type&&f.setSelection(br.near(f.doc.resolve(Math.max(0,f.selection.from-2)))),f.setMeta("paste",!0),t.dispatch(f),!0}}})]}}),eze=du.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 3852 3853`):""}),tze=du.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ea(this.options.HTMLAttributes,t)]},renderText(){return` 3854`},renderMarkdown:()=>` 3855`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:c}=i;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:f}=this.options,{splittableMarks:r}=n.extensionManager,x=c||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:S,dispatch:C})=>{if(C&&x&&f){const I=x.filter(N=>r.includes(N.type.name));S.ensureMarks(I)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ize=du.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ea(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var i;const n=(i=t.attrs)!=null&&i.level?parseInt(t.attrs.level,10):1,o="#".repeat(n);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>XO({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),nze=du.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ea(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!TRe(e,e.schema.nodes[this.name]))return!1;const{selection:i}=e,{$to:n}=i,o=t();return voe(i)?o.insertContentAt(n.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:c,tr:f,dispatch:r})=>{if(r){const{$to:x}=f.selection,S=x.end();if(x.nodeAfter)x.nodeAfter.isTextblock?f.setSelection(br.create(f.doc,x.pos+1)):x.nodeAfter.isBlock?f.setSelection(qn.create(f.doc,x.pos)):f.setSelection(br.create(f.doc,x.pos));else{const C=c.schema.nodes[this.options.nextNodeType]||x.parent.type.contentMatch.defaultType,I=C==null?void 0:C.create();I&&(f.insert(S,I),f.setSelection(br.create(f.doc,S+1)))}f.scrollIntoView()}return!0}).run()}}},addInputRules(){return[SRe({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.type})]}}),rze=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sze=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,oze=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,aze=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,lze=Bg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ea(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ob({find:rze,type:this.type}),Ob({find:oze,type:this.type})]},addPasteRules(){return[tv({find:sze,type:this.type}),tv({find:aze,type:this.type})]}});const cze="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
3855ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",uze="ελ1Ï
2бг1ел3деÑи4еÑ2каÑолик6ом3мÐ
3855ºÐ´2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5را٠ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5٠غرب5٠ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2٠اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ 3٠صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4Ù٠راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å «å¦2å ¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å 2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2",JO="numeric",eF="ascii",tF="alpha",TT="asciinumeric",YS="alphanumeric",iF="domain",Hoe="emoji",dze="scheme",hze="slashscheme",_z="whitespace";function pze(t,e){return t in e||(e[t]=[]),e[t]}function s_(t,e,i){e[JO]&&(e[TT]=!0,e[YS]=!0),e[eF]&&(e[TT]=!0,e[tF]=!0),e[TT]&&(e[YS]=!0),e[tF]&&(e[YS]=!0),e[YS]&&(e[iF]=!0),e[Hoe]&&(e[iF]=!0);for(const n in e){const o=pze(n,i);o.indexOf(t)<0&&o.push(t)}}function fze(t,e){const i={};for(const n in e)e[n].indexOf(t)>=0&&(i[n]=!0);return i}function Pc(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Pc.groups={};Pc.prototype={accepts(){return!!this.t},go(t){const e=this,i=e.j[t];if(i)return i;for(let n=0;n<e.jr.length;n++){const o=e.jr[n][0],c=e.jr[n][1];if(c&&o.test(t))return c}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,i,n){for(let o=0;o<t.length;o++)this.tt(t[o],e,i,n)},tr(t,e,i,n){n=n||Pc.groups;let o;return e&&e.j?o=e:(o=new Pc(e),i&&n&&s_(e,i,n)),this.jr.push([t,o]),o},ts(t,e,i,n){let o=this;const c=t.length;if(!c)return o;for(let f=0;f<c-1;f++)o=o.tt(t[f]);return o.tt(t[c-1],e,i,n)},tt(t,e,i,n){n=n||Pc.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const c=e;let f,r=o.go(t);if(r?(f=new Pc,Object.assign(f.j,r.j),f.jr.push.apply(f.jr,r.jr),f.jd=r.jd,f.t=r.t):f=new Pc,c){if(n)if(f.t&&typeof f.t=="string"){const x=Object.assign(fze(f.t,n),i);s_(c,x,n)}else i&&s_(c,i,n);f.t=c}return o.j[t]=f,f}};const jr=(t,e,i,n,o)=>t.ta(e,i,n,o),Oo=(t,e,i,n,o)=>t.tr(e,i,n,o),mG=(t,e,i,n,o)=>t.ts(e,i,n,o),Pi=(t,e,i,n,o)=>t.tt(e,i,n,o),Dp="WORD",nF="UWORD",Goe="ASCIINUMERICAL",Woe="ALPHANUMERICAL",AC="LOCALHOST",rF="TLD",sF="UTLD",tk="SCHEME",t0="SLASH_SCHEME",_B="NUM",oF="WS",vB="NL",CT="OPENBRACE",ET="CLOSEBRACE",kP="OPENBRACKET",PP="CLOSEBRACKET",NP="OPENPAREN",MP="CLOSEPAREN",DP="OPENANGLEBRACKET",RP="CLOSEANGLEBRACKET",jP="FULLWIDTHLEFTPAREN",zP="FULLWIDTHRIGHTPAREN",LP="LEFTCORNERBRACKET",OP="RIGHTCORNERBRACKET",FP="LEFTWHITECORNERBRACKET",BP="RIGHTWHITECORNERBRACKET",UP="FULLWIDTHLESSTHAN",VP="FULLWIDTHGREATERTHAN",$P="AMPERSAND",qP="APOSTROPHE",HP="ASTERISK",bm="AT",GP="BACKSLASH",WP="BACKTICK",KP="CARET",Im="COLON",xB="COMMA",ZP="DOLLAR",_h="DOT",XP="EQUALS",bB="EXCLAMATION",Su="HYPHEN",AT="PERCENT",YP="PIPE",QP="PLUS",JP="POUND",IT="QUERY",wB="QUOTE",Koe="FULLWIDTHMIDDLEDOT",SB="SEMI",vh="SLASH",kT="TILDE",eN="UNDERSCORE",Zoe="EMOJI",tN="SYM";var Xoe=Object.freeze({__proto__:null,ALPHANUMERICAL:Woe,AMPERSAND:$P,APOSTROPHE:qP,ASCIINUMERICAL:Goe,ASTERISK:HP,AT:bm,BACKSLASH:GP,BACKTICK:WP,CARET:KP,CLOSEANGLEBRACKET:RP,CLOSEBRACE:ET,CLOSEBRACKET:PP,CLOSEPAREN:MP,COLON:Im,COMMA:xB,DOLLAR:ZP,DOT:_h,EMOJI:Zoe,EQUALS:XP,EXCLAMATION:bB,FULLWIDTHGREATERTHAN:VP,FULLWIDTHLEFTPAREN:jP,FULLWIDTHLESSTHAN:UP,FULLWIDTHMIDDLEDOT:Koe,FULLWIDTHRIGHTPAREN:zP,HYPHEN:Su,LEFTCORNERBRACKET:LP,LEFTWHITECORNERBRACKET:FP,LOCALHOST:AC,NL:vB,NUM:_B,OPENANGLEBRACKET:DP,OPENBRACE:CT,OPENBRACKET:kP,OPENPAREN:NP,PERCENT:AT,PIPE:YP,PLUS:QP,POUND:JP,QUERY:IT,QUOTE:wB,RIGHTCORNERBRACKET:OP,RIGHTWHITECORNERBRACKET:BP,SCHEME:tk,SEMI:SB,SLASH:vh,SLASH_SCHEME:t0,SYM:tN,TILDE:kT,TLD:rF,UNDERSCORE:eN,UTLD:sF,UWORD:nF,WORD:Dp,WS:oF});const Ap=/[a-z]/,MS=new RegExp("\\p{L}","u"),vz=new RegExp("\\p{Emoji}","u"),Ip=/\d/,xz=/\s/,gG="\r",bz=` 3856`,mze="ï¸",gze="â",wz="";let mI=null,gI=null;function yze(t=[]){const e={};Pc.groups=e;const i=new Pc;mI==null&&(mI=yG(cze)),gI==null&&(gI=yG(uze)),Pi(i,"'",qP),Pi(i,"{",CT),Pi(i,"}",ET),Pi(i,"[",kP),Pi(i,"]",PP),Pi(i,"(",NP),Pi(i,")",MP),Pi(i,"<",DP),Pi(i,">",RP),Pi(i,"ï¼",jP),Pi(i,"ï¼",zP),Pi(i,"ã",LP),Pi(i,"ã",OP),Pi(i,"ã",FP),Pi(i,"ã",BP),Pi(i,"ï¼",UP),Pi(i,"ï¼",VP),Pi(i,"&",$P),Pi(i,"*",HP),Pi(i,"@",bm),Pi(i,"`",WP),Pi(i,"^",KP),Pi(i,":",Im),Pi(i,",",xB),Pi(i,"$",ZP),Pi(i,".",_h),Pi(i,"=",XP),Pi(i,"!",bB),Pi(i,"-",Su),Pi(i,"%",AT),Pi(i,"|",YP),Pi(i,"+",QP),Pi(i,"#",JP),Pi(i,"?",IT),Pi(i,'"',wB),Pi(i,"/",vh),Pi(i,";",SB),Pi(i,"~",kT),Pi(i,"_",eN),Pi(i,"\\",GP),Pi(i,"ã»",Koe);const n=Oo(i,Ip,_B,{[JO]:!0});Oo(n,Ip,n);const o=Oo(n,Ap,Goe,{[TT]:!0}),c=Oo(n,MS,Woe,{[YS]:!0}),f=Oo(i,Ap,Dp,{[eF]:!0});Oo(f,Ip,o),Oo(f,Ap,f),Oo(o,Ip,o),Oo(o,Ap,o);const r=Oo(i,MS,nF,{[tF]:!0});Oo(r,Ap),Oo(r,Ip,c),Oo(r,MS,r),Oo(c,Ip,c),Oo(c,Ap),Oo(c,MS,c);const x=Pi(i,bz,vB,{[_z]:!0}),S=Pi(i,gG,oF,{[_z]:!0}),C=Oo(i,xz,oF,{[_z]:!0});Pi(i,wz,C),Pi(S,bz,x),Pi(S,wz,C),Oo(S,xz,C),Pi(C,gG),Pi(C,bz),Oo(C,xz,C),Pi(C,wz,C);const I=Oo(i,vz,Zoe,{[Hoe]:!0});Pi(I,"#"),Oo(I,vz,I),Pi(I,mze,I);const N=Pi(I,gze);Pi(N,"#"),Oo(N,vz,I);const D=[[Ap,f],[Ip,o]],V=[[Ap,null],[MS,r],[Ip,c]];for(let B=0;B<mI.length;B++)dm(i,mI[B],rF,Dp,D);for(let B=0;B<gI.length;B++)dm(i,gI[B],sF,nF,V);s_(rF,{tld:!0,ascii:!0},e),s_(sF,{utld:!0,alpha:!0},e),dm(i,"file",tk,Dp,D),dm(i,"mailto",tk,Dp,D),dm(i,"http",t0,Dp,D),dm(i,"https",t0,Dp,D),dm(i,"ftp",t0,Dp,D),dm(i,"ftps",t0,Dp,D),s_(tk,{scheme:!0,ascii:!0},e),s_(t0,{slashscheme:!0,ascii:!0},e),t=t.sort((B,W)=>B[0]>W[0]?1:-1);for(let B=0;B<t.length;
vendor: 10,142 bytes, lines 3856-3859
3856B++){const W=t[B][0],G=t[B][1]?{[dze]:!0}:{[hze]:!0};W.indexOf("-")>=0?G[iF]=!0:Ap.test(W)?Ip.test(W)?G[TT]=!0:G[eF]=!0:G[JO]=!0,mG(i,W,W,G)}return mG(i,"localhost",AC,{ascii:!0}),i.jd=new Pc(tN),{start:i,tokens:Object.assign({groups:e},Xoe)}}function Yoe(t,e){const i=_ze(e.replace(/[A-Z]/g,r=>r.toLowerCase())),n=i.length,o=[];let c=0,f=0;for(;f<n;){let r=t,x=null,S=0,C=null,I=-1,N=-1;for(;f<n&&(x=r.go(i[f]));)r=x,r.accepts()?(I=0,N=0,C=r):I>=0&&(I+=i[f].length,N++),S+=i[f].length,c+=i[f].length,f++;c-=I,f-=N,S-=I,o.push({t:C.t,v:e.slice(c-S,c),s:c-S,e:c})}return o}function _ze(t){const e=[],i=t.length;let n=0;for(;n<i;){let o=t.charCodeAt(n),c,f=o<55296||o>56319||n+1===i||(c=t.charCodeAt(n+1))<56320||c>57343?t[n]:t.slice(n,n+2);e.push(f),n+=f.length}return e}function dm(t,e,i,n,o){let c;const f=e.length;for(let r=0;r<f-1;r++){const x=e[r];t.j[x]?c=t.j[x]:(c=new Pc(n),c.jr=o.slice(),t.j[x]=c),t=c}return c=new Pc(i),c.jr=o.slice(),t.j[e[f-1]]=c,c}function yG(t){const e=[],i=[];let n=0,o="0123456789";for(;n<t.length;){let c=0;for(;o.indexOf(t[n+c])>=0;)c++;if(c>0){e.push(i.join(""));for(let f=parseInt(t.substring(n,n+c),10);f>0;f--)i.pop();n+=c}else i.push(t[n]),n++}return e}const IC={defaultProtocol:"http",events:null,format:_G,formatHref:_G,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function TB(t,e=null){let i=Object.assign({},IC);t&&(i=Object.assign(i,t instanceof TB?t.o:t));const n=i.ignoreTags,o=[];for(let c=0;c<n.length;c++)o.push(n[c].toUpperCase());this.o=i,e&&(this.defaultRender=e),this.ignoreTags=o}TB.prototype={o:IC,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,i){const n=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=i.t in o?o[i.t]:IC[t],typeof o=="function"&&n&&(o=o(e,i))):typeof o=="function"&&n&&(o=o(e,i.t,i)),o)},getObj(t,e,i){let n=this.o[t];return typeof n=="function"&&e!=null&&(n=n(e,i.t,i)),n},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function _G(t){return t}function Qoe(t,e){this.t="token",this.v=t,this.tk=e}Qoe.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),i=t.get("truncate",e,this),n=t.get("format",e,this);return i&&n.length>i?n.substring(0,i)+"â¦":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=IC.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,i=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",i,this),o=t.get("tagName",i,e),c=this.toFormattedString(t),f={},r=t.get("className",i,e),x=t.get("target",i,e),S=t.get("rel",i,e),C=t.getObj("attributes",i,e),I=t.getObj("events",i,e);return f.href=n,r&&(f.class=r),x&&(f.target=x),S&&(f.rel=S),C&&Object.assign(f,C),{tagName:o,attributes:f,content:c,eventListeners:I}}};function VM(t,e){class i extends Qoe{constructor(o,c){super(o,c),this.t=t}}for(const n in e)i.prototype[n]=e[n];return i.t=t,i}const vG=VM("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),xG=VM("text"),vze=VM("nl"),yI=VM("url",{isLink:!0,toHref(t=IC.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==AC&&t[1].t===Im}}),wu=t=>new Pc(t);function xze({groups:t}){const e=t.domain.concat([$P,HP,bm,GP,WP,KP,ZP,XP,Su,_B,AT,YP,QP,JP,vh,tN,kT,eN]),i=[qP,Im,xB,_h,bB,AT,IT,wB,SB,DP,RP,CT,ET,PP,kP,NP,MP,jP,zP,LP,OP,FP,BP,UP,VP],n=[$P,qP,HP,GP,WP,KP,ZP,XP,Su,CT,ET,AT,YP,QP,JP,IT,vh,tN,kT,eN],o=wu(),c=Pi(o,kT);jr(c,n,c),jr(c,t.domain,c);const f=wu(),r=wu(),x=wu();jr(o,t.domain,f),jr(o,t.scheme,r),jr(o,t.slashscheme,x),jr(f,n,c),jr(f,t.domain,f);const S=Pi(f,bm);Pi(c,bm,S),Pi(r,bm,S),Pi(x,bm,S);const C=Pi(c,_h);jr(C,n,c),jr(C,t.domain,c);const I=wu();jr(S,t.domain,I),jr(I,t.domain,I);const N=Pi(I,_h);jr(N,t.domain,I);const D=wu(vG);jr(N,t.tld,D),jr(N,t.utld,D),Pi(S,AC,D);const V=Pi(I,Su);Pi(V,Su,V),jr(V,t.domain,I),jr(D,t.domain,I),Pi(D,_h,N),Pi(D,Su,V);const B=Pi(D,Im);jr(B,t.numeric,vG);const W=Pi(f,Su),$=Pi(f,_h);Pi(W,Su,W),jr(W,t.domain,f),jr($,n,c),jr($,t.domain,f);const G=wu(yI);jr($,t.tld,G),jr($,t.utld,G),jr(G,t.domain,f),jr(G,n,c),Pi(G,_h,$),Pi(G,Su,W),Pi(G,bm,S);const te=Pi(G,Im),ce=wu(yI);jr(te,t.numeric,ce);const _e=wu(yI),Te=wu();jr(_e,e,_e),jr(_e,i,Te),jr(Te,e,_e),jr(Te,i,Te),Pi(G,vh,_e),Pi(ce,vh,_e);const we=Pi(r,Im),Ne=Pi(x,Im),pe=Pi(Ne,vh),Pe=Pi(pe,vh);jr(r,t.domain,f),Pi(r,_h,$),Pi(r,Su,W),jr(x,t.domain,f),Pi(x,_h,$),Pi(x,Su,W),jr(we,t.domain,_e),Pi(we,vh,_e),Pi(we,IT,_e),jr(Pe,t.domain,_e),jr(Pe,e,_e),Pi(Pe,vh,_e);const De=[[CT,ET],[kP,PP],[NP,MP],[DP,RP],[jP,zP],[LP,OP],[FP,BP],[UP,VP]];for(let Je=0;Je<De.length;Je++){const[dt,At]=De[Je],qt=Pi(_e,dt);Pi(Te,dt,qt),Pi(qt,At,_e);const kt=wu(yI);jr(qt,e,kt);const Vt=wu();jr(qt,i),jr(kt,e,kt),jr(kt,i,Vt),jr(Vt,e,kt),jr(Vt,i,Vt),Pi(kt,At,_e),Pi(Vt,At,_e)}return Pi(o,AC,G),Pi(o,vB,vze),{start:o,tokens:Xoe}}function bze(t,e,i){let n=i.length,o=0,c=[],f=[];for(;o<n;){let r=t,x=null,S=null,C=0,I=null,N=-1;for(;o<n&&!(x=r.go(i[o].t));)f.push(i[o++]);for(;o<n&&(S=x||r.go(i[o].t));)x=null,r=S,r.accepts()?(N=0,I=r):N>=0&&N++,o++,C++;if(N<0)o-=C,o<n&&(f.push(i[o]),o++);else{f.length>0&&(c.push(Sz(xG,e,f)),f=[]),o-=N,C-=N;const D=I.t,V=i.slice(o-C,o);c.push(Sz(D,e,V))}}return f.length>0&&c.push(Sz(xG,e,f)),c}function Sz(t,e,i){const n=i[0].s,o=i[i.length-1].e,c=e.slice(n,o);return new t(c,i)}const wze=typeof console<"u"&&console&&console.warn||(()=>{}),Sze="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ao={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Tze(){return Pc.groups={},ao.scanner=null,ao.parser=null,ao.tokenQueue=[],ao.pluginQueue=[],ao.customSchemes=[],ao.initialized=!1,ao}function bG(t,e=!1){if(ao.initialized&&wze(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Sze}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 38571. Must only contain digits, lowercase ASCII letters or "-" 38582. Cannot start or end with "-" 38593. "-" cannot repeat`);ao.customSchemes.push([t,e])}function Cze(){ao.scanner=yze(ao.customSchemes);for(let t=0;t<ao.tokenQueue.length;t++)ao.tokenQueue[t][1]({scanner:ao.scanner});ao.parser=xze(ao.scanner.tokens);for(let t=0;t<ao.pluginQueue.length;t++)ao.pluginQueue[t][1]({scanner:ao.scanner,parser:ao.parser});return ao.initialized=!0,ao}function CB(t){return ao.initialized||Cze(),bze(ao.parser.start,t,Yoe(ao.scanner.start,t))}CB.scan=Yoe;function Joe(t,e=null,i=null){if(e&&typeof e=="object"){if(i)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);i=e,e=null}const n=new TB(i),o=CB(t),c=[];for(let f=0;f<o.length;f++){const r=o[f];r.isLink&&(!e||r.t===e)&&n.check(r)&&c.push(r.toFormattedObject(n))}return c}var EB="[\0-  áá â-\u2029âã]",Eze=new RegExp(EB),Aze=new RegExp(`${EB}$`),Ize=new RegExp(EB,"g");function kze(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Pze(t){return new Po({key:new Aa("autolink"),appendTransaction:(e,i,n)=>{const o=e.some(S=>S.docChanged)&&!i.doc.eq(n.doc),c=e.some(S=>S.getMeta("preventAutolink"));if(!o||c)return;const{tr:f}=n,r=doe(i.doc,[...e]);if(_oe(r).forEach(({newRange:S})=>{const C=TDe(n.doc,S,D=>D.isTextblock);let I,N;if(C.length>1)I=C[0],N=n.doc.textBetween(I.pos,I.pos+I.node.nodeSize,void 0," ");else if(C.length){const D=n.doc.textBetween(S.from,S.to," "," ");if(!Aze.test(D))return;I=C[0],N=n.doc.textBetween(I.pos,S.to,void 0," ")}if(I&&N){const D=N.split(Eze).filter(Boolean);if(D.length<=0)return!1;const V=D[D.length-1],B=I.pos+N.lastIndexOf(V);if(!V)return!1;const W=CB(V).map($=>$.toObject(t.defaultProtocol));if(!kze(W))return!1;W.filter($=>$.isLink).map($=>({...$,from:B+$.start+1,to:B+$.end+1})).filter($=>n.schema.marks.code?!n.doc.rangeHasMark($.from,$.to,n.schema.marks.code):!0).filter($=>t.validate($.value)).filter($=>t.shouldAutoLink($.value)).forEach($=>{hB($.from,$.to,n.doc).some(G=>G.mark.type===t.type)||f.addMark($.from,$.to,t.type.create({href:$.href}))})}}),!!f.steps.length)return f}})}function Nze(t){return new Po({key:new Aa("handleClickLink"),props:{handleClick:(e,i,n)=>{var o,c;if(n.button!==0||!e.editable)return!1;let f=null;if(n.target instanceof HTMLAnchorElement)f=n.target;else{const x=n.target;if(!x)return!1;const S=t.editor.view.dom;f=x.closest("a"),f&&!S.contains(f)&&(f=null)}if(!f)return!1;let r=!1;if(t.enableClickSelection&&(r=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const x=yoe(e.state,t.type.name),S=(o=f.href)!=null?o:x.href,C=(c=f.target)!=null?c:x.target;S&&(window.open(S,C),r=!0)}return r}}})}function Mze(t){return new Po({key:new Aa("handlePasteLink"),props:{handlePaste:(e,i,n)=>{const{shouldAutoLink:o}=t,{state:c}=e,{selection:f}=c,{empty:r}=f;if(r)return!1;let x="";n.content.forEach(C=>{x+=C.textContent});const S=Joe(x,{defaultProtocol:t.defaultProtocol}).find(C=>C.isLink&&C.value===x);return!x||!S||o!==void 0&&!o(S.value)?!1:t.editor.commands.setMark(t.type,{href:S.href})}}})}function Vy(t,e){const i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{const o=typeof n=="string"?n:n.scheme;o&&i.push(o)}),!t||t.replace(Ize,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Dze=Bg.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `val
3859idate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){bG(t);return}bG(t.scheme,t.optionalSlashes)})},onDestroy(){Tze()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Vy(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),i=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||i&&!t.includes("@"))return!0;const o=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(o)||!/\./.test(o))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:i=>!!Vy(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Vy(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ea(this.options.HTMLAttributes,t),0]:["a",ea(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var i,n,o,c;const f=(n=(i=t.attrs)==null?void 0:i.href)!=null?n:"",r=(c=(o=t.attrs)==null?void 0:o.title)!=null?c:"",x=e.renderChildren(t);return r?`[${x}](${f} "${r}")`:`[${x}](${f})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:i}=t;return this.options.isAllowedUri(i,{defaultValidate:n=>!!Vy(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:i}=t||{};return i&&!this.options.isAllowedUri(i,{defaultValidate:n=>!!Vy(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[tv({find:t=>{const e=[];if(t){const{protocols:i,defaultProtocol:n}=this.options,o=Joe(t).filter(c=>c.isLink&&this.options.isAllowedUri(c.value,{defaultValidate:f=>!!Vy(f,i),protocols:i,defaultProtocol:n}));o.length&&o.forEach(c=>{this.options.shouldAutoLink(c.value)&&e.push({text:c.value,data:{href:c.href},index:c.start})})}return e}
vendor: 12,854 bytes, lines 3859-3869
3859,type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:i}=this.options;return this.options.autolink&&t.push(Pze({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:o=>!!Vy(o,e),protocols:e,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Nze({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Mze({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Rze=Object.defineProperty,jze=(t,e)=>{for(var i in e)Rze(t,i,{get:e[i],enumerable:!0})},zze="listItem",wG="textStyle",SG=/^\s*([-+*])\s$/,eae=du.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ea(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 3860`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zze,this.editor.getAttributes(wG)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Fb({find:SG,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fb({find:SG,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wG),editor:this.editor})),[t]}}),tae=du.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ea(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let i=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(o=>o.type==="paragraph"))i=e.parseChildren(t.tokens);else{const o=t.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(o.tokens)}],t.tokens.length>1){const f=t.tokens.slice(1),r=e.parseChildren(f);i.push(...r)}}else i=e.parseChildren(t.tokens)}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,i)=>gB(t,e,n=>{var o,c;return n.parentType==="bulletList"?"- ":n.parentType==="orderedList"?`${(((c=(o=n.meta)==null?void 0:o.parentAttrs)==null?void 0:c.start)||1)+n.index}. `:"- "},i),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Lze={};jze(Lze,{findListItemPos:()=>PE,getNextListDepth:()=>AB,handleBackspace:()=>aF,handleDelete:()=>lF,hasListBefore:()=>iae,hasListItemAfter:()=>Oze,hasListItemBefore:()=>nae,listItemHasSubList:()=>rae,nextListIsDeeper:()=>sae,nextListIsHigher:()=>oae});var PE=(t,e)=>{const{$from:i}=e.selection,n=ma(t,e.schema);let o=null,c=i.depth,f=i.pos,r=null;for(;c>0&&r===null;)o=i.node(c),o.type===n?r=c:(c-=1,f-=1);return r===null?null:{$pos:e.doc.resolve(f),depth:r}},AB=(t,e)=>{const i=PE(t,e);if(!i)return!1;const[,n]=RDe(e,t,i.$pos.pos+4);return n},iae=(t,e,i)=>{const{$anchor:n}=t.selection,o=Math.max(0,n.pos-2),c=t.doc.resolve(o).node();return!(!c||!i.includes(c.type.name))},nae=(t,e)=>{var i;const{$anchor:n}=e.selection,o=e.doc.resolve(n.pos-2);return!(o.index()===0||((i=o.nodeBefore)==null?void 0:i.type.name)!==t)},rae=(t,e,i)=>{if(!i)return!1;const n=ma(t,e.schema);let o=!1;return i.descendants(c=>{c.type===n&&(o=!0)}),o},aF=(t,e,i)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Eg(t.state,e)&&iae(t.state,e,i)){const{$anchor:r}=t.state.selection,x=t.state.doc.resolve(r.before()-1),S=[];x.node().descendants((N,D)=>{N.type.name===e&&S.push({node:N,pos:D})});const C=S.at(-1);if(!C)return!1;const I=t.state.doc.resolve(x.start()+C.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},I.end()).joinForward().run()}if(!Eg(t.state,e)||!ODe(t.state))return!1;const n=PE(e,t.state);if(!n)return!1;const c=t.state.doc.resolve(n.$pos.pos-2).node(n.depth),f=rae(e,t.state,c);return nae(e,t.state)&&!f?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},sae=(t,e)=>{const i=AB(t,e),n=PE(t,e);return!n||!i?!1:i>n.depth},oae=(t,e)=>{const i=AB(t,e),n=PE(t,e);return!n||!i?!1:i<n.depth},lF=(t,e)=>{if(!Eg(t.state,e)||!LDe(t.state,e))return!1;const{selection:i}=t.state,{$from:n,$to:o}=i;return!i.empty&&n.sameParent(o)?!1:sae(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():oae(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Oze=(t,e)=>{var i;const{$anchor:n}=e.selection,o=e.doc.resolve(n.pos-n.parentOffset-2);return!(o.index()===o.parent.childCount-1||((i=o.nodeAfter)==null?void 0:i.type.name)!==t)},aae=$s.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:i})=>{t.state.schema.nodes[i]!==void 0&&lF(t,i)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:i})=>{t.state.schema.nodes[i]!==void 0&&lF(t,i)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:i,wrapperNames:n})=>{t.state.schema.nodes[i]!==void 0&&aF(t,i,n)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:i,wrapperNames:n})=>{t.state.schema.nodes[i]!==void 0&&aF(t,i,n)&&(e=!0)}),e}}}}),TG=/^(\s*)(\d+)\.\s+(.*)$/,Fze=/^\s/;function Bze(t){const e=[];let i=0,n=0;for(;i<t.length;){const o=t[i],c=o.match(TG);if(!c)break;const[,f,r,x]=c,S=f.length;let C=x,I=i+1;const N=[o];for(;I<t.length;){const D=t[I];if(D.match(TG))break;if(D.trim()==="")N.push(D),C+=` 3861`,I+=1;else if(D.match(Fze))N.push(D),C+=` 3862${D.slice(S+2)}`,I+=1;else break}e.push({indent:S,number:parseInt(r,10),content:C.trim(),raw:N.join(` 3863`)}),n=I,i=I}return[e,n]}function lae(t,e,i){var n;const o=[];let c=0;for(;c<t.length;){const f=t[c];if(f.indent===e){const r=f.content.split(` 3864`),x=((n=r[0])==null?void 0:n.trim())||"",S=[];x&&S.push({type:"paragraph",raw:x,tokens:i.inlineTokens(x)});const C=r.slice(1).join(` 3865`).trim();if(C){const D=i.blockTokens(C);S.push(...D)}let I=c+1;const N=[];for(;I<t.length&&t[I].indent>e;)N.push(t[I]),I+=1;if(N.length>0){const D=Math.min(...N.map(B=>B.indent)),V=lae(N,D,i);S.push({type:"list",ordered:!0,start:N[0].number,items:V,raw:N.map(B=>B.raw).join(` 3866`)})}o.push({type:"list_item",raw:f.raw,tokens:S}),c=I}else c+=1}return o}function Uze(t,e){return t.map(i=>{if(i.type!=="list_item")return e.parseChildren([i])[0];const n=[];return i.tokens&&i.tokens.length>0&&i.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")n.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){const c=e.parseChildren([o]);n.push({type:"paragraph",content:c})}else{const c=e.parseChildren([o]);c.length>0&&n.push(...c)}}),{type:"listItem",content:n}})}var Vze="listItem",CG="textStyle",EG=/^(\d+)\.\s$/,cae=du.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...i}=t;return e===1?["ol",ea(this.options.HTMLAttributes,i),0]:["ol",ea(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const i=t.start||1,n=t.items?Uze(t.items,e):[];return i!==1?{type:"orderedList",attrs:{start:i},content:n}:{type:"orderedList",content:n}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 3867`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),i=e==null?void 0:e.index;return i!==void 0?i:-1},tokenize:(t,e,i)=>{var n;const o=t.split(` 3868`),[c,f]=Bze(o);if(c.length===0)return;const r=lae(c,0,i);return r.length===0?void 0:{type:"list",ordered:!0,start:((n=c[0])==null?void 0:n.number)||1,items:r,raw:o.slice(0,f).join(` 3869`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vze,this.editor.getAttributes(CG)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Fb({find:EG,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fb({find:EG,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(CG)}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1],editor:this.editor})),[t]}}),$ze=/^\s*(\[([( |x])?\])\s$/,qze=du.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ea(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const i=[];if(t.tokens&&t.tokens.length>0?i.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?i.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):i.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const n=e.parseChildren(t.nestedTokens);i.push(...n)}return e.createNode("taskItem",{checked:t.checked||!1},i)},renderMarkdown:(t,e)=>{var i;const o=`- [${(i=t.attrs)!=null&&i.checked?"x":" "}] `;return gB(t,e,o)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:i,editor:n})=>{const o=document.createElement("li"),c=document.createElement("label"),f=document.createElement("span"),r=document.createElement("input"),x=document.createElement("div"),S=I=>{var N,D;r.ariaLabel=((D=(N=this.options.a11y)==null?void 0:N.checkboxLabel)==null?void 0:D.call(N,I,r.checked))||`Task item checkbox for ${I.textContent||"empty task item"}`};S(t),c.contentEditable="false",r.type="checkbox",r.addEventListener("mousedown",I=>I.preventDefault()),r.addEventListener("change",I=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){r.checked=!r.checked;return}const{checked:N}=I.target;n.isEditable&&typeof i=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:D})=>{const V=i();if(typeof V!="number")return!1;const B=D.doc.nodeAt(V);return D.setNodeMarkup(V,void 0,{...B==null?void 0:B.attrs,checked:N}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,N)||(r.checked=!r.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([I,N])=>{o.setAttribute(I,N)}),o.dataset.checked=t.attrs.checked,r.checked=t.attrs.checked,c.append(r,f),o.append(c,x),Object.entries(e).forEach(([I,N])=>{o.setAttribute(I,N)});let C=new Set(Object.keys(e));
vendor: 10,437 bytes, lines 3869-3870
3869return{dom:o,contentDOM:x,update:I=>{if(I.type!==this.type)return!1;o.dataset.checked=I.attrs.checked,r.checked=I.attrs.checked,S(I);const N=n.extensionManager.attributes,D=EC(I,N),V=new Set(Object.keys(D)),B=this.options.HTMLAttributes;return C.forEach(W=>{V.has(W)||(W in B?o.setAttribute(W,B[W]):o.removeAttribute(W))}),Object.entries(D).forEach(([W,$])=>{$==null?W in B?o.setAttribute(W,B[W]):o.removeAttribute(W):o.setAttribute(W,$)}),C=V,!0}}}},addInputRules(){return[Fb({find:$ze,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Hze=du.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ea(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` 3870`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const i=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return i!==void 0?i:-1},tokenize(t,e,i){const n=c=>{const f=YO(c,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:r=>({indentLevel:r[1].length,mainContent:r[4],checked:r[3].toLowerCase()==="x"}),createToken:(r,x)=>({type:"taskItem",raw:"",mainContent:r.mainContent,indentLevel:r.indentLevel,checked:r.checked,text:r.mainContent,tokens:i.inlineTokens(r.mainContent),nestedTokens:x}),customNestedParser:n},i);return f?[{type:"taskList",raw:f.raw,items:f.items}]:i.blockTokens(c)},o=YO(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,f)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:i.inlineTokens(c.mainContent),nestedTokens:f}),customNestedParser:n},i);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});$s.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(eae.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(tae.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(aae.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(cae.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(qze.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Hze.configure(this.options.taskList)),t}});var AG=" ",Gze="Â ",Wze=du.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ea(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const i=t.tokens||[];if(i.length===1&&i[0].type==="image")return e.parseChildren([i[0]]);const n=e.parseInline(i);return n.length===1&&n[0].type==="text"&&(n[0].text===AG||n[0].text===Gze)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,n)},renderMarkdown:(t,e)=>{if(!t)return"";const i=Array.isArray(t.content)?t.content:[];return i.length===0?AG:e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kze=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Zze=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Xze=Bg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ea(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ob({find:Kze,type:this.type})]},addPasteRules(){return[tv({find:Zze,type:this.type})]}}),Yze=du.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),uae=Bg.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ea(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,i){const o=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!o)return;const c=o[2].trim();return{type:"underline",raw:o[0],text:c,tokens:i.inlineTokens(c)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Qze=uae;function Jze(t={}){return new Po({view(e){return new eLe(e,t)}})}class eLe{constructor(e,i){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=i.width)!==null&&n!==void 0?n:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let c=f=>{this[o](f)};return e.dom.addEventListener(o,c),{name:o,handler:c}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,n,o=this.editorView.dom,c=o.getBoundingClientRect(),f=c.width/o.offsetWidth,r=c.height/o.offsetHeight;if(i){let I=e.nodeBefore,N=e.nodeAfter;if(I||N){let D=this.editorView.nodeDOM(this.cursorPos-(I?I.nodeSize:0));if(D){let V=D.getBoundingClientRect(),B=I?V.bottom:V.top;I&&N&&(B=(B+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let W=this.width/2*r;n={left:V.left,right:V.right,top:B-W,bottom:B+W}}}}if(!n){let I=this.editorView.coordsAtPos(this.cursorPos),N=this.width/2*f;n={left:I.left-N,right:I.left+N,top:I.top,bottom:I.bottom}}let x=this.editorView.dom.offsetParent;this.element||(this.element=x.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let S,C;if(!x||x==document.body&&getComputedStyle(x).position=="static")S=-pageXOffset,C=-pageYOffset;else{let I=x.getBoundingClientRect(),N=I.width/x.offsetWidth,D=I.height/x.offsetHeight;S=I.left-x.scrollLeft*N,C=I.top-x.scrollTop*D}this.element.style.left=(n.left-S)/f+"px",this.element.style.top=(n.top-C)/r+"px",this.element.style.width=(n.right-n.left)/f+"px",this.element.style.height=(n.bottom-n.top)/r+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),o=n&&n.type.spec.disableDropCursor,c=typeof o=="function"?o(this.editorView,i,e):o;if(i&&!c){let f=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let r=lse(this.editorView.state.doc,f,this.editorView.dragging.slice);r!=null&&(f=r)}this.setCursor(f),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Uo extends zr{constructor(e){super(e,e)}map(e,i){let n=e.resolve(i.map(this.head));return Uo.valid(n)?new Uo(n):zr.near(n)}content(){return pn.empty}eq(e){return e instanceof Uo&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Uo(e.resolve(i.pos))}getBookmark(){return new IB(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!tLe(e)||!iLe(e))return!1;let n=i.type.spec.allowGapCursor;if(n!=null)return n;let o=i.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,i,n=!1){e:for(;;){if(!n&&Uo.valid(e))return e;let o=e.pos,c=null;for(let f=e.depth;;f--){let r=e.node(f);if(i>0?e.indexAfter(f)<r.childCount:e.index(f)>0){c=r.child(i>0?e.indexAfter(f):e.index(f)-1);break}else if(f==0)return null;o+=i;let x=e.doc.resolve(o);if(Uo.valid(x))return x}for(;;){let f=i>0?c.firstChild:c.lastChild;if(!f){if(c.isAtom&&!c.isText&&!qn.isSelectable(c)){e=e.doc.resolve(o+c.nodeSize*i),n=!1;continue e}break}c=f,o+=i;let r=e.doc.resolve(o);if(Uo.valid(r))return r}return null}}}Uo.prototype.visible=!1;Uo.findFrom=Uo.findGapCursorFrom;zr.jsonID("gapcursor",Uo);class IB{constructor(e){this.pos=e}map(e){return new IB(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return Uo.valid(i)?new Uo(i):zr.near(i)}}function dae(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function tLe(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),n=t.node(e);if(i==0){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(i-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||dae(o.type))return!0;
vendor: 19,113 bytes, line 3870
3870if(o.inlineContent)return!1}}return!0}function iLe(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),n=t.node(e);if(i==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let o=n.child(i);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||dae(o.type))return!0;if(o.inlineContent)return!1}}return!0}function nLe(){return new Po({props:{decorations:aLe,createSelectionBetween(t,e,i){return e.pos==i.pos&&Uo.valid(i)?new Uo(i):null},handleClick:sLe,handleKeyDown:rLe,handleDOMEvents:{beforeinput:oLe}}})}const rLe=noe({ArrowLeft:_I("horiz",-1),ArrowRight:_I("horiz",1),ArrowUp:_I("vert",-1),ArrowDown:_I("vert",1)});function _I(t,e){const i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,o,c){let f=n.selection,r=e>0?f.$to:f.$from,x=f.empty;if(f instanceof br){if(!c.endOfTextblock(i)||r.depth==0)return!1;x=!1,r=n.doc.resolve(e>0?r.after():r.before())}let S=Uo.findGapCursorFrom(r,e,x);return S?(o&&o(n.tr.setSelection(new Uo(S))),!0):!1}}function sLe(t,e,i){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!Uo.valid(n))return!1;let o=t.posAtCoords({left:i.clientX,top:i.clientY});return o&&o.inside>-1&&qn.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Uo(n))),!0)}function oLe(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Uo))return!1;let{$from:i}=t.state.selection,n=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let o=Si.empty;for(let f=n.length-1;f>=0;f--)o=Si.from(n[f].createAndFill(null,o));let c=t.state.tr.replace(i.pos,i.pos,new pn(o,0,0));return c.setSelection(br.near(c.doc.resolve(i.pos+1))),t.dispatch(c),!1}function aLe(t){if(!(t.selection instanceof Uo))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Co.create(t.doc,[nc.widget(t.selection.head,e,{key:"gapcursor"})])}var iN=200,Ha=function(){};Ha.prototype.append=function(e){return e.length?(e=Ha.from(e),!this.length&&e||e.length<iN&&this.leafAppend(e)||this.length<iN&&e.leafPrepend(this)||this.appendInner(e)):this};Ha.prototype.prepend=function(e){return e.length?Ha.from(e).append(this):this};Ha.prototype.appendInner=function(e){return new lLe(this,e)};Ha.prototype.slice=function(e,i){return e===void 0&&(e=0),i===void 0&&(i=this.length),e>=i?Ha.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,i))};Ha.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ha.prototype.forEach=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length),i<=n?this.forEachInner(e,i,n,0):this.forEachInvertedInner(e,i,n,0)};Ha.prototype.map=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length);var o=[];return this.forEach(function(c,f){return o.push(e(c,f))},i,n),o};Ha.from=function(e){return e instanceof Ha?e:e&&e.length?new hae(e):Ha.empty};var hae=function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,c){return o==0&&c==this.length?this:new e(this.values.slice(o,c))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,c,f,r){for(var x=c;x<f;x++)if(o(this.values[x],r+x)===!1)return!1},e.prototype.forEachInvertedInner=function(o,c,f,r){for(var x=c-1;x>=f;x--)if(o(this.values[x],r+x)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=iN)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=iN)return new e(o.flatten().concat(this.values))},i.length.get=function(){return this.values.length},i.depth.get=function(){return 0},Object.defineProperties(e.prototype,i),e}(Ha);Ha.empty=new hae([]);var lLe=function(t){function e(i,n){t.call(this),this.left=i,this.right=n,this.length=i.length+n.length,this.depth=Math.max(i.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,o,c,f){var r=this.left.length;if(o<r&&this.left.forEachInner(n,o,Math.min(c,r),f)===!1||c>r&&this.right.forEachInner(n,Math.max(o-r,0),Math.min(this.length,c)-r,f+r)===!1)return!1},e.prototype.forEachInvertedInner=function(n,o,c,f){var r=this.left.length;if(o>r&&this.right.forEachInvertedInner(n,o-r,Math.max(c,r)-r,f+r)===!1||c<r&&this.left.forEachInvertedInner(n,Math.min(o,r),c,f)===!1)return!1},e.prototype.sliceInner=function(n,o){if(n==0&&o==this.length)return this;var c=this.left.length;return o<=c?this.left.slice(n,o):n>=c?this.right.slice(n-c,o-c):this.left.slice(n,c).append(this.right.slice(0,o-c))},e.prototype.leafAppend=function(n){var o=this.right.leafAppend(n);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(n){var o=this.left.leafPrepend(n);if(o)return new e(o,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(Ha);const cLe=500;class Id{constructor(e,i){this.items=e,this.eventCount=i}popEvent(e,i){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let o,c;i&&(o=this.remapping(n,this.items.length),c=o.maps.length);let f=e.tr,r,x,S=[],C=[];return this.items.forEach((I,N)=>{if(!I.step){o||(o=this.remapping(n,N+1),c=o.maps.length),c--,C.push(I);return}if(o){C.push(new xh(I.map));let D=I.step.map(o.slice(c)),V;D&&f.maybeStep(D).doc&&(V=f.mapping.maps[f.mapping.maps.length-1],S.push(new xh(V,void 0,void 0,S.length+C.length))),c--,V&&o.appendMap(V,c)}else f.maybeStep(I.step);if(I.selection)return r=o?I.selection.map(o.slice(c)):I.selection,x=new Id(this.items.slice(0,n).append(C.reverse().concat(S)),this.eventCount-1),!1},this.items.length,0),{remaining:x,transform:f,selection:r}}addTransform(e,i,n,o){let c=[],f=this.eventCount,r=this.items,x=!o&&r.length?r.get(r.length-1):null;for(let C=0;C<e.steps.length;C++){let I=e.steps[C].invert(e.docs[C]),N=new xh(e.mapping.maps[C],I,i),D;(D=x&&x.merge(N))&&(N=D,C?c.pop():r=r.slice(0,r.length-1)),c.push(N),i&&(f++,i=void 0),o||(x=N)}let S=f-n.depth;return S>dLe&&(r=uLe(r,S),f-=S),new Id(r.append(c),f)}remapping(e,i){let n=new xC;return this.items.forEach((o,c)=>{let f=o.mirrorOffset!=null&&c-o.mirrorOffset>=e?n.maps.length-o.mirrorOffset:void 0;n.appendMap(o.map,f)},e,i),n}addMaps(e){return this.eventCount==0?this:new Id(this.items.append(e.map(i=>new xh(i))),this.eventCount)}rebased(e,i){if(!this.eventCount)return this;let n=[],o=Math.max(0,this.items.length-i),c=e.mapping,f=e.steps.length,r=this.eventCount;this.items.forEach(N=>{N.selection&&r--},o);let x=i;this.items.forEach(N=>{let D=c.getMirror(--x);if(D==null)return;f=Math.min(f,D);let V=c.maps[D];if(N.step){let B=e.steps[D].invert(e.docs[D]),W=N.selection&&N.selection.map(c.slice(x+1,D));W&&r++,n.push(new xh(V,B,W))}else n.push(new xh(V))},o);let S=[];for(let N=i;N<f;N++)S.push(new xh(c.maps[N]));let C=this.items.slice(0,o).append(S).append(n),I=new Id(C,r);return I.emptyItemCount()>cLe&&(I=I.compress(this.items.length-n.length)),I}emptyItemCount(){let e=0;return this.items.forEach(i=>{i.step||e++}),e}compress(e=this.items.length){let i=this.remapping(0,e),n=i.maps.length,o=[],c=0;return this.items.forEach((f,r)=>{if(r>=e)o.push(f),f.selection&&c++;else if(f.step){let x=f.step.map(i.slice(n)),S=x&&x.getMap();if(n--,S&&i.appendMap(S,n),x){let C=f.selection&&f.selection.map(i.slice(n));C&&c++;let I=new xh(S.invert(),x,C),N,D=o.length-1;(N=o.length&&o[D].merge(I))?o[D]=N:o.push(I)}}else f.map&&n--},this.items.length,0),new Id(Ha.from(o.reverse()),c)}}Id.empty=new Id(Ha.empty,0);function uLe(t,e){let i;return t.forEach((n,o)=>{if(n.selection&&e--==0)return i=o,!1}),t.slice(i)}class xh{constructor(e,i,n,o){this.map=e,this.step=i,this.selection=n,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let i=e.step.merge(this.step);if(i)return new xh(i.getMap().invert(),i,this.selection)}}}class wm{constructor(e,i,n,o,c){this.done=e,this.undone=i,this.prevRanges=n,this.prevTime=o,this.prevComposition=c}}const dLe=20;function hLe(t,e,i,n){let o=i.getMeta(M_),c;if(o)return o.historyState;i.getMeta(mLe)&&(t=new wm(t.done,t.undone,null,0,-1));let f=i.getMeta("appendedTransaction");if(i.steps.length==0)return t;if(f&&f.getMeta(M_))return f.getMeta(M_).redo?new wm(t.done.addTransform(i,void 0,n,ik(e)),t.undone,IG(i.mapping.maps),t.prevTime,t.prevComposition):new wm(t.done,t.undone.addTransform(i,void 0,n,ik(e)),null,t.prevTime,t.prevComposition);if(i.getMeta("addToHistory")!==!1&&!(f&&f.getMeta("addToHistory")===!1)){let r=i.getMeta("composition"),x=t.prevTime==0||!f&&t.prevComposition!=r&&(t.prevTime<(i.time||0)-n.newGroupDelay||!pLe(i,t.prevRanges)),S=f?Tz(t.prevRanges,i.mapping):IG(i.mapping.maps);return new wm(t.done.addTransform(i,x?e.selection.getBookmark():void 0,n,ik(e)),Id.empty,S,i.time,r??t.prevComposition)}else return(c=i.getMeta("rebased"))?new wm(t.done.rebased(i,c),t.undone.rebased(i,c),Tz(t.prevRanges,i.mapping),t.prevTime,t.prevComposition):new wm(t.done.addMaps(i.mapping.maps),t.undone.addMaps(i.mapping.maps),Tz(t.prevRanges,i.mapping),t.prevTime,t.prevComposition)}function pLe(t,e){if(!e)return!1;if(!t.docChanged)return!0;let i=!1;return t.mapping.maps[0].forEach((n,o)=>{for(let c=0;c<e.length;c+=2)n<=e[c+1]&&o>=e[c]&&(i=!0)}),i}function IG(t){let e=[];for(let i=t.length-1;i>=0&&e.length==0;i--)t[i].forEach((n,o,c,f)=>e.push(c,f));return e}function Tz(t,e){if(!t)return null;let i=[];for(let n=0;n<t.length;n+=2){let o=e.map(t[n],1),c=e.map(t[n+1],-1);o<=c&&i.push(o,c)}return i}function fLe(t,e,i){let n=ik(e),o=M_.get(e).spec.config,c=(i?t.undone:t.done).popEvent(e,n);if(!c)return null;let f=c.selection.resolve(c.transform.doc),r=(i?t.done:t.undone).addTransform(c.transform,e.selection.getBookmark(),o,n),x=new wm(i?r:c.remaining,i?c.remaining:r,null,0,-1);return c.transform.setSelection(f).setMeta(M_,{redo:i,historyState:x})}let Cz=!1,kG=null;function ik(t){let e=t.plugins;if(kG!=e){Cz=!1,kG=e;for(let i=0;i<e.length;i++)if(e[i].spec.historyPreserveItems){Cz=!0;break}}return Cz}const M_=new Aa("history"),mLe=new Aa("closeHistory");function gLe(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Po({key:M_,state:{init(){return new wm(Id.empty,Id.empty,null,0,-1)},apply(e,i,n){return hLe(i,n,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,i){let n=i.inputType,o=n=="historyUndo"?fae:n=="historyRedo"?mae:null;return!o||!e.editable?!1:(i.preventDefault(),o(e.state,e.dispatch))}}}})}function pae(t,e){return(i,n)=>{let o=M_.getState(i);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(n){let c=fLe(o,i,t);c&&n(e?c.scrollIntoView():c)}return!0}}const fae=pae(!1,!0),mae=pae(!0,!0);$s.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,i=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(i)}},addProseMirrorPlugins(){let t=!1;return[new Po({key:new Aa("characterCount"),appendTransaction:(e,i,n)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const c=this.storage.characters({node:n.doc});if(c>o){const f=c-o,r=0,x=f;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const S=n.tr.deleteRange(r,x);return t=!0,S}t=!0},filterTransaction:(e,i)=>{const n=this.options.limit;if(!e.docChanged||n===0||n===null||n===void 0)return!0;const o=this.storage.characters({node:i.doc}),c=this.storage.characters({node:e.doc});if(c<=n||o>n&&c>n&&c<=o)return!0;if(o>n&&c>n&&c>o||!e.getMeta("paste"))return!1;const r=e.selection.$head.pos,x=c-n,S=r-x,C=r;return e.deleteRange(S,C),!(this.storage.characters({node:e.doc})>n)}})]}});var yLe=$s.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Jze(this.options)]}});$s.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Po({key:new Aa("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:i,isFocused:n}=this.editor,{anchor:o}=e,c=[];if(!i||!n)return Co.create(t,[]);let f=0;this.options.mode==="deepest"&&t.descendants((x,S)=>{if(x.isText)return;if(!(o>=S&&o<=S+x.nodeSize-1))return!1;f+=1});let r=0;return t.descendants((x,S)=>{if(x.isText||!(o>=S&&o<=S+x.nodeSize-1))return!1;if(r+=1,this.options.mode==="deepest"&&f-r>0||this.options.mode==="shallowest"&&r>1)return this.options.mode==="deepest";c.push(nc.node(S,S+x.nodeSize,{class:this.options.className}))}),Co.create(t,c)}}})]}});var _Le=$s.create({name:"gapCursor",addProseMirrorPlugins(){return[nLe()]},extendNodeSchema(t){var e;const i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Bs(Rn(t,"allowGapCursor",i)))!=null?e:null}}}),PG="placeholder";function vLe(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}$s.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:PG,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${vLe(this.options.dataAttribute)}`:`data-${PG}`;return[new Po({key:new Aa("placeholder"),props:{decorations:({doc:e,selection:i})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=i,c=[];if(!n)return null;const f=this.editor.isEmpty;return e.descendants((r,x)=>{const S=o>=x&&o<=x+r.nodeSize,C=!r.isLeaf&&OM(r);if((S||!this.options.showOnlyCurrent)&&C){const I=[this.options.emptyNodeClass];f&&I.push(this.options.emptyEditorClass);const N=nc.node(x,x+r.nodeSize,{class:I.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:r,pos:x,hasAnchor:S}):this.options.placeholder});c.push(N)}return this.options.includeChildren}),Co.create(e,c)}}})]}});$s.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Po({key:new Aa("selection"),props:{decorations(i){return i.selection.empty||t.isFocused||!t.isEditable||voe(i.selection)||t.view.dragging?null:Co.create(i.doc,[nc.inline(i.selection.from,i.selection.to,{class:e.className})])}}})]}});function NG({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var xLe=$s.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Aa(this.name),i=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(i).includes(o.name));return[new Po({key:e,appendTransaction:(o,c,f)=>{const{doc:r,tr:x,schema:S}=f,C=e.getState(f),I=r.content.size,N=S.nodes[i];if(C)return x.insert(I,N.create())},state:{init:(o,c)=>{const f=c.tr.doc.lastChild;return!NG({node:f,types:n})},apply:(o,c)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return c;const f=o.doc.lastChild;return!NG({node:f,types:n})}}})]}}),bLe=$s.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>fae(t,e),redo:()=>({state:t,dispatch:e})=>mae(t,e)}},addProseMirrorPlugins(){return[gLe(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),wLe=$s.create({name:"starterKit",addExtensions(){var t,e,i,n;const o=[];return this.options.bold!==!1&&o.push(Wje.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(Vje.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(eae.configure(this.options.bulletList)),this.options.code!==!1&&o.push(Xje.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(Jje.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(eze.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(yLe.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(_Le.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(tze.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ize.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(bLe.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(nze.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(lze.configure(this.options.italic)),this.options.listItem!==!1&&o.push(tae.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(aae.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&o.push(Dze.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(cae.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Wze.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Xze.configure(this.options.strike)),this.options.text!==!1&&o.push(Yze.configure(this.options.text)),this.options.underline!==!1&&o.push(uae.configure((i=this.options)==null?void 0:i.underline)),this.options.trailingNode!==!1&&o.push(xLe.configure((n=this.options)==null?void 0:n.trailingNode)),o}}),SLe=wLe,TLe=$s.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(i=>e.updateAttributes(i,{textAlign:t})).some(i=>i):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:i})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?i.unsetTextAlign():i.setTextAlign(t):!1}}
3870,addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),CLe=TLe,ELe=20,gae=(t,e=0)=>{const i=[];return!t.children.length||e>ELe||Array.from(t.children).forEach(n=>{n.tagName==="SPAN"?i.push(n):n.children.length&&i.push(...gae(n,e+1))}),i},ALe=t=>{if(!t.children.length)return;const e=gae(t);e&&e.forEach(i=>{var n,o;const c=i.getAttribute("style"),f=(o=(n=i.parentElement)==null?void 0:n.closest("span"))==null?void 0:o.getAttribute("style");i.setAttribute("style",`${f};${c}`)})},yae=Bg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&ALe(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",ea(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(i,n)=>{if(i.isTextblock)return!0;i.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(c=>!!c))||t.removeMark(n,n+i.nodeSize,this.type)}),!0}}}}),ILe=$s.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const i=t.getAttribute("style");if(i){const n=i.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){const c=n[o].split(":");if(c.length>=2){const f=c[0].trim().toLowerCase(),r=c.slice(1).join(":").trim();if(f==="background-color")return r.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),_ae=$s.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const i=t.getAttribute("style");if(i){const n=i.split(";").map(o=>o.trim()).filter(Boolean);for(let o=n.length-1;o>=0;o-=1){const c=n[o].split(":");if(c.length>=2){const f=c[0].trim().toLowerCase(),r=c.slice(1).join(":").trim();if(f==="color")return r.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),kLe=$s.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),vae=$s.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),PLe=$s.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});$s.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(ILe.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(_ae.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(kLe.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(vae.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(PLe.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(yae.configure(this.options.textStyle)),t}});var NLe=_ae,kB="Popover",[xae,L8e]=Wa(kB,[Dg]),NE=Dg(),[MLe,Vg]=xae(kB),bae=t=>{const{__scopePopover:e,children:i,open:n,defaultOpen:o,onOpenChange:c,modal:f=!1}=t,r=NE(e),x=K.useRef(null),[S,C]=K.useState(!1),[I=!1,N]=lu({prop:n,defaultProp:o,onChange:c});return d.jsx(l4,{...r,children:d.jsx(MLe,{scope:e,contentId:nu(),triggerRef:x,open:I,onOpenChange:N,onOpenToggle:K.useCallback(()=>N(D=>!D),[N]),hasCustomAnchor:S,onCustomAnchorAdd:K.useCallback(()=>C(!0),[]),onCustomAnchorRemove:K.useCallback(()=>C(!1),[]),modal:f,children:i})})};bae.displayName=kB;var wae="PopoverAnchor",DLe=K.forwardRef((t,e)=>{const{__scopePopover:i,...n}=t,o=Vg(wae,i),c=NE(i),{onCustomAnchorAdd:f,onCustomAnchorRemove:r}=o;return K.useEffect(()=>(f(),()=>r()),[f,r]),d.jsx(fE,{...c,...n,ref:e})});DLe.displayName=wae;var Sae="PopoverTrigger",Tae=K.forwardRef((t,e)=>{const{__scopePopover:i,...n}=t,o=Vg(Sae,i),c=NE(i),f=wr(e,o.triggerRef),r=d.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":kae(o.open),...n,ref:f,onClick:Ni(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?r:d.jsx(fE,{asChild:!0,...c,children:r})});Tae.displayName=Sae;var PB="PopoverPortal",[RLe,jLe]=xae(PB,{forceMount:void 0}),Cae=t=>{const{__scopePopover:e,forceMount:i,children:n,container:o}=t,c=Vg(PB,e);return d.jsx(RLe,{scope:e,forceMount:i,children:d.jsx(Ea,{present:i||c.open,children:d.jsx(Zb,{asChild:!0,container:o,children:n})})})};
vendor: 4,382 bytes, line 3870
3870Cae.displayName=PB;var Bb="PopoverContent",Eae=K.forwardRef((t,e)=>{const i=jLe(Bb,t.__scopePopover),{forceMount:n=i.forceMount,...o}=t,c=Vg(Bb,t.__scopePopover);return d.jsx(Ea,{present:n||c.open,children:c.modal?d.jsx(LLe,{...o,ref:e}):d.jsx(OLe,{...o,ref:e})})});Eae.displayName=Bb;var zLe=hg("PopoverContent.RemoveScroll"),LLe=K.forwardRef((t,e)=>{const i=Vg(Bb,t.__scopePopover),n=K.useRef(null),o=wr(e,n),c=K.useRef(!1);return K.useEffect(()=>{const f=n.current;if(f)return dM(f)},[]),d.jsx(gE,{as:zLe,allowPinchZoom:!0,children:d.jsx(Aae,{...t,ref:o,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ni(t.onCloseAutoFocus,f=>{var r;f.preventDefault(),c.current||(r=i.triggerRef.current)==null||r.focus()}),onPointerDownOutside:Ni(t.onPointerDownOutside,f=>{const r=f.detail.originalEvent,x=r.button===0&&r.ctrlKey===!0,S=r.button===2||x;c.current=S},{checkForDefaultPrevented:!1}),onFocusOutside:Ni(t.onFocusOutside,f=>f.preventDefault(),{checkForDefaultPrevented:!1})})})}),OLe=K.forwardRef((t,e)=>{const i=Vg(Bb,t.__scopePopover),n=K.useRef(!1),o=K.useRef(!1);return d.jsx(Aae,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{var f,r;(f=t.onCloseAutoFocus)==null||f.call(t,c),c.defaultPrevented||(n.current||(r=i.triggerRef.current)==null||r.focus(),c.preventDefault()),n.current=!1,o.current=!1},onInteractOutside:c=>{var x,S;(x=t.onInteractOutside)==null||x.call(t,c),c.defaultPrevented||(n.current=!0,c.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const f=c.target;((S=i.triggerRef.current)==null?void 0:S.contains(f))&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&o.current&&c.preventDefault()}})}),Aae=K.forwardRef((t,e)=>{const{__scopePopover:i,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:c,disableOutsidePointerEvents:f,onEscapeKeyDown:r,onPointerDownOutside:x,onFocusOutside:S,onInteractOutside:C,...I}=t,N=Vg(Bb,i),D=NE(i);return cM(),d.jsx(mE,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:c,children:d.jsx(av,{asChild:!0,disableOutsidePointerEvents:f,onInteractOutside:C,onEscapeKeyDown:r,onPointerDownOutside:x,onFocusOutside:S,onDismiss:()=>N.onOpenChange(!1),children:d.jsx(rM,{"data-state":kae(N.open),role:"dialog",id:N.contentId,...D,...I,ref:e,style:{...I.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Iae="PopoverClose",FLe=K.forwardRef((t,e)=>{const{__scopePopover:i,...n}=t,o=Vg(Iae,i);return d.jsx(vn.button,{type:"button",...n,ref:e,onClick:Ni(t.onClick,()=>o.onOpenChange(!1))})});FLe.displayName=Iae;var BLe="PopoverArrow",ULe=K.forwardRef((t,e)=>{const{__scopePopover:i,...n}=t,o=NE(i);return d.jsx(sM,{...o,...n,ref:e})});ULe.displayName=BLe;function kae(t){return t?"open":"closed"}var VLe=bae,$Le=Tae,qLe=Cae,Pae=Eae;const cF=VLe,uF=$Le,nN=K.forwardRef(({className:t,align:e="center",sideOffset:i=4,...n},o)=>d.jsx(qLe,{children:d.jsx(Pae,{ref:o,align:e,sideOffset:i,className:nn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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-[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 origin-[--radix-popover-content-transform-origin]",t),...n})}));nN.displayName=Pae.displayName;const HLe=["#000000","#374151","#6B7280","#DC2626","#EA580C","#D97706","#16A34A","#2563EB","#7C3AED","#DB2777"],GLe=[{label:"S",value:"14px"},{label:"M",value:"16px"},{label:"L",value:"20px"},{label:"XL",value:"24px"}];function kp({active:t,onClick:e,children:i,title:n}){return d.jsx(tt,{type:"button",variant:"ghost",size:"icon",className:t?"toggle-elevate toggle-elevated":"",onClick:e,title:n,"data-testid":`button-editor-${n.toLowerCase().replace(/\s+/g,"-")}`,children:i})}function WLe({content:t,onChange:e,placeholder:i}){const n=Lje({extensions:[SLe.configure({heading:!1,codeBlock:!1,co
3870de:!1,blockquote:!1,horizontalRule:!1}),yae,vae,NLe,Qze,CLe.configure({types:["paragraph"]})],content:t,onUpdate:({editor:c})=>{e(c.getHTML())},editorProps:{attributes:{class:"prose prose-sm max-w-none min-h-[120px] p-3 focus:outline-none text-foreground","data-placeholder":i||""}}});K.useEffect(()=>{n&&t&&n.getHTML()!==t&&!n.isFocused&&n.commands.setContent(t)},[t,n]);const o=K.useCallback(c=>{n==null||n.chain().focus().setColor(c).run()},[n]);return n?d.jsxs("div",{className:"border rounded-md overflow-visible bg-background","data-testid":"rich-text-editor",children:[d.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap border-b p-1 bg-muted/30",children:[d.jsx(kp,{active:n.isActive("bold"),onClick:()=>n.chain().focus().toggleBold().run(),title:"Bold",children:d.jsx($ve,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive("italic"),onClick:()=>n.chain().focus().toggleItalic().run(),title:"Italic",children:d.jsx(nxe,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive("underline"),onClick:()=>n.chain().focus().toggleUnderline().run(),title:"Underline",children:d.jsx(_xe,{className:"h-4 w-4"})}),d.jsx("div",{className:"w-px h-6 bg-border mx-1"}),d.jsxs(cF,{children:[d.jsx(uF,{asChild:!0,children:d.jsx(tt,{type:"button",variant:"ghost",size:"icon",title:"Color","data-testid":"button-editor-color",children:d.jsx(axe,{className:"h-4 w-4"})})}),d.jsx(nN,{className:"w-auto p-2",align:"start",children:d.jsx("div",{className:"grid grid-cols-5 gap-1.5",children:HLe.map(c=>d.jsx("button",{type:"button",className:"w-6 h-6 rounded-full border border-border hover-elevate",style:{backgroundColor:c},onClick:()=>o(c),"data-testid":`button-color-${c.replace("#","")}`},c))})})]}),d.jsxs(cF,{children:[d.jsx(uF,{asChild:!0,children:d.jsx(tt,{type:"button",variant:"ghost",size:"icon",title:"Font size","data-testid":"button-editor-font-size",children:d.jsx(yxe,{className:"h-4 w-4"})})}),d.jsx(nN,{className:"w-auto p-2",align:"start",children:d.jsx("div",{className:"flex gap-1",children:GLe.map(c=>d.jsx(tt,{type:"button",variant:"ghost",size:"sm",className:n.isActive("textStyle",{fontSize:c.value})?"toggle-elevate toggle-elevated":"",onClick:()=>n.chain().focus().setFontSize(c.value).run(),"data-testid":`button-fontsize-${c.label.toLowerCase()}`,children:c.label},c.value))})})]}),d.jsx("div",{className:"w-px h-6 bg-border mx-1"}),d.jsx(kp,{active:n.isActive({textAlign:"left"}),onClick:()=>n.chain().focus().setTextAlign("left").run(),title:"Align left",children:d.jsx(zve,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive({textAlign:"center"}),onClick:()=>n.chain().focus().setTextAlign("center").run(),title:"Align center",children:d.jsx(Rve,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive({textAlign:"right"}),onClick:()=>n.chain().focus().setTextAlign("right").run(),title:"Align right",children:d.jsx(Lve,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive({textAlign:"justify"}),onClick:()=>n.chain().focus().setTextAlign("justify").run(),title:"Justify",children:d.jsx(jve,{className:"h-4 w-4"})}),d.jsx("div",{className:"w-px h-6 bg-border mx-1"}),d.jsx(kp,{active:n.isActive("bulletList"),onClick:()=>n.chain().focus().toggleBulletList().run(),title:"Bullet list",children:d.jsx(TJ,{className:"h-4 w-4"})}),d.jsx(kp,{active:n.isActive("orderedList"),onClick:()=>n.chain().focus().toggleOrderedList().run(),title:"Ordered list",children:d.jsx(rxe,{className:"h-4 w-4"})})]}),d.jsx(Boe,{editor:n})]}):null}var NB="Switch",[KLe,O8e]=Wa(NB),[ZLe,XLe]=KLe(NB),Nae=K.forwardRef((t,e)=>{const{__scopeSwitch:i,name:n,checked:o,defaultChecked:c,required:f,disabled:r,value:x="on",onCheckedChange:S,form:C,...I}=t,[N,D]=K.useState(null),V=wr(e,te=>D(te)),B=K.useRef(!1),W=N?C||!!N.closest("form"):!0,[$=!1,G]=lu({prop:o,defaultProp:c,onChange:S});return d.jsxs(ZLe,{scope:i,checked:$,disabled:r,children:[d.jsx(vn.button,{type:"button",role:"switch","aria-checked":$,"aria-required":f,"data-state":Rae($),"data-disabled":r?"":void 0,disabled:r,value:x,...I,ref:V,onClick:Ni(t.onClick,te=>{G(ce=>!ce),W&&(B.current=te.isPropagationStopped(),B.current||te.stopPropagation())})}),W&&d.jsx(YLe,{control:N,bubbles:!B.current,name:n,value:x,checked:$,required:f,disabled:r,form:C,style:{transform:"translateX(-100%)"}})]})});Nae.displayName=NB;var Mae="SwitchThumb",Dae=K.forwardRef((t,e)=>{const{__scopeSwitch:i,...n}=t,o=XLe(Mae,i);return d.jsx(vn.span,{"data-state":Rae(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:e})});Dae.displayName=Mae;var YLe=t=>{const{control:e,checked:i,bubbles:n=!0,...o}=t,c=K.useRef(null),f=y4(i),r=s4(e);return K.useEffect(()=>{const x=c.current,S=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(S,"checked").set;if(f!==i&&I){const N=new Event("click",{bubbles:n});I.call(x,i),x.dispatchEvent(N)}},[f,i,n]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...o,tabIndex:-1,ref:c,style:{...t.style,...r,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Rae(t){return t?"checked":"unchecked"}var jae=Nae,QLe=Dae;const ou=K.forwardRef(({className:t,...e},i)=>d.jsx(jae,{className:nn("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:i,children:d.jsx(QLe,{className:nn("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}
3870));ou.displayName=jae.displayName;var JLe="Label",zae=K.forwardRef((t,e)=>d.jsx(vn.label,{...t,ref:e,onMouseDown:i=>{var o;i.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,i),!i.defaultPrevented&&i.detail>1&&i.preventDefault())}}));zae.displayName=JLe;var Lae=zae;const eOe=Xb("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Fn=K.forwardRef(({className:t,...e},i)=>d.jsx(Lae,{ref:i,className:nn(eOe(),t),...e}));Fn.displayName=Lae.displayName;const $g=GAe,Oae=K.createContext({}),ns=({...t})=>d.jsx(Oae.Provider,{value:{name:t.name},children:d.jsx(XAe,{...t})}),$M=()=>{const t=K.useContext(Oae),e=K.useContext(Fae),{getFieldState:i,formState:n}=CM(),o=i(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:c}=e;return{id:c,name:t.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...o}},Fae=K.createContext({}),Yr=K.forwardRef(({className:t,...e},i)=>{const n=K.useId();return d.jsx(Fae.Provider,{value:{id:n},children:d.jsx("div",{ref:i,className:nn("space-y-2",t),...e})})});Yr.displayName="FormItem";const ds=K.forwardRef(({className:t,...e},i)=>{const{error:n,formItemId:o}=$M();return d.jsx(Fn,{ref:i,className:nn(n&&"text-destructive",t),htmlFor:o,...e})});ds.displayName="FormLabel";const Qr=K.forwardRef(({...t},e)=>{const{error:i,formItemId:n,formDescriptionId:o,formMessageId:c}=$M();return d.jsx($Q,{ref:e,id:n,"aria-describedby":i?`${o} ${c}`:`${o}`,"aria-invalid":!!i,...t})});Qr.displayName="FormControl";const zp=K.forwardRef(({className:t,...e},i)=>{const{formDescriptionId:n}=$M();return d.jsx("p",{ref:i,id:n,className:nn("text-sm text-muted-foreground",t),...e})});zp.displayName="FormDescription";const Is=K.forwardRef(({className:t,children:e,...i},n)=>{const{error:o,formMessageId:c}=$M(),f=o?String((o==null?void 0:o.message)??""):e;return f?d.jsx("p",{ref:n,id:c,className:nn("text-sm font-medium text-destructive",t),...i,children:f}):null});Is.displayName="FormMessage";const tOe=Xb("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),nk=K.forwardRef(({className:t,variant:e,...i},n)=>d.jsx("div",{ref:n,role:"alert",className:nn(tOe({variant:e}),t),...i}));nk.displayName="Alert";const iOe=K.forwardRef(({className:t,...e},i)=>d.jsx("h5",{ref:i,className:nn("mb-1 font-medium leading-none tracking-tight",t),...e}));iOe.displayName="AlertTitle";const rk=K.forwardRef(({className:t,...e},i)=>d.jsx("div",{ref:i,className:nn("text-sm [&_p]:leading-relaxed",t),...e}));rk.displayName="AlertDescription";function Bae(t,e){return Object.hasOwn(t,e)}const{AbortController:Ez}=globalThis,Uae=(t="Aborted",e)=>{const i=new DOMException(t,"AbortError");return e!=null&&Bae(e,"cause")&&Object.defineProperty(i,"cause",{__proto__:null,configurable:!0,writable:!0,value:e.cause}),i},nOe=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function rOe(t,e,i){const n=nOe.exec(t),o=e.mimeType??(n==null?void 0:n[1])??"plain/text";let c;if((n==null?void 0:n[2])!=null){const f=atob(decodeURIComponent(n[3])),r=new Uint8Array(f.length);for(let x=0;x<f.length;x++)r[x]=f.charCodeAt(x);c=[r]}else(n==null?void 0:n[3])!=null&&(c=[decodeURIComponent(n[3])]);return new Blob(c,{type:o})}class sOe extends Error{constructor(i,n){super(i);je(this,"isNetworkError");je(this,"cause");this.cause=n==null?void 0:n.cause,this.cause&&Bae(this.cause,"isNetworkError")?this.isNetworkError=this.cause.isNetworkError:this.isNetworkError=!1}}function MG(t,e,i,n){return t===e?t:n===0?e:t+(e-t)*2**(-n/i)}const Vae=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not
3870([tabindex^="-"]):not([inert]):not([aria-hidden])'];class oOe extends Error{constructor(i,n=null){super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall.");je(this,"cause");je(this,"isNetworkError");je(this,"request");this.cause=i,this.isNetworkError=!0,this.request=n}}function aOe(...t){return fetch(...t).catch(e=>{throw e.name==="AbortError"?e:new oOe(e)})}function lOe(t){const e=i=>"error"in i&&!!i.error;return t.filter(i=>!e(i))}function cOe(t){return t.filter(e=>{var i;return!((i=e.progress)!=null&&i.uploadStarted)||!e.isRestored})}function $ae(t){return typeof t!="object"||t===null||!("nodeType"in t)?!1:t.nodeType===Node.ELEMENT_NODE}function DG(t){if(typeof t=="string"){const e=document.querySelectorAll(t);return e.length===0?null:Array.from(e)}return typeof t=="object"&&$ae(t)?[t]:null}function uOe(t,e=document){return typeof t=="string"?e.querySelector(t):$ae(t)?t:null}function qae(t){const e=t.lastIndexOf(".");return e===-1||e===t.length-1?{name:t,extension:void 0}:{name:t.slice(0,e),extension:t.slice(e+1)}}const RG={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",msg:"application/vnd.ms-outlook",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Hae(t){var i;if(t.type)return t.type;const e=t.name?(i=qae(t.name).extension)==null?void 0:i.toLowerCase():null;return e&&e in RG?RG[e]:"application/octet-stream"}function dOe(t){return t.charCodeAt(0).toString(32)}function jG(t){let e="";return t.replace(/[^A-Z0-9]/gi,i=>(e+=`-${dOe(i)}`,"/"))+e}function hOe(t,e){var n;let i=e||"uppy";return typeof t.name=="string"&&(i+=`-${jG(t.name.toLowerCase())}`),t.type!==void 0&&(i+=`-${t.type}`),t.meta&&typeof t.meta.relativePath=="string"&&(i+=`-${jG(t.meta.relativePath.toLowerCase())}`),((n=t.data)==null?void 0:n.size)!==void 0&&(i+=`-${t.data.size}`),t.data.lastModified!==void 0&&(i+=`-${t.data.lastModified}`),i}function pOe(t){return!t.isRemote||!t.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(t.remote.provider)}function fOe(t,e){if(pOe(t))return t.id;const i=Hae(t);return hOe({...t,type:i},e)}function zG(t,e){return t===!0?Object.keys(e):Array.isArray(t)?t:[]}const PT=Array.from;function mOe(t){const e=PT(t.files);return Promise.resolve(e)}function Gae(t,e,i,{onSuccess:n}){t.readEntries(o=>{const c=[...e,...o];o.length?queueMicrotask(()=>{Gae(t,c,i,{onSuccess:n})}):n(c)},o=>{i(o),n(e)})}function Wae(t,e){return t==null?t:{kind:t.isFile?"file":t.isDirectory?"directory":void 0,name:t.name,getFile(){return new Promise((i,n)=>t.file(i,n))},async*values(){const i=t.createReader();yield*await new Promise(o=>{Gae(i,[],e,{onSuccess:c=>o(c.map(f=>Wae(f,e)))})})},isSameEntry:void 0}}async function*Kae(t,e,i=void 0){const n=()=>`${e}/${t.name}`;if(t.kind==="file"){const o=await t.getFile();o!=null?(o.relativePath=e?n():null,yield o):i!=null&&(yield i)}else if(t.kind==="directory")for await(const o of t.values())yield*Kae(o,e?n():t.name);else i!=null&&(yield i)}async function*gOe(t,e){const i=await Promise.all(Array.from(t.items,async n=>{let o;return o??(o=Wae(typeof n.getAsEntry=="function"?n.getAsEntry():n.webkitGetAsEntry(),e)),{fileSystemHandle:o,lastResortFile:n.getAsFile()}}));for(const{lastResortFile:n,fileSystemHandle:o}of i)if(o!=null)try{yield*Kae(o,"",n)}catch(c){n!=null?yield n:e(c)}else n!=null&&(yield n)}async function yOe(t,e){const i=(e==null?void 0:e.logDropError)??Function.prototype;try{const n=[];for await(const o of gOe(t,i))n.push(o);return n}catch{return mOe(t)}}function _Oe(t){var o;const i=(o=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?([^\n]+)/i.exec(t))==null?void 0:o[1];return`${/^http:\/\//i.test(t)?"ws":"wss"}://${i}`}function vOe(t){for(;t&&!t.dir;)t=t.parentNode;return t==null?void 0:t.dir}function Az(t){return t<10?`0${t}`:t.toString()}function sk(){const t=new Date,e=Az(t.getHours()),i=Az(t.getMinutes()),n=Az(t.getSeconds());return`${e}:${i}:${n}`}function xOe(){if(typeof window>"u")return!1;const t=document.body;return!(t==null||window==null||!("draggable"in t)||!("ondragstart"in t)||!("ondrop"in t)||!("FormData"in window)||!("FileReader"in window))}function LG(t){return t.startsWith("blob:")}function OG(t){return t?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(t):!1}function bOe(t){const e=Math.floor(t/3600)%24,i=Math.floor(t/60)%60,n=Math.floor(t%60);return{hours:e,minutes:i,seconds:n}}function wOe(t){const e=bOe(t),i=e.hours===0?"":`${e.hours}h`,n=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,o=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${i}${n}${o}`}function SOe(t){return new Error("Cancelled",{cause:t})}function FG(t){var e;if(t!=null){const i=()=>this.abort(t.reason);t.addEventListener("abort",i,{once:!0});const n=()=>{t.removeEventListener("abort",i)};(e=this.then)==null||e.call(this,n,n)}return this}var Bp,Eh,Up,X0,Ah,Y0,f_,Cl,dF,QS,Zae,Xae,Yae,fN,Q0;class TOe{constructor(e){Wt(this,Cl);Wt(this,Bp,0);Wt(this,Eh,[]);Wt(this,Up,!1);Wt(this,X0);Wt(this,Ah,1);Wt(this,Y0);Wt(this,f_);je(this,"limit");
3870Wt(this,fN,()=>this.resume());Wt(this,Q0,()=>{if(he(this,Up)){Jt(this,f_,setTimeout(he(this,Q0),0));return}Jt(this,Ah,this.limit),this.limit=Math.ceil((he(this,Y0)+he(this,Ah))/2);for(let e=he(this,Ah);e<=this.limit;e++)ci(this,Cl,QS).call(this);he(this,Y0)-he(this,Ah)>3?Jt(this,f_,setTimeout(he(this,Q0),2e3)):Jt(this,Ah,Math.floor(he(this,Ah)/2))});typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,i){return!he(this,Up)&&he(this,Bp)<this.limit?ci(this,Cl,dF).call(this,e):ci(this,Cl,Xae).call(this,e,i)}wrapSyncFunction(e,i){return(...n)=>{const o=this.run(()=>(e(...n),queueMicrotask(()=>o.done()),()=>{}),i);return{abortOn:FG,abort(){o.abort()}}}}wrapPromiseFunction(e,i){return(...n)=>{let o;const c=new Promise((f,r)=>{o=this.run(()=>{let x,S;try{S=Promise.resolve(e(...n))}catch(C){S=Promise.reject(C)}return S.then(C=>{x?r(x):(o.done(),f(C))},C=>{x?r(x):(o.done(),r(C))}),C=>{x=SOe(C)}},i)});return c.abort=f=>{o.abort(f)},c.abortOn=FG,c}}resume(){Jt(this,Up,!1),clearTimeout(he(this,X0));for(let e=0;e<this.limit;e++)ci(this,Cl,QS).call(this)}pause(e=null){Jt(this,Up,!0),clearTimeout(he(this,X0)),e!=null&&Jt(this,X0,setTimeout(he(this,fN),e))}rateLimit(e){clearTimeout(he(this,f_)),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(Jt(this,Y0,this.limit-1),this.limit=he(this,Ah),Jt(this,f_,setTimeout(he(this,Q0),e)))}get isPaused(){return he(this,Up)}}Bp=new WeakMap,Eh=new WeakMap,Up=new WeakMap,X0=new WeakMap,Ah=new WeakMap,Y0=new WeakMap,f_=new WeakMap,Cl=new WeakSet,dF=function(e){Jt(this,Bp,he(this,Bp)+1);let i=!1,n;try{n=e()}catch(o){throw Jt(this,Bp,he(this,Bp)-1),o}return{abort:o=>{i||(i=!0,Jt(this,Bp,he(this,Bp)-1),n==null||n(o),ci(this,Cl,QS).call(this))},done:()=>{i||(i=!0,Jt(this,Bp,he(this,Bp)-1),ci(this,Cl,QS).call(this))}}},QS=function(){queueMicrotask(()=>ci(this,Cl,Zae).call(this))},Zae=function(){if(he(this,Up)||he(this,Bp)>=this.limit||he(this,Eh).length===0)return;const e=he(this,Eh).shift();if(e==null)throw new Error("Invariant violation: next is null");const i=ci(this,Cl,dF).call(this,e.fn);e.abort=i.abort,e.done=i.done},Xae=function(e,i){const n={fn:e,priority:(i==null?void 0:i.priority)||0,abort:()=>{ci(this,Cl,Yae).call(this,n)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},o=he(this,Eh).findIndex(c=>n.priority>c.priority);return o===-1?he(this,Eh).push(n):he(this,Eh).splice(o,0,n),n},Yae=function(e){const i=he(this,Eh).indexOf(e);i!==-1&&he(this,Eh).splice(i,1)},fN=new WeakMap,Q0=new WeakMap;function COe(t,e,i){const n=[];return t.forEach(o=>typeof o!="string"?n.push(o):e[Symbol.split](o).forEach((c,f,r)=>{c!==""&&n.push(c),f<r.length-1&&n.push(i)})),n}/** 3871 * Takes a string with placeholder variables like `%{smart_count} file selected` 3872 * and replaces it with values from options `{smart_count: 5}` 3873 * 3874 * @license https://github.com/airbnb/polyglot.js/blob/master/LICENSE 3875 * taken from https://github.com/airbnb/polyglot.js/blob/master/lib/polyglot.js#L299 3876 * 3877 * @param phrase that needs interpolation, with placeholders 3878 * @param options with values that will be used to replace placeholders 3879 */function BG(t,e){const i=/\$/g,n="$$$$";let o=[t];if(e==null)return o;for(const c of Object.keys(e))if(c!=="_"){let f=e[c];typeof f=="string"&&(f=i[Symbol.replace](f,n)),o=COe(o,new RegExp(`%\\{${c}\\}`,"g"),f)}return o}const EOe=t=>{throw new Error(`missing string: ${t}`)};var LC,OC,hF;class Qae{constructor(e,{onMissingKey:i=EOe}={}){Wt(this,OC);je(this,"locale");Wt(this,LC);this.locale={strings:{},pluralize(n){return n===1?0:1}},Array.isArray(e)?e.forEach(ci(this,OC,hF),this):ci(this,OC,hF).call(this,e),Jt(this,LC,i)}translate(e,i){return this.translateArray(e,i).join("")}translateArray(e,i){let n=this.locale.strings[e];if(n==null&&(he(this,LC).call(this,e),n=e),typeof n=="object"){if(i&&typeof i.smart_count<"u"){const c=this.locale.pluralize(i.smart_count);return BG(n[c],i)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof n!="string")throw new Error("string was not a string");return BG(n,i)}}LC=new WeakMap,OC=new WeakSet,hF=function(e){if(!(e!=null&&e.strings))return;const i=this.locale;Object.assign(this.locale,{strings:{...i.strings,...e.strings},pluralize:e.pluralize||i.pluralize})};const Iz="...";function Jae(t,e){if(e===0)return"";if(t.length<=e)return t;if(e<=Iz.length+1)return`${t.slice(0,e-1)}â¦`;const i=e-Iz.length,n=Math.ceil(i/2),o=Math.floor(i/2);return t.slice(0,n)+Iz+t.slice(-o)}
vendor: 5,428 bytes, line 3879
3879class AOe extends Error{constructor(){super(...arguments);je(this,"name","UserFacingApiError")}}var ME,Ks,ele,Ky,UG,tle,ile,nle,MB,pF,fF,kC={},rle=[],IOe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,DE=Array.isArray;function Oh(t,e){for(var i in e)t[i]=e[i];return t}function DB(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function RB(t,e,i){var n,o,c,f={};for(c in e)c=="key"?n=e[c]:c=="ref"?o=e[c]:f[c]=e[c];if(arguments.length>2&&(f.children=arguments.length>3?ME.call(arguments,2):i),typeof t=="function"&&t.defaultProps!=null)for(c in t.defaultProps)f[c]===void 0&&(f[c]=t.defaultProps[c]);return NT(t,f,n,o,null)}function NT(t,e,i,n,o){var c={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++ele,__i:-1,__u:0};return o==null&&Ks.vnode!=null&&Ks.vnode(c),c}function kOe(){return{current:null}}function Zp(t){return t.children}function $h(t,e){this.props=t,this.context=e}function Ub(t,e){if(e==null)return t.__?Ub(t.__,t.__i+1):null;for(var i;e<t.__k.length;e++)if((i=t.__k[e])!=null&&i.__e!=null)return i.__e;return typeof t.type=="function"?Ub(t):null}function sle(t){var e,i;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((i=t.__k[e])!=null&&i.__e!=null){t.__e=t.__c.base=i.__e;break}return sle(t)}}function VG(t){(!t.__d&&(t.__d=!0)&&Ky.push(t)&&!rN.__r++||UG!=Ks.debounceRendering)&&((UG=Ks.debounceRendering)||tle)(rN)}function rN(){for(var t,e,i,n,o,c,f,r=1;Ky.length;)Ky.length>r&&Ky.sort(ile),t=Ky.shift(),r=Ky.length,t.__d&&(i=void 0,n=void 0,o=(n=(e=t).__v).__e,c=[],f=[],e.__P&&((i=Oh({},n)).__v=n.__v+1,Ks.vnode&&Ks.vnode(i),jB(e.__P,i,n,e.__n,e.__P.namespaceURI,32&n.__u?[o]:null,c,o??Ub(n),!!(32&n.__u),f),i.__v=n.__v,i.__.__k[i.__i]=i,lle(c,i,f),n.__e=n.__=null,i.__e!=o&&sle(i)));rN.__r=0}function ole(t,e,i,n,o,c,f,r,x,S,C){var I,N,D,V,B,W,$,G=n&&n.__k||rle,te=e.length;for(x=POe(i,e,G,x,te),I=0;I<te;I++)(D=i.__k[I])!=null&&(N=D.__i==-1?kC:G[D.__i]||kC,D.__i=I,W=jB(t,D,N,o,c,f,r,x,S,C),V=D.__e,D.ref&&N.ref!=D.ref&&(N.ref&&zB(N.ref,null,D),C.push(D.ref,D.__c||V,D)),B==null&&V!=null&&(B=V),($=!!(4&D.__u))||N.__k===D.__k?x=ale(D,x,t,$):typeof D.type=="function"&&W!==void 0?x=W:V&&(x=V.nextSibling),D.__u&=-7);return i.__e=B,x}function POe(t,e,i,n,o){var c,f,r,x,S,C=i.length,I=C,N=0;for(t.__k=new Array(o),c=0;c<o;c++)(f=e[c])!=null&&typeof f!="boolean"&&typeof f!="function"?(x=c+N,(f=t.__k[c]=typeof f=="string"||typeof f=="number"||typeof f=="bigint"||f.constructor==String?NT(null,f,null,null,null):DE(f)?NT(Zp,{children:f},null,null,null):f.constructor==null&&f.__b>0?NT(f.type,f.props,f.key,f.ref?f.ref:null,f.__v):f).__=t,f.__b=t.__b+1,r=null,(S=f.__i=NOe(f,i,x,I))!=-1&&(I--,(r=i[S])&&(r.__u|=2)),r==null||r.__v==null?(S==-1&&(o>C?N--:o<C&&N++),typeof f.type!="function"&&(f.__u|=4)):S!=x&&(S==x-1?N--:S==x+1?N++:(S>x?N--:N++,f.__u|=4))):t.__k[c]=null;if(I)for(c=0;c<C;c++)(r=i[c])!=null&&!(2&r.__u)&&(r.__e==n&&(n=Ub(r)),ule(r,r));return n}function ale(t,e,i,n){var o,c;if(typeof t.type=="function"){for(o=t.__k,c=0;o&&c<o.length;c++)o[c]&&(o[c].__=t,e=ale(o[c],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Ub(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Sm(t,e){return e=e||[],t==null||typeof t=="boolean"||(DE(t)?t.some(function(i){Sm(i,e)}):e.push(t)),e}function NOe(t,e,i,n){var o,c,f,r=t.key,x=t.type,S=e[i],C=S!=null&&(2&S.__u)==0;if(S===null&&t.key==null||C&&r==S.key&&x==S.type)return i;if(n>(C?1:0)){for(o=i-1,c=i+1;o>=0||c<e.length;)if((S=e[f=o>=0?o--:c++])!=null&&!(2&S.__u)&&r==S.key&&x==S.type)return f}return-1}function $G(t,e,i){e[0]=="-"?t.setProperty(e,i??""):t[e]=i==null?"":typeof i!="number"||IOe.test(e)?i:i+"px"}function vI(t,e,i,n,o){var c,f;e:if(e=="style")if(typeof i=="string")t.style.cssText=i;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||$G(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||$G(t.style,e,i[e])}else if(e[0]=="o"&&e[1]=="n")c=e!=(e=e.replace(nle,"$1")),f=e.toLowerCase(),e=f in t||e=="onFocusOut"||e=="onFocusIn"?f.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+c]=i,i?n?i.u=n.u:(i.u=MB,t.addEventListener(e,c?fF:pF,c)):t.removeEventListener(e,c?fF:pF,c);else{if(o=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=i??"";break e}catch{}typeof i=="function"||(i==null||i===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&i==1?"":i))}}function qG(t){return function(e){if(this.l){var i=this.l[e.type+t];if(e.t==null)e.t=MB++;else if(e.t<i.u)return;return i(Ks.event?Ks.event(e):e)}}}function jB(t,e,i,n,o,c,f,r,x,S){var C,I,N,D,V,B,W,$,G,te,ce,_e,Te,we,Ne,pe,Pe,De=e.type;if(e.constructor!=null)return null;128&i.__u&&(x=!!(32&i.__u),c=[r=e.__e=i.__e]),(C=Ks.__b)&&C(e);e:if(typeof De=="function")try{if($=e.props,G="prototype"in De&&De.prototype.render,te=(C=De.contextType)&&n[C.__c],ce=C?te?te.props.value:C.__:n,i.__c?W=(I=e.__c=i.__c).__=I.__E:(G?e.__c=I=new De($,ce):(e.__c=I=new $h($,ce),I.constructor=De,I.render=DOe),te&&te.sub(I),I.props=$,I.state||(I.state={}),I.context=ce,I.__n=n,N=I.__d=!0,I.__h=[],I._sb=[]),G&&I.__s==null&&(I.__s=I.state),G&&De.getDerivedStateFromProps!=null&&(I.__s==I.state&&(I.__s=Oh({}
vendor: 6,662 bytes, line 3879
3879,I.__s)),Oh(I.__s,De.getDerivedStateFromProps($,I.__s))),D=I.props,V=I.state,I.__v=e,N)G&&De.getDerivedStateFromProps==null&&I.componentWillMount!=null&&I.componentWillMount(),G&&I.componentDidMount!=null&&I.__h.push(I.componentDidMount);else{if(G&&De.getDerivedStateFromProps==null&&$!==D&&I.componentWillReceiveProps!=null&&I.componentWillReceiveProps($,ce),!I.__e&&I.shouldComponentUpdate!=null&&I.shouldComponentUpdate($,I.__s,ce)===!1||e.__v==i.__v){for(e.__v!=i.__v&&(I.props=$,I.state=I.__s,I.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(Je){Je&&(Je.__=e)}),_e=0;_e<I._sb.length;_e++)I.__h.push(I._sb[_e]);I._sb=[],I.__h.length&&f.push(I);break e}I.componentWillUpdate!=null&&I.componentWillUpdate($,I.__s,ce),G&&I.componentDidUpdate!=null&&I.__h.push(function(){I.componentDidUpdate(D,V,B)})}if(I.context=ce,I.props=$,I.__P=t,I.__e=!1,Te=Ks.__r,we=0,G){for(I.state=I.__s,I.__d=!1,Te&&Te(e),C=I.render(I.props,I.state,I.context),Ne=0;Ne<I._sb.length;Ne++)I.__h.push(I._sb[Ne]);I._sb=[]}else do I.__d=!1,Te&&Te(e),C=I.render(I.props,I.state,I.context),I.state=I.__s;while(I.__d&&++we<25);I.state=I.__s,I.getChildContext!=null&&(n=Oh(Oh({},n),I.getChildContext())),G&&!N&&I.getSnapshotBeforeUpdate!=null&&(B=I.getSnapshotBeforeUpdate(D,V)),pe=C,C!=null&&C.type===Zp&&C.key==null&&(pe=cle(C.props.children)),r=ole(t,DE(pe)?pe:[pe],e,i,n,o,c,f,r,x,S),I.base=e.__e,e.__u&=-161,I.__h.length&&f.push(I),W&&(I.__E=I.__=null)}catch(Je){if(e.__v=null,x||c!=null)if(Je.then){for(e.__u|=x?160:128;r&&r.nodeType==8&&r.nextSibling;)r=r.nextSibling;c[c.indexOf(r)]=null,e.__e=r}else{for(Pe=c.length;Pe--;)DB(c[Pe]);mF(e)}else e.__e=i.__e,e.__k=i.__k,Je.then||mF(e);Ks.__e(Je,e,i)}else c==null&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):r=e.__e=MOe(i.__e,e,i,n,o,c,f,x,S);return(C=Ks.diffed)&&C(e),128&e.__u?void 0:r}function mF(t){t&&t.__c&&(t.__c.__e=!0),t&&t.__k&&t.__k.forEach(mF)}function lle(t,e,i){for(var n=0;n<i.length;n++)zB(i[n],i[++n],i[++n]);Ks.__c&&Ks.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(c){c.call(o)})}catch(c){Ks.__e(c,o.__v)}})}function cle(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:DE(t)?t.map(cle):Oh({},t)}function MOe(t,e,i,n,o,c,f,r,x){var S,C,I,N,D,V,B,W=i.props,$=e.props,G=e.type;if(G=="svg"?o="http://www.w3.org/2000/svg":G=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),c!=null){for(S=0;S<c.length;S++)if((D=c[S])&&"setAttribute"in D==!!G&&(G?D.localName==G:D.nodeType==3)){t=D,c[S]=null;break}}if(t==null){if(G==null)return document.createTextNode($);t=document.createElementNS(o,G,$.is&&$),r&&(Ks.__m&&Ks.__m(e,c),r=!1),c=null}if(G==null)W===$||r&&t.data==$||(t.data=$);else{if(c=c&&ME.call(t.childNodes),W=i.props||kC,!r&&c!=null)for(W={},S=0;S<t.attributes.length;S++)W[(D=t.attributes[S]).name]=D.value;for(S in W)if(D=W[S],S!="children"){if(S=="dangerouslySetInnerHTML")I=D;else if(!(S in $)){if(S=="value"&&"defaultValue"in $||S=="checked"&&"defaultChecked"in $)continue;vI(t,S,null,D,o)}}for(S in $)D=$[S],S=="children"?N=D:S=="dangerouslySetInnerHTML"?C=D:S=="value"?V=D:S=="checked"?B=D:r&&typeof D!="function"||W[S]===D||vI(t,S,D,W[S],o);if(C)r||I&&(C.__html==I.__html||C.__html==t.innerHTML)||(t.innerHTML=C.__html),e.__k=[];else if(I&&(t.innerHTML=""),ole(e.type=="template"?t.content:t,DE(N)?N:[N],e,i,n,G=="foreignObject"?"http://www.w3.org/1999/xhtml":o,c,f,c?c[0]:i.__k&&Ub(i,0),r,x),c!=null)for(S=c.length;S--;)DB(c[S]);r||(S="value",G=="progress"&&V==null?t.removeAttribute("value"):V!=null&&(V!==t[S]||G=="progress"&&!V||G=="option"&&V!=W[S])&&vI(t,S,V,W[S],o),S="checked",B!=null&&B!=t[S]&&vI(t,S,B,W[S],o))}return t}function zB(t,e,i){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(o){Ks.__e(o,i)}}function ule(t,e,i){var n,o;if(Ks.unmount&&Ks.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||zB(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(c){Ks.__e(c,e)}n.base=n.__P=null}if(n=t.__k)for(o=0;o<n.length;o++)n[o]&&ule(n[o],e,i||typeof t.type!="function");i||DB(t.__e),t.__c=t.__=t.__e=void 0}function DOe(t,e,i){return this.constructor(t,i)}function HG(t,e,i){var n,o,c,f;e==document&&(e=document.documentElement),Ks.__&&Ks.__(t,e),o=(n=typeof i=="function")?null:e.__k,c=[],f=[],jB(e,t=(!n&&i||e).__k=RB(Zp,null,[t]),o||kC,kC,e.namespaceURI,!n&&i?[i]:o?null:e.firstChild?ME.call(e.childNodes):null,c,!n&&i?i:o?o.__e:e.firstChild,n,f),lle(c,t,f)}function dle(t,e,i){var n,o,c,f,r=Oh({},t.props);for(c in t.type&&t.type.defaultProps&&(f=t.type.defaultProps),e)c=="key"?n=e[c]:c=="ref"?o=e[c]:r[c]=e[c]===void 0&&f!=null?f[c]:e[c];return arguments.length>2&&(r.children=arguments.length>3?ME.call(arguments,2):i),NT(t.type,r,n||t.key,o||t.ref,null)}ME=rle.slice,Ks={__e:function(t,e,i,n){for(var o,c,f;e=e.__;)if((o=e.__c)&&!o.__)try{if((c=o.constructor)&&c.getDerivedStateFromError!=null&&(o.setState(c.getDerivedStateFromError(t)),f=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,n||{}),f=o.__d),f)return o.__E=o}catch(r){t=r}throw t}},ele=0,$h.prototype.setState=function(t,e){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Oh({},this.state),typeof t=="function"&&(t=t(Oh({},i),this.props)),t&&Oh(i,t),t!=null&&this.__v&&(e&&this._sb.push(e),VG(this))},$h.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),VG(this))},$h.prototype.render=Zp,Ky=[],tle=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ile=function(t,e){return t.__v.__b-e.__v.__b},rN.__r=0,nle=/(PointerCapture)$|Capture$/i,MB=0,pF=qG(!1),fF=qG(!0);var ROe=0;function qe(t,e,i,n,o,c){e||(e={});var f,r,x=e;if("ref"in x)for(r in x={},e)r=="ref"?f=e[r]:x[r]=e[r];var S={type:t,props:x,key:i,ref:f,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ROe,__i:-1,__u:0,__source:o,__self:c};if(typeof t=="function"&&(f=t.defaultProps))for(r in f)x[r]===void 0&&(x[r]=f[r]);return Ks.vnode&&Ks.vnode(S),S}var PC,Xo,kz,GG,NC=0,hle=[],ua=Ks,WG=ua.__b,KG=ua.__r,ZG=ua.diffed,XG=ua.__c,YG=ua.unmount,QG=ua.__;function LB(t,e){ua.__h&&ua.__h(Xo,t,NC||e),NC=0;var i=Xo.__H||(Xo.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function Vb(t){return NC=1,jOe(fle,t)}function jOe(t,e,i){var n=LB(PC++,2);if(n.t=t,!n.__c&&(n.__=[fle(void 0,e),function(r){var x=n.__N?n.__N[0]:n.__[0],S=n.t(x,r);x!==S&&(n.__N=[S,n.__[1]],n.__c.setState({}))}],n.__c=Xo,!Xo.__f)){var o=function(r,x,S){if(!n.__c.__H)return!0;var C=n.__c.__H.__.filter(function(N){return!!N.__c});if(C.every(function(N){return!N.__N}))return!c||c.call(this,r,x,S);var I=n.__c.props!==r;
3879return C.forEach(function(N){if(N.__N){var D=N.__[0];N.__=N.__N,N.__N=void 0,D!==N.__[0]&&(I=!0)}}),c&&c.call(this,r,x,S)||I};Xo.__f=!0;var c=Xo.shouldComponentUpdate,f=Xo.componentWillUpdate;Xo.componentWillUpdate=function(r,x,S){if(this.__e){var C=c;c=void 0,o(r,x,S),c=C}f&&f.call(this,r,x,S)},Xo.shouldComponentUpdate=o}return n.__N||n.__}function sN(t,e){var i=LB(PC++,3);!ua.__s&&ple(i.__H,e)&&(i.__=t,i.u=e,Xo.__H.__h.push(i))}function D0(t){return NC=5,OB(function(){return{current:t}},[])}function OB(t,e){var i=LB(PC++,7);return ple(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function oN(t,e){return NC=8,OB(function(){return t},e)}function zOe(){for(var t;t=hle.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ok),t.__H.__h.forEach(gF),t.__H.__h=[]}catch(e){t.__H.__h=[],ua.__e(e,t.__v)}}ua.__b=function(t){Xo=null,WG&&WG(t)},ua.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),QG&&QG(t,e)},ua.__r=function(t){KG&&KG(t),PC=0;var e=(Xo=t.__c).__H;e&&(kz===Xo?(e.__h=[],Xo.__h=[],e.__.forEach(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(e.__h.forEach(ok),e.__h.forEach(gF),e.__h=[],PC=0)),kz=Xo},ua.diffed=function(t){ZG&&ZG(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(hle.push(e)!==1&&GG===ua.requestAnimationFrame||((GG=ua.requestAnimationFrame)||LOe)(zOe)),e.__H.__.forEach(function(i){i.u&&(i.__H=i.u),i.u=void 0})),kz=Xo=null},ua.__c=function(t,e){e.some(function(i){try{i.__h.forEach(ok),i.__h=i.__h.filter(function(n){return!n.__||gF(n)})}catch(n){e.some(function(o){o.__h&&(o.__h=[])}),e=[],ua.__e(n,i.__v)}}),XG&&XG(t,e)},ua.unmount=function(t){YG&&YG(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.forEach(function(n){try{ok(n)}catch(o){e=o}}),i.__H=void 0,e&&ua.__e(e,i.__v))};var JG=typeof requestAnimationFrame=="function";function LOe(t){var e,i=function(){clearTimeout(n),JG&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);JG&&(e=requestAnimationFrame(i))}function ok(t){var e=Xo,i=t.__c;typeof i=="function"&&(t.__c=void 0,i()),Xo=e}function gF(t){var e=Xo;t.__c=t.__(),Xo=e}function ple(t,e){return!t||t.length!==e.length||e.some(function(i,n){return i!==t[n]})}function fle(t,e){return typeof e=="function"?e(t):e}const OOe={position:"relative",width:"100%",minHeight:"100%"},FOe={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"};function BOe({data:t,rowHeight:e,renderRow:i,overscanCount:n=10,padding:o=4,...c}){const f=D0(null),[r,x]=Vb(0),[S,C]=Vb(0);sN(()=>{function G(){f.current!=null&&S!==f.current.offsetHeight&&C(f.current.offsetHeight)}return G(),window.addEventListener("resize",G),()=>{window.removeEventListener("resize",G)}},[S]);const I=oN(()=>{f.current&&x(f.current.scrollTop)},[]);let N=Math.floor(r/e),D=Math.floor(S/e);n&&(N=Math.max(0,N-N%n),D+=n);const V=N+D+o,B=t.slice(N,V),W={...OOe,height:t.length*e},$={...FOe,top:N*e};return qe("div",{onScroll:I,ref:f,...c,children:qe("div",{role:"presentation",style:W,children:qe("div",{role:"presentation",style:$,children:B.map(i)})})})}class mle{constructor(e,i){je(this,"uppy");je(this,"opts");je(this,"id");je(this,"defaultLocale");je(this,"i18n");je(this,"i18nArray");je(this,"type");je(this,"VERSION");this.uppy=e,this.opts=i??{}}getPluginState(){const{plugins:e}=this.uppy.getState();return(e==null?void 0:e[this.id])||{}}setPluginState(e){const{plugins:i}=this.uppy.getState();this.uppy.setState({plugins:{...i,[this.id]:{...i[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){const e=new Qae([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}}var Ih,FC;class UOe{constructor(e){Wt(this,Ih);Wt(this,FC,[]);Jt(this,Ih,e)}on(e,i){return he(this,FC).push([e,i]),he(this,Ih).on(e,i)}remove(){for(const[e,i]of he(this,FC).splice(0))he(this,Ih).off(e,i)}onFilePause(e,i){this.on("upload-pause",(n,o)=>{e===(n==null?void 0:n.id)&&i(o)})}onFileRemove(e,i){this.on("file-removed",n=>{e===n.id&&i(n.id)})}onPause(e,i){this.on("upload-pause",(n,o)=>{e===(n==null?void 0:n.id)&&i(o)})}onRetry(e,i){this.on("upload-retry",n=>{e===(n==null?void 0:n.id)&&i()})}onRetryAll(e,i){this.on("retry-all",()=>{he(this,Ih).getFile(e)&&i()})}onPauseAll(e,i){this.on("pause-all",()=>{he(this,Ih).getFile(e)&&i()})}onCancelAll(e,i){this.on("cancel-all",(...n)=>{he(this,Ih).getFile(e)&&i(...n)})}onResumeAll(e,i){this.on("resume-all",()=>{he(this,Ih).getFile(e)&&i()})}}Ih=new WeakMap,FC=new WeakMap;const VOe={debug:()=>{},warn:()=>{},error:(...t)=>console.error(`[Uppy] [${sk()}]`,...t)},$Oe={debug:(...t)=>console.debug(`[Uppy] [${sk()}]`,...t),warn:(...t)=>console.warn(`[Uppy] [${sk()}]`,...t),error:(...t)=>console.error(`[Uppy] [${sk()}]`,...t)};var qOe=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);const i=e<0;let n=Math.abs(e);if(i&&(n=-n),n===0)return"0 B";const o=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],c=Math.min(Math.floor(Math.log(n)/Math.log(1024)),o.length-1),f=Number(n/1024**c),r=o[c];return`${f>=10||f%1===0?Math.round(f):f.toFixed(1)} ${r}`};const o_=Xh(qOe);function gle(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}gle.prototype.match=function(t){var e=!0,i=this.parts,n,o=i.length,c;if(typeof t=="string"||t instanceof String)if(!this.hasWild&&this.text!=t)e=!1;else{for(c=(t||"").split(this.separator),n=0;e&&n<o;n++)i[n]!=="*"&&(n<c.length?e=i[n]===c[n]:e=!1);e=e&&c}else if(typeof t.splice=="function")for(e=[],n=t.length;n--;)this.match(t[n])&&(e[e.length]=t[n]);else if(typeof t=="object"){e={};for(var f in t)this.match(f)&&(e[f]=t[f])}return e};
3879var HOe=function(t,e,i){var n=new gle(t,i||/[\/\.]/);return typeof e<"u"?n.match(e):n},GOe=HOe,WOe=/[\/\+\.]/,KOe=function(t,e){function i(n){var o=GOe(n,t,WOe);return o&&o.length>=2}return e?i(e.split(";")[0]):i};const ZOe=Xh(KOe),XOe={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]};class bd extends Error{constructor(i,n){super(i);je(this,"isUserFacing");je(this,"file");je(this,"isRestriction",!0);this.isUserFacing=(n==null?void 0:n.isUserFacing)??!0,n!=null&&n.file&&(this.file=n.file)}}class YOe{constructor(e,i){je(this,"getI18n");je(this,"getOpts");this.getI18n=i,this.getOpts=()=>{var o;const n=e();if(((o=n.restrictions)==null?void 0:o.allowedFileTypes)!=null&&!Array.isArray(n.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return n}}validateAggregateRestrictions(e,i){const{maxTotalFileSize:n,maxNumberOfFiles:o}=this.getOpts().restrictions;if(o&&e.filter(f=>!f.isGhost).length+i.length>o)throw new bd(`${this.getI18n()("youCanOnlyUploadX",{smart_count:o})}`);if(n){const c=[...e,...i].reduce((f,r)=>f+(r.size??0),0);if(c>n)throw new bd(this.getI18n()("aggregateExceedsSize",{sizeAllowed:o_(n),size:o_(c)}))}}validateSingleFile(e){const{maxFileSize:i,minFileSize:n,allowedFileTypes:o}=this.getOpts().restrictions;if(o&&!o.some(f=>f.includes("/")?e.type?ZOe(e.type.replace(/;.*?$/,""),f):!1:f[0]==="."&&e.extension?e.extension.toLowerCase()===f.slice(1).toLowerCase():!1)){const f=o.join(", ");throw new bd(this.getI18n()("youCanOnlyUploadFileTypes",{types:f}),{file:e})}if(i&&e.size!=null&&e.size>i)throw new bd(this.getI18n()("exceedsSize",{size:o_(i),file:e.name??this.getI18n()("unnamed")}),{file:e});if(n&&e.size!=null&&e.size<n)throw new bd(this.getI18n()("inferiorSize",{size:o_(n)}),{file:e})}validate(e,i){i.forEach(n=>{this.validateSingleFile(n)}),this.validateAggregateRestrictions(e,i)}validateMinNumberOfFiles(e){const{minNumberOfFiles:i}=this.getOpts().restrictions;if(i&&Object.keys(e).length<i)throw new bd(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:i}))}getMissingRequiredMetaFields(e){const i=new bd(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:e.name??this.getI18n()("unnamed")})),{requiredMetaFields:n}=this.getOpts().restrictions,o=[];for(const c of n)(!Object.hasOwn(e.meta,c)||e.meta[c]==="")&&o.push(c);return{missingFields:o,error:i}}}function QOe(t){let e=null,i;return(...n)=>(i=n,e||(e=Promise.resolve().then(()=>(e=null,t(...i)))),e)}var BC;const mN=class mN extends mle{constructor(){super(...arguments);Wt(this,BC);je(this,"isTargetDOMEl");je(this,"el");je(this,"parent");je(this,"title")}getTargetPlugin(i){let n;if(typeof(i==null?void 0:i.addTarget)=="function")n=i,n instanceof mN||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:n,UIPlugin:mN}}));else if(typeof i=="function"){const o=i;this.uppy.iteratePlugins(c=>{c instanceof o&&(n=c)})}return n}mount(i,n){const o=n.id,c=uOe(i);if(c){this.isTargetDOMEl=!0;const x=document.createElement("div");return x.classList.add("uppy-Root"),Jt(this,BC,QOe(S=>{this.uppy.getPlugin(this.id)&&(HG(this.render(S,x),x),this.afterUpdate())})),this.uppy.log(`Installing ${o} to a DOM element '${i}'`),this.opts.replaceTargetContent&&(c.innerHTML=""),HG(this.render(this.uppy.getState(),x),x),this.el=x,c.appendChild(x),x.dir=this.opts.direction||vOe(x)||"ltr",this.onMount(),this.el}const f=this.getTargetPlugin(i);
3879if(f)return this.uppy.log(`Installing ${o} to ${f.id}`),this.parent=f,this.el=f.addTarget(n),this.onMount(),this.el;this.uppy.log(`Not installing ${o}`);let r=`Invalid target option given to ${o}.`;throw typeof i=="function"?r+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":r+="If you meant to target an HTML element, please make sure that the element exists. Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(r)}render(i,n){throw new Error("Extend the render method to add your plugin to a DOM element")}update(i){var n;this.el!=null&&((n=he(this,BC))==null||n.call(this,i))}unmount(){var i;this.isTargetDOMEl&&((i=this.el)==null||i.remove()),this.onUnmount()}onMount(){}onUnmount(){}};BC=new WeakMap;let aN=mN;const JOe="@uppy/store-default",eFe="The default simple object-based store for Uppy.",tFe="5.0.0",iFe="MIT",nFe="lib/index.js",rFe="module",sFe=!1,oFe={build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},aFe=["file uploader","uppy","uppy-store"],lFe="https://uppy.io",cFe={url:"https://github.com/transloadit/uppy/issues"},uFe={jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},dFe={type:"git",url:"git+https://github.com/transloadit/uppy.git"},hFe={".":"./lib/index.js","./package.json":"./package.json"},pFe=["src","lib","dist","CHANGELOG.md"],fFe={name:JOe,description:eFe,version:tFe,license:iFe,main:nFe,type:rFe,sideEffects:sFe,scripts:oFe,keywords:aFe,homepage:lFe,bugs:cFe,devDependencies:uFe,repository:dFe,exports:hFe,files:pFe};var J0,gN,_le;class yle{constructor(){Wt(this,gN);je(this,"state",{});Wt(this,J0,new Set)}getState(){return this.state}setState(e){const i={...this.state},n={...this.state,...e};this.state=n,ci(this,gN,_le).call(this,i,n,e)}subscribe(e){return he(this,J0).add(e),()=>{he(this,J0).delete(e)}}}J0=new WeakMap,gN=new WeakSet,_le=function(...e){he(this,J0).forEach(i=>{i(...e)})},je(yle,"VERSION",fFe.version);function mFe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var FB=mFe,gFe=typeof LS=="object"&&LS&&LS.Object===Object&&LS,yFe=gFe,_Fe=yFe,vFe=typeof self=="object"&&self&&self.Object===Object&&self,xFe=_Fe||vFe||Function("return this")(),vle=xFe,bFe=vle,wFe=function(){return bFe.Date.now()},SFe=wFe,TFe=/\s/;function CFe(t){for(var e=t.length;e--&&TFe.test(t.charAt(e)););return e}var EFe=CFe,AFe=EFe,IFe=/^\s+/;function kFe(t){return t&&t.slice(0,AFe(t)+1).replace(IFe,"")}var PFe=kFe,NFe=vle,MFe=NFe.Symbol,xle=MFe,e7=xle,ble=Object.prototype,DFe=ble.hasOwnProperty,RFe=ble.toString,DS=e7?e7.toStringTag:void 0;function jFe(t){var e=DFe.call(t,DS),i=t[DS];try{t[DS]=void 0;var n=!0}catch{}var o=RFe.call(t);return n&&(e?t[DS]=i:delete t[DS]),o}var zFe=jFe,LFe=Object.prototype,OFe=LFe.toString;function FFe(t){return OFe.call(t)}var BFe=FFe,t7=xle,UFe=zFe,VFe=BFe,$Fe="[object Null]",qFe="[object Undefined]",i7=t7?t7.toStringTag:void 0;function HFe(t){return t==null?t===void 0?qFe:$Fe:i7&&i7 in Object(t)?UFe(t):VFe(t)}var GFe=HFe;function WFe(t){return t!=null&&typeof t=="object"}var KFe=WFe,ZFe=GFe,XFe=KFe,YFe="[object Symbol]";function QFe(t){return typeof t=="symbol"||XFe(t)&&ZFe(t)==YFe}var JFe=QFe,e3e=PFe,n7=FB,t3e=JFe,r7=NaN,i3e=/^[-+]0x[0-9a-f]+$/i,n3e=/^0b[01]+$/i,r3e=/^0o[0-7]+$/i,s3e=parseInt;function o3e(t){if(typeof t=="number")return t;if(t3e(t))return r7;if(n7(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=n7(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=e3e(t);var i=n3e.test(t);return i||r3e.test(t)?s3e(t.slice(2),i?2:8):i3e.test(t)?r7:+t}var a3e=o3e,l3e=FB,Pz=SFe,s7=a3e,c3e="Expected a function",u3e=Math.max,d3e=Math.min;function h3e(t,e,i){var n,o,c,f,r,x,S=0,C=!1,I=!1,N=!0;if(typeof t!="function")throw new TypeError(c3e);e=s7(e)||0,l3e(i)&&(C=!!i.leading,I="maxWait"in i,c=I?u3e(s7(i.maxWait)||0,e):c,N="trailing"in i?!!i.trailing:N);function D(Te){var we=n,Ne=o;return n=o=void 0,S=Te,f=t.apply(Ne,we),f}function V(Te){return S=Te,r=setTimeout($,e),C?D(Te):f}function B(Te){var we=Te-x,Ne=Te-S,pe=e-we;return I?d3e(pe,c-Ne):pe}function W(Te){var we=Te-x,Ne=Te-S;return x===void 0||we>=e||we<0||I&&Ne>=c}function $(){var Te=Pz();if(W(Te))return G(Te);r=setTimeout($,B(Te))}function G(Te){return r=void 0,N&&n?D(Te):(n=o=void 0,f)}function te(){r!==void 0&&clearTimeout(r),S=0,n=x=o=r=void 0}function ce(){return r===void 0?f:G(Pz())}function _e(){var Te=Pz(),we=W(Te);if(n=arguments,o=this,x=Te,we){if(r===void 0)return V(x);if(I)return clearTimeout(r),r=setTimeout($,e),D(x)}return r===void 0&&(r=setTimeout($,e)),f}return _e.cancel=te,_e.flush=ce,_e}var wle=h3e;const p3e=Xh(wle);var f3e=wle,m3e=FB,g3e="Expected a function";function y3e(t,e,i){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(g3e);return m3e(i)&&(n="leading"in i?!!i.leading:n,o="trailing"in i?!!i.trailing:o),f3e(t,e,{leading:n,maxWait:e,trailing:o})}var _3e=y3e;
3879const v3e=Xh(_3e);var x3e=function(){var e={},i=e._fns={};e.emit=function(f,r,x,S,C,I,N){var D=n(f);D.length&&o(f,D,[r,x,S,C,I,N])},e.on=function(f,r){i[f]||(i[f]=[]),i[f].push(r)},e.once=function(f,r){function x(){r.apply(this,arguments),e.off(f,x)}this.on(f,x)},e.off=function(f,r){var x=[];if(f&&r){var S=this._fns[f],C=0,I=S?S.length:0;for(C;C<I;C++)S[C]!==r&&x.push(S[C])}x.length?this._fns[f]=x:delete this._fns[f]};function n(c){var f=i[c]?i[c]:[],r=c.indexOf(":"),x=r===-1?[c]:[c.substring(0,r),c.substring(r+1)],S=Object.keys(i),C=0,I=S.length;for(C;C<I;C++){var N=S[C];if(N==="*"&&(f=f.concat(i[N])),x.length===2&&x[0]===N){f=f.concat(i[N]);break}}return f}function o(c,f,r){var x=0,S=f.length;for(x;x<S&&f[x];x++)f[x].event=c,f[x].apply(f[x],r)}return e};const b3e=Xh(x3e);let w3e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",S3e=(t=21)=>{let e="",i=t|0;for(;i--;)e+=w3e[Math.random()*64|0];return e};const T3e="@uppy/core",C3e="Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",E3e="5.1.1",A3e="MIT",I3e="dist/style.min.css",k3e="module",P3e=["*.css"],N3e={build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},M3e=["file uploader","uppy","uppy-plugin"],D3e="https://uppy.io",R3e={url:"https://github.com/transloadit/uppy/issues"},j3e={type:"git",url:"git+https://github.com/transloadit/uppy.git"},z3e=["src","lib","dist","CHANGELOG.md"],L3e={".":"./lib/index.js","./css/style.min.css":"./dist/style.min.css","./css/style.css":"./dist/style.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},O3e={"@transloadit/prettier-bytes":"^0.3.4","@uppy/store-default":"^5.0.0","@uppy/utils":"^7.1.1",lodash:"^4.17.21","mime-match":"^1.0.2","namespace-emitter":"^2.0.1",nanoid:"^5.0.9",preact:"^10.5.13"},F3e={"@types/deep-freeze":"^0",cssnano:"^7.0.7","deep-freeze":"^0.0.1",jsdom:"^26.1.0",postcss:"^8.5.6","postcss-cli":"^11.0.1",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},B3e={name:T3e,description:C3e,version:E3e,license:A3e,style:I3e,type:k3e,sideEffects:P3e,scripts:N3e,keywords:M3e,homepage:D3e,bugs:R3e,repository:j3e,files:z3e,exports:L3e,dependencies:O3e,devDependencies:F3e};function U3e(t,e){return e.name?e.name:t.split("/")[0]==="image"?`${t.split("/")[0]}.${t.split("/")[1]}`:"noname"}const V3e={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function $3e(t){if(t==null&&typeof navigator<"u"&&(t=navigator.userAgent),!t)return!0;const e=/Edge\/(\d+\.\d+)/.exec(t);if(!e)return!0;const n=e[1].split(".",2),o=parseInt(n[0],10),c=parseInt(n[1],10);return o<15||o===15&&c<15063||o>18||o===18&&c>=18218}const xI={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null};var fd,md,UC,m_,eb,tb,g_,Zn,Hy,_F,Sle,Tle,Cle,vF,xF,bF,wF,yN,SF,y_,Ele,Ale,Om,VC,JS,Ile,TF,eT;const _N=class _N{constructor(e){Wt(this,Zn);Wt(this,fd,Object.create(null));Wt(this,md);Wt(this,UC);Wt(this,m_,b3e());Wt(this,eb,new Set);Wt(this,tb,new Set);Wt(this,g_,new Set);je(this,"defaultLocale");je(this,"locale");je(this,"opts");je(this,"store");je(this,"i18n");je(this,"i18nArray");je(this,"scheduledAutoProceed",null);je(this,"wasOffline",!1);Wt(this,yN,(e,i)=>{const n=e?this.getFile(e.id):void 0;if(e==null||!n){this.log(`Not setting progress for a file that has been removed: ${e==null?void 0:e.id}`);return}if(n.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${e.id}`);return}const o={bytesTotal:i.bytesTotal,percentage:i.bytesTotal!=null&&Number.isFinite(i.bytesTotal)&&i.bytesTotal>0?Math.round(i.bytesUploaded/i.bytesTotal*100):void 0};n.progress.uploadStarted!=null?this.setFileState(e.id,{progress:{...n.progress,...o,bytesUploaded:i.bytesUploaded}}):this.setFileState(e.id,{progress:{...n.progress,...o}}),he(this,y_).call(this)});Wt(this,y_,v3e(()=>ci(this,Zn,SF).call(this),500,{leading:!0,trailing:!0}));Wt(this,Om,this.updateOnlineStatus.bind(this));Wt(this,VC,new Map);this.defaultLocale=V3e;const i={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:XOe,meta:{},onBeforeFileAdded:(o,c)=>!Object.hasOwn(c,o.id),onBeforeUpload:o=>o,store:new yle,logger:VOe,infoTimeout:5e3},n={...i,...e};this.opts={...n,restrictions:{...i.restrictions,...e==null?void 0:e.restrictions}},e!=null&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e!=null&&e.debug&&(this.opts.logger=$Oe),this.log(`Using Core v${_N.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...xI,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:$3e(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),Jt(this,md,new YOe(()=>this.opts,()=>this.i18n)),Jt(this,UC,this.store.subscribe((o,c,f)=>
3879{this.emit("state-update",o,c,f),this.updateAll(c)})),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),ci(this,Zn,Ale).call(this)}emit(e,...i){he(this,m_).emit(e,...i)}on(e,i){return he(this,m_).on(e,i),this}once(e,i){return he(this,m_).once(e,i),this}off(e,i){return he(this,m_).off(e,i),this}updateAll(e){this.iteratePlugins(i=>{i.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){const i=this.getState().files;this.setState({files:{...i,...Object.fromEntries(Object.entries(e).map(([n,o])=>[n,{...i[n],...o}]))}})}setFileState(e,i){if(!this.getState().files[e])throw new Error(`Canât set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:i})}i18nInit(){const e=n=>this.log(`Missing i18n string: ${n}`,"error"),i=new Qae([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=i.translate.bind(i),this.i18nArray=i.translateArray.bind(i),this.locale=i.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e==null?void 0:e.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(i=>{i.setOptions(e)}),this.setState(void 0)}resetProgress(){const e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},i={...this.getState().files},n=Object.create(null);
3879Object.keys(i).forEach(o=>{n[o]={...i[o],progress:{...i[o].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:n,...xI})}clear(){const{capabilities:e,currentUploads:i}=this.getState();if(Object.keys(i).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...xI,files:{}})}addPreProcessor(e){he(this,eb).add(e)}removePreProcessor(e){return he(this,eb).delete(e)}addPostProcessor(e){he(this,g_).add(e)}removePostProcessor(e){return he(this,g_).delete(e)}addUploader(e){he(this,tb).add(e)}removeUploader(e){return he(this,tb).delete(e)}setMeta(e){const i={...this.getState().meta,...e},n={...this.getState().files};Object.keys(n).forEach(o=>{n[o]={...n[o],meta:{...n[o].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:i,files:n})}setFileMeta(e,i){const n={...this.getState().files};if(!n[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}const o={...n[e].meta,...i};n[e]={...n[e],meta:o},this.setState({files:n})}getFile(e){return this.getState().files[e]}getFiles(){const{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(i=>this.getFile(i))}getObjectOfFilesPerState(){const{files:e,totalProgress:i,error:n}=this.getState(),o=Object.values(e),c=[],f=[],r=[],x=[],S=[],C=[],I=[],N=[],D=[];for(const V of o){const{progress:B}=V;!B.uploadComplete&&B.uploadStarted&&(c.push(V),V.isPaused||N.push(V)),B.uploadStarted||f.push(V),(B.uploadStarted||B.preprocess||B.postprocess)&&r.push(V),B.uploadStarted&&x.push(V),V.isPaused&&S.push(V),B.uploadComplete&&C.push(V),V.error&&I.push(V),(B.preprocess||B.postprocess)&&D.push(V)}return{newFiles:f,startedFiles:r,uploadStartedFiles:x,pausedFiles:S,completeFiles:C,erroredFiles:I,inProgressFiles:c,inProgressNotPausedFiles:N,processingFiles:D,isUploadStarted:x.length>0,isAllComplete:i===100&&C.length===o.length&&D.length===0,isAllErrored:!!n&&I.length===o.length,isAllPaused:c.length!==0&&S.length===c.length,isUploadInProgress:c.length>0,isSomeGhost:o.some(V=>V.isGhost)}}validateRestrictions(e,i=this.getFiles()){try{he(this,md).validate(i,[e])}catch(n){return n}return null}validateSingleFile(e){try{he(this,md).validateSingleFile(e)}catch(i){return i.message}return null}validateAggregateRestrictions(e){const i=this.getFiles();try{he(this,md).validateAggregateRestrictions(i,e)}catch(n){return n.message}return null}checkIfFileAlreadyExists(e){const{files:i}=this.getState();return!!(i[e]&&!i[e].isGhost)}addFile(e){const{nextFilesState:i,validFilesToAdd:n,errors:o}=ci(this,Zn,xF).call(this,[e]),c=o.filter(r=>r.isRestriction);if(ci(this,Zn,Hy).call(this,c),o.length>0)throw o[0];this.setState({files:i});const[f]=n;return this.emit("file-added",f),this.emit("files-added",n),this.log(`Added file: ${f.name}, ${f.id}, mime type: ${f.type}`),ci(this,Zn,vF).call(this),f.id}addFiles(e){const{nextFilesState:i,validFilesToAdd:n,errors:o}=ci(this,Zn,xF).call(this,e),c=o.filter(r=>r.isRestriction);ci(this,Zn,Hy).call(this,c);const f=o.filter(r=>!r.isRestriction);if(f.length>0){let r=`Multiple errors occurred while adding files: 3880`;if(f.forEach(x=>{r+=` 3881 * ${x.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:f.length}),details:r},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(f,r);{const x=new Error(r);throw x.errors=f,x}}this.setState({files:i}),n.forEach(r=>{this.emit("file-added",r)}),this.emit("files-added",n),n.length>5?this.log(`Added batch of ${n.length} files`):Object.values(n).forEach(r=>{this.log(`Added file: ${r.name} 3882 id: ${r.id} 3883 type: ${r.type}`)}),n.length>0&&ci(this,Zn,vF).call(this)}removeFiles(e){const{files:i,currentUploads:n}=this.getState(),o={...i},c={...n},f=Object.create(null);e.forEach(C=>{i[C]&&(f[C]=i[C],delete o[C])});function r(C){return f[C]===void 0}Object.keys(c).forEach(C=>{const I=n[C].fileIDs.filter(r);if(I.length===0){delete c[C];return}const{capabilities:N}=this.getState();if(I.length!==n[C].fileIDs.length&&!N.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");c[C]={...n[C],fileIDs:I}});const x={currentUploads:c,files:o};Object.keys(o).length===0&&(x.allowNewUpload=!0,x.error=null,x.recoveredState=null),this.setState(x),he(this,y_).call(this);const S=Object.keys(f);
3883S.forEach(C=>{this.emit("file-removed",f[C])}),S.length>5?this.log(`Removed ${S.length} files`):this.log(`Removed files: ${S.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;const i=this.getFile(e),o=!(i.isPaused||!1);return this.setFileState(e,{isPaused:o}),this.emit("upload-pause",i,o),o}pauseAll(){const e={...this.getState().files};Object.keys(e).filter(n=>!e[n].progress.uploadComplete&&e[n].progress.uploadStarted).forEach(n=>{const o={...e[n],isPaused:!0};e[n]=o}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){const e={...this.getState().files};Object.keys(e).filter(n=>!e[n].progress.uploadComplete&&e[n].progress.uploadStarted).forEach(n=>{const o={...e[n],isPaused:!1,error:null};e[n]=o}),this.setState({files:e}),this.emit("resume-all")}async retryAll(){const e=await ci(this,Zn,wF).call(this);return this.emit("complete",e),e}cancelAll(){this.emit("cancel-all");const{files:e}=this.getState(),i=Object.keys(e);i.length&&this.removeFiles(i),this.setState(xI)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));const i=ci(this,Zn,JS).call(this,[e],{forceAllowNewUpload:!0});return ci(this,Zn,eT).call(this,i)}logout(){this.iteratePlugins(e=>{var i,n;(n=(i=e.provider)==null?void 0:i.logout)==null||n.call(i)})}[Symbol.for("uppy test: updateTotalProgress")](){return ci(this,Zn,SF).call(this)}updateOnlineStatus(){window.navigator.onLine??!0?(this.emit("is-online"),this.wasOffline&&(this.emit
3883("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e,...i){if(typeof e!="function"){const f=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(f)}const n=new e(this,...i),o=n.id;if(!o)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");const c=this.getPlugin(o);if(c){const f=`Already found a plugin named '${c.id}'. Tried to use: '${o}'. 3884Uppy plugins must have unique \`id\` options.`;throw new Error(f)}return e.VERSION&&this.log(`Using ${o} v${e.VERSION}`),n.type in he(this,fd)?he(this,fd)[n.type].push(n):he(this,fd)[n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(const i of Object.values(he(this,fd))){const n=i.find(o=>o.id===e);if(n!=null)return n}}[Symbol.for("uppy test: getPlugins")](e){return he(this,fd)[e]}iteratePlugins(e){Object.values(he(this,fd)).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();const i=he(this,fd)[e.type],n=i.findIndex(f=>f.id===e.id);n!==-1&&i.splice(n,1);const c={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(c)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),he(this,UC).call(this),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",he(this,Om)),window.removeEventListener("offline",he(this,Om)))}hideInfo(){const{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,i="info",n=3e3){const o=typeof e=="object";this.setState({info:[...this.getState().info,{type:i,message:o?e.message:e,details:o?e.details:null}]}),setTimeout(()=>this.hideInfo(),n),this.emit("info-visible")}log(e,i){const{logger:n}=this.opts;switch(i){case"error":n.error(e);break;case"warning":n.warn(e);break;default:n.debug(e);break}}registerRequestClient(e,i){he(this,VC).set(e,i)}
3884getRequestClientForFile(e){if(!("remote"in e&&e.remote))throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);const i=he(this,VC).get(e.remote.requestClientId);if(i==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return i}async restore(e){this.log(`Core: Running restored upload "${e}"`);const i=await ci(this,Zn,eT).call(this,e);return this.emit("complete",i),i}[Symbol.for("uppy test: createUpload")](...e){return ci(this,Zn,JS).call(this,...e)}addResultData(e,i){if(!ci(this,Zn,Ile).call(this,e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}const{currentUploads:n}=this.getState(),o={...n[e],result:{...n[e].result,...i}};this.setState({currentUploads:{...n,[e]:o}})}async upload(){var o;(o=he(this,fd).uploader)!=null&&o.length||this.log("No uploader type plugins are used","warning");let{files:e}=this.getState();if(ci(this,Zn,bF).call(this).length>0){const c=await ci(this,Zn,wF).call(this);if(!(this.getFiles().filter(r=>r.progress.uploadStarted==null).length>0))return this.emit("complete",c),c;({files:e}=this.getState())}const n=this.opts.onBeforeUpload(e);if(n===!1)throw new Error("Not starting the upload because onBeforeUpload returned false");n&&typeof n=="object"&&(e=n,this.setState({files:e}));try{if(he(this,md).validateMinNumberOfFiles(e),!ci(this,Zn,Sle).call(this,e))throw new bd(this.i18n("missingRequiredMetaField"));const{currentUploads:c}=this.getState(),f=Object.values(c).flatMap(C=>C.fileIDs),r=Object.keys(e).filter(C=>{const I=this.getFile(C);return I&&!I.progress.uploadStarted&&!f.includes(C)}),x=ci(this,Zn,JS).call(this,r),S=await ci(this,Zn,eT).call(this,x);return this.emit("complete",S),S}catch(c){throw ci(this,Zn,Hy).call(this,[c]),c}}};fd=new WeakMap,md=new WeakMap,UC=new WeakMap,m_=new WeakMap,eb=new WeakMap,tb=new WeakMap,g_=new WeakMap,Zn=new WeakSet,Hy=function(e){for(const f of e)f.isRestriction?this.emit("restriction-failed",f.file,f):this.emit("error",f,f.file),this.log(f,"warning");const i=e.filter(f=>f.isUserFacing),n=4,o=i.slice(0,n),c=i.slice(n);o.forEach(({message:f,details:r=""})=>{this.info({message:f,details:r},"error",this.opts.infoTimeout)}),c.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:c.length})})},_F=function(e){const{missingFields:i,error:n}=he(this,md).getMissingRequiredMetaFields(e);return i.length>0?(this.setFileState(e.id,{missingRequiredMetaFields:i,error:n.message}),this.log(n.message),this.emit("restriction-failed",e,n),!1):(i.length===0&&e.missingRequiredMetaFields&&this.setFileState(e.id,{missingRequiredMetaFields:[]}),!0)},Sle=function(e){let i=!0;for(const n of Object.values(e))ci(this,Zn,_F).call(this,n)||(i=!1);return i},Tle=function(e){const{allowNewUpload:i}=this.getState();if(i===!1){const n=new bd(this.i18n("noMoreFilesAllowed"),{file:e});throw ci(this,Zn,Hy).call(this,[n]),n}},Cle=function(e){const i=e instanceof File?{name:e.name,type:e.type,size:e.size,data:e,meta:{},isRemote:!1,source:void 0,preview:void 0}:e,n=Hae(i),o=U3e(n,i),c=qae(o).extension,f=fOe(i,this.getID()),r={...i.meta,name:o,type:n},x=Number.isFinite(i.data.size)?i.data.size:null;return{source:i.source||"",id:f,name:o,extension:c||"",meta:{...this.getState().meta,...r},type:n,progress:{percentage:0,bytesUploaded:!1,bytesTotal:x,uploadComplete:!1,uploadStarted:null},size:x,isGhost:!1,...i.isRemote?{isRemote:!0,remote:i.remote,data:i.data}:{isRemote:!1,data:i.data},preview:i.preview}},vF=function(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(e=>{e.isRestriction||this.log(e.stack||e.message||e)})},4))},xF=function(e){let{files:i}=this.getState(),n={...i};const o=[],c=[];for(const f of e)try{let r=ci(this,Zn,Cle).call(this,f);ci(this,Zn,Tle).call(this,r);const x=i[r.id],S=x==null?void 0:x.isGhost;if(S&&!r.isRemote){if(r.data==null)throw new Error("File data is missing");r={...x,isGhost:!1,data:r.data},this.log(`Replaced the blob in the restored ghost file: ${r.name}, ${r.id}`)}const C=this.opts.onBeforeFileAdded(r,n);if(i=this.getState().files,n={...i,...n},!C&&this.checkIfFileAlreadyExists(r.id))throw new bd(this.i18n("noDuplicates",{fileName:r.name??this.i18n("unnamed")}),{file:r});if(C===!1&&!S)throw new bd("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:r});typeof C=="object"&&C!==null&&(r=C),he(this,md).validateSingleFile(r),n[r.id]=r,o.push(r)}catch(r){c.push(r)}try{he(this,md).validateAggregateRestrictions(Object.values(i),o)}catch(f){return c.push(f),{nextFilesState:i,validFilesToAdd:[],errors:c}}return{nextFilesState:n,validFilesToAdd:o,errors:c}},bF=function(){const{files:e}=this.getState();return Object.keys(e).filter(i=>{const n=e[i];return n.error&&(!n.missingRequiredMetaFields||n.missingRequiredMetaFields.length===0)})},wF=async function(){const e=ci(this,Zn,bF).call(this),i={...this.get
3884State().files};if(e.forEach(o=>{i[o]={...i[o],isPaused:!1,error:null}}),this.setState({files:i,error:null}),this.emit("retry-all",this.getFilesByIds(e)),e.length===0)return{successful:[],failed:[]};const n=ci(this,Zn,JS).call(this,e,{forceAllowNewUpload:!0});return ci(this,Zn,eT).call(this,n)},yN=new WeakMap,SF=function(){const e=ci(this,Zn,Ele).call(this);let i=null;e!=null&&(i=Math.round(e*100),i>100?i=100:i<0&&(i=0)),this.emit("progress",i??0),this.setState({totalProgress:i??0})},y_=new WeakMap,Ele=function(){const i=this.getFiles().filter(x=>x.progress.uploadStarted||x.progress.preprocess||x.progress.postprocess);if(i.length===0)return 0;if(i.every(x=>x.progress.uploadComplete))return 1;const n=x=>x.progress.bytesTotal!=null&&x.progress.bytesTotal!==0,o=i.filter(n),c=i.filter(x=>!n(x));if(o.every(x=>x.progress.uploadComplete)&&c.length>0&&!c.every(x=>x.progress.uploadComplete))return null;const f=o.reduce((x,S)=>x+(S.progress.bytesTotal??0),0),r=o.reduce((x,S)=>x+(S.progress.bytesUploaded||0),0);return f===0?0:r/f},Ale=function(){const e=(o,c,f)=>{let r=o.message||"Unknown error";o.details&&(r+=` ${o.details}`),this.setState({error:r}),c!=null&&c.id in this.getState().files&&this.setFileState(c.id,{error:r,response:f})};this.on("error",e),this.on("upload-error",(o,c,f)=>{if(e(c,o,f),typeof c=="object"&&c.message){this.log(c.message,"error");const r=new Error(this.i18n("failedToUpload",{file:(o==null?void 0:o.name)??""}));r.isUserFacing=!0,r.details=c.message,c.details&&(r.details+=` ${c.details}`),ci(this,Zn,Hy).call(this,[r])}else ci(this,Zn,Hy).call(this,[c])});let i=null;this.on("upload-stalled",(o,c)=>{const{message:f}=o,r=c.map(x=>x.meta.name).join(", ");i||(this.info({message:f,details:r},"warning",this.opts.infoTimeout),i=setTimeout(()=>{i=null},this.opts.infoTimeout)),this.log(`${f} ${r}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});const n=o=>{const c=o.filter(r=>{const x=r!=null&&this.getFile(r.id);return x||this.log(`Not setting progress for a file that has been removed: ${r==null?void 0:r.id}`),x}),f=Object.fromEntries(c.map(r=>[r.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:r.size}}]));this.patchFilesState(f)};this.on("upload-start",n),this.on("upload-progress",he(this,yN)),this.on("upload-success",(o,c)=>{if(o==null||!this.getFile(o.id)){this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`);return}const f=this.getFile(o.id).progress,r=he(this,g_).size>0;this.setFileState(o.id,{progress:{...f,postprocess:r?{mode:"indeterminate"}:void 0,uploadComplete:!0,...!r&&{complete:!0},percentage:100,bytesUploaded:f.bytesTotal},response:c,uploadURL:c.uploadURL,isPaused:!1}),o.size==null&&this.setFileState(o.id,{size:c.bytesUploaded||f.bytesTotal}),he(this,y_).call(this)}),this.on("preprocess-progress",(o,c)=>{if(o==null||!this.getFile(o.id)){this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`);return}this.setFileState(o.id,{progress:{...this.getFile(o.id).progress,preprocess:c}})}),this.on("preprocess-complete",o=>{if(o==null||!this.getFile(o.id)){this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`);return}const c={...this.getState().files};c[o.id]={...c[o.id],progress:{...c[o.id].progress}},delete c[o.id].progress.preprocess,this.setState({files:c})}),this.on("postprocess-progress",(o,c)=>{if(o==null||!this.getFile(o.id)){this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`);return}this.setFileState(o.id,{progress:{...this.getState().files[o.id].progress,postprocess:c}})}),this.on("postprocess-complete",o=>{const c=o&&this.getFile(o.id);if(c==null){this.log(`Not setting progress for a file that has been removed: ${o==null?void 0:o.id}`);return}const{postprocess:f,...r}=c.progress;this.patchFilesState({[c.id]:{progress:{...r,complete:!0}}})}),this.on("restored",()=>{he(this,y_).call(this)}),this.on("dashboard:file-edit-complete",o=>{o&&ci(this,Zn,_F).call(this,o)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",he(this,Om)),window.addEventListener("offline",he(this,Om)),setTimeout(he(this,Om),3e3))},Om=new WeakMap,VC=new WeakMap,JS=function(e,i={}){const{forceAllowNewUpload:n=!1}=i,{allowNewUpload:o,currentUploads:c}=this.getState();if(!o&&!n)throw new Error("Cannot create a new upload: already uploading.");const f=S3e();
3884return this.emit("upload",f,this.getFilesByIds(e)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...c,[f]:{fileIDs:e,step:0,result:{}}}}),f},Ile=function(e){const{currentUploads:i}=this.getState();return i[e]},TF=function(e){const{[e]:i,...n}=this.getState().currentUploads;this.setState({currentUploads:n})},eT=async function(e){const i=()=>{const{currentUploads:f}=this.getState();return f[e]};let n=i();if(!n)throw new Error("Nonexistent upload");const o=[...he(this,eb),...he(this,tb),...he(this,g_)];try{for(let f=n.step||0;f<o.length&&n;f++){const r=o[f];this.setState({currentUploads:{...this.getState().currentUploads,[e]:{...n,step:f}}});const x=n.fileIDs.filter(S=>!this.getFile(S).progress.uploadComplete);await r(x,e),n=i()}}catch(f){throw ci(this,Zn,TF).call(this,e),f}if(n){n.fileIDs.forEach(S=>{const C=this.getFile(S);C!=null&&C.progress.postprocess&&this.emit("postprocess-complete",C)});const f=n.fileIDs.map(S=>this.getFile(S)),r=f.filter(S=>!S.error),x=f.filter(S=>S.error);this.addResultData(e,{successful:r,failed:x,uploadID:e}),n=i()}let c;return n&&(c=n.result,ci(this,Zn,TF).call(this,e)),c==null&&(this.log(`Not setting result for an upload that has been removed: ${e}`),c={successful:[],failed:[],uploadID:e}),c},je(_N,"VERSION",B3e.version);let yF=_N;var kle={exports:{}};/*! 3885 Copyright (c) 2018 Jed Watson. 3886 Licensed under the MIT License (MIT), see 3887 http://jedwatson.github.io/classnames 3888*/(function(t){(function(){var e={}.hasOwnProperty;function i(){for(var c="",f=0;f<arguments.length;f++){var r=arguments[f];r&&(c=o(c,n(r)))}return c}function n(c){if(typeof c=="string"||typeof c=="number")return c;if(typeof c!="object")return"";if(Array.isArray(c))return i.apply(null,c);if(c.toString!==Object.prototype.toString&&!c.toString.toString().includes("[native code]"))return c.toString();var f="";for(var r in c)e.call(c,r)&&c[r]&&(f=o(f,r));return f}function o(c,f){return f?c?c+" "+f:c+f:c}t.exports?(i.default=i,t.exports=i):window.classNames=i})()})(kle);var q3e=kle.exports;const Ud=Xh(q3e);function H3e(){return qe("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30",children:qe("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"})})}
vendor: 4,225 bytes, line 3888
3888function Ls(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var Ple=typeof self<"u"?self:global;const MC=typeof navigator<"u",G3e=MC&&typeof HTMLImageElement>"u",o7=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),Nle=Ple.Buffer,Mle=!!Nle,W3e=t=>t!==void 0;function Dle(t){return t===void 0||(t instanceof Map?t.size===0:Object.values(t).filter(W3e).length===0)}function Ga(t){let e=new Error(t);throw delete e.stack,e}function a7(t){let e=function(i){let n=0;return i.ifd0.enabled&&(n+=1024),i.exif.enabled&&(n+=2048),i.makerNote&&(n+=2048),i.userComment&&(n+=1024),i.gps.enabled&&(n+=512),i.interop.enabled&&(n+=100),i.ifd1.enabled&&(n+=1024),n+2048}(t);return t.jfif.enabled&&(e+=50),t.xmp.enabled&&(e+=2e4),t.iptc.enabled&&(e+=14e3),t.icc.enabled&&(e+=6e3),e}const Nz=t=>String.fromCharCode.apply(null,t),l7=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0;class kd{static from(e,i){return e instanceof this&&e.le===i?e:new kd(e,void 0,void 0,i)}constructor(e,i=0,n,o){if(typeof o=="boolean"&&(this.le=o),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){n===void 0&&(n=e.byteLength-i);let c=new DataView(e,i,n);this._swapDataView(c)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof kd){n===void 0&&(n=e.byteLength-i),(i+=e.byteOffset)+n>e.byteOffset+e.byteLength&&Ga("Creating view outside of available memory in ArrayBuffer");let c=new DataView(e.buffer,i,n);this._swapDataView(c)}else if(typeof e=="number"){let c=new DataView(new ArrayBuffer(e));this._swapDataView(c)}else Ga("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,i,n=kd){return e instanceof DataView||e instanceof kd?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Ga("BufferView.set(): Invalid data argument."),this.toUint8().set(e,i),new n(this,i,e.byteLength)}subarray(e,i){return i=i||this._lengthToEnd(e),new kd(this,e,i)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,i){return new Uint8Array(this.buffer,this.byteOffset+e,i)}getString(e=0,i=this.byteLength){return o=this.getUint8Array(e,i),l7?l7.decode(o):Mle?Buffer.from(o).toString("utf8"):decodeURIComponent(escape(Nz(o)));var o}getLatin1String(e=0,i=this.byteLength){let n=this.getUint8Array(e,i);return Nz(n)}getUnicodeString(e=0,i=this.byteLength){const n=[];for(let o=0;o<i&&e+o<this.byteLength;o+=2)n.push(this.getUint16(e+o));return Nz(n)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,i=this.le){return this.dataView.getInt16(e,i)}getInt32(e,i=this.le){return this.dataView.getInt32(e,i)}getUint16(e,i=this.le){return this.dataView.getUint16(e,i)}getUint32(e,i=this.le){return this.dataView.getUint32(e,i)}getFloat32(e,i=this.le){return this.dataView.getFloat32(e,i)}getFloat64(e,i=this.le){return this.dataView.getFloat64(e,i)}getFloat(e,i=this.le){return this.dataView.getFloat32(e,i)}getDouble(e,i=this.le){return this.dataView.getFloat64(e,i)}getUintBytes(e,i,n){switch(i){case 1:return this.getUint8(e,n);case 2:return this.getUint16(e,n);case 4:return this.getUint32(e,n);case 8:return this.getUint64&&this.getUint64(e,n)}}getUint(e,i,n){switch(i){case 8:return this.getUint8(e,n);case 16:return this.getUint16(e,n);case 32:return this.getUint32(e,n);case 64:return this.getUint64&&this.getUint64(e,n)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}}function CF(t,e){Ga(`${t} '${e}' was not loaded, try using full build of exifr.`)}class BB extends Map{constructor(e){super(),this.kind=e}get(e,i){return this.has(e)||CF(this.kind,e),i&&(e in i||function(n,o){Ga(`Unknown ${n} '${o}'.`)}(this.kind,e),i[e].enabled||CF(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}}
vendor: 1,363 bytes, line 3888
3888var Rle=new BB("file parser"),wd=new BB("segment parser"),UB=new BB("file reader");let K3e=Ple.fetch;function c7(t,e){return(i=t).startsWith("data:")||i.length>1e4?AF(t,e,"base64"):o7&&t.includes("://")?EF(t,e,"url",u7):o7?AF(t,e,"fs"):MC?EF(t,e,"url",u7):void Ga("Invalid input argument");var i}async function EF(t,e,i,n){return UB.has(i)?AF(t,e,i):n?async function(o,c){let f=await c(o);return new kd(f)}(t,n):void Ga(`Parser ${i} is not loaded`)}async function AF(t,e,i){let n=new(UB.get(i))(t,e);return await n.read(),n}const u7=t=>K3e(t).then(e=>e.arrayBuffer()),IF=t=>new Promise((e,i)=>{let n=new FileReader;n.onloadend=()=>e(n.result||new ArrayBuffer),n.onerror=i,n.readAsArrayBuffer(t)}),VB=new Map,Z3e=new Map,X3e=new Map,bI=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],jle=["jfif","xmp","icc","iptc","ihdr"],kF=["tiff",...jle],Ra=["ifd0","ifd1","exif","gps","interop"],wI=[...kF,...Ra],SI=["makerNote","userComment"],zle=["translateKeys","translateValues","reviveValues","multiSegment"],TI=[...zle,"sanitize","mergeOutput","silentErrors"];class Lle{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}}class RS extends Lle{get needed(){return this.enabled||this.deps.size>0}constructor(e,i,n,o){if(super(),Ls(this,"enabled",!1),Ls(this,"skip",new Set),Ls(this,"pick",
vendor: 10,699 bytes, line 3888
3888new Set),Ls(this,"deps",new Set),Ls(this,"translateKeys",!1),Ls(this,"translateValues",!1),Ls(this,"reviveValues",!1),this.key=e,this.enabled=i,this.parse=this.enabled,this.applyInheritables(o),this.canBeFiltered=Ra.includes(e),this.canBeFiltered&&(this.dict=VB.get(e)),n!==void 0)if(Array.isArray(n))this.parse=this.enabled=!0,this.canBeFiltered&&n.length>0&&this.translateTagSet(n,this.pick);else if(typeof n=="object"){if(this.enabled=!0,this.parse=n.parse!==!1,this.canBeFiltered){let{pick:c,skip:f}=n;c&&c.length>0&&this.translateTagSet(c,this.pick),f&&f.length>0&&this.translateTagSet(f,this.skip)}this.applyInheritables(n)}else n===!0||n===!1?this.parse=this.enabled=n:Ga(`Invalid options argument: ${n}`)}applyInheritables(e){let i,n;for(i of zle)n=e[i],n!==void 0&&(this[i]=n)}translateTagSet(e,i){if(this.dict){let n,o,{tagKeys:c,tagValues:f}=this.dict;for(n of e)typeof n=="string"?(o=f.indexOf(n),o===-1&&(o=c.indexOf(Number(n))),o!==-1&&i.add(Number(c[o]))):i.add(n)}else for(let n of e)i.add(n)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,lN(this.pick,this.deps)):this.enabled&&this.pick.size>0&&lN(this.pick,this.deps)}}var Zl={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},d7=new Map;class $B extends Lle{static useCached(e){let i=d7.get(e);return i!==void 0||(i=new this(e),d7.set(e,i)),i}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Ga(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=MC?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of bI)this[e]=Zl[e];for(e of TI)this[e]=Zl[e];for(e of SI)this[e]=Zl[e];for(e of wI)this[e]=new RS(e,Zl[e],void 0,this)}setupFromTrue(){let e;for(e of bI)this[e]=Zl[e];for(e of TI)this[e]=Zl[e];for(e of SI)this[e]=!0;for(e of wI)this[e]=new RS(e,!0,void 0,this)}setupFromArray(e){let i;for(i of bI)this[i]=Zl[i];for(i of TI)this[i]=Zl[i];for(i of SI)this[i]=Zl[i];for(i of wI)this[i]=new RS(i,!1,void 0,this);this.setupGlobalFilters(e,void 0,Ra)}setupFromObject(e){let i;for(i of(Ra.ifd0=Ra.ifd0||Ra.image,Ra.ifd1=Ra.ifd1||Ra.thumbnail,Object.assign(this,e),bI))this[i]=Mz(e[i],Zl[i]);for(i of TI)this[i]=Mz(e[i],Zl[i]);for(i of SI)this[i]=Mz(e[i],Zl[i]);for(i of kF)this[i]=new RS(i,Zl[i],e[i],this);for(i of Ra)this[i]=new RS(i,Zl[i],e[i],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Ra,wI),e.tiff===!0?this.batchEnableWithBool(Ra,!0):e.tiff===!1?this.batchEnableWithUserValue(Ra,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Ra):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Ra)}batchEnableWithBool(e,i){for(let n of e)this[n].enabled=i}batchEnableWithUserValue(e,i){for(let n of e){let o=i[n];this[n].enabled=o!==!1&&o!==void 0}}setupGlobalFilters(e,i,n,o=n){if(e&&e.length){for(let f of o)this[f].enabled=!1;let c=h7(e,n);for(let[f,r]of c)lN(this[f].pick,r),this[f].enabled=!0}else if(i&&i.length){let c=h7(i,n);for(let[f,r]of c)lN(this[f].skip,r)}}filterNestedSegmentTags(){let{ifd0:e,exif:i,xmp:n,iptc:o,icc:c}=this;this.makerNote?i.deps.add(37500):i.skip.add(37500),this.userComment?i.deps.add(37510):i.skip.add(37510),n.enabled||e.skip.add(700),o.enabled||e.skip.add(33723),c.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:i,gps:n,interop:o}=this;o.needed&&(i.deps.add(40965),e.deps.add(40965)),i.needed&&e.deps.add(34665),n.needed&&e.deps.add(34853),this.tiff.enabled=Ra.some(c=>this[c].enabled===!0)||this.makerNote||this.userComment;for(let c of Ra)this[c].finalizeFilters()}get onlyTiff(){return!jle.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of kF)this[e].enabled&&!wd.has(e)&&CF("segment parser",e)}}function h7(t,e){let i,n,o,c,f=[];for(o of e){for(c of(i=VB.get(o),n=[],i))(t.includes(c[0])||t.includes(c[1]))&&n.push(c[0]);n.length&&f.push([o,n])}return f}function Mz(t,e){return t!==void 0?t:e!==void 0?e:void 0}function lN(t,e){for(let i of e)t.add(i)}Ls($B,"default",Zl);class Y3e{constructor(e){Ls(this,"parsers",{}),Ls(this,"output",{}),Ls(this,"errors",[]),Ls(this,"pushToErrors",i=>this.errors.push(i)),this.options=$B.useCached(e)}async read(e){this.file=await function(i,n){return typeof i=="string"?c7(i,n):MC&&!G3e&&i instanceof HTMLImageElement?c7(i.src,n):i instanceof Uint8Array||i instanceof ArrayBuffer||i instanceof DataView?new kd(i):MC&&i instanceof Blob?EF(i,n,"blob",IF):void Ga("Invalid input argument")}(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,i=e.getUint16(0);for(let[n,o]of Rle)if(o.canHandle(e,i))return this.fileParser=new o(this.options,this.file,this.parsers),e[n]=!0;this.file.close&&this.file.close(),Ga("Unknown file format")}async parse(){let{output:e,errors:i}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),i.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&i.length>0&&(e.errors=i),Dle(n=e)?void 0:n;var n}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let i=Object.values(this.parsers).map(async n=>{let o=await n.parse();n.assignToOutput(e,o)});this.options.silentErrors&&(i=i.map(n=>n.catch(this.pushToErrors))),await Promise.all(i)}async extractThumbnail(){this.setup();let{options:e,file:i}=this,n=wd.get("tiff",e);var o;if(i.tiff?o={start:0,type:"tiff"}:i.jpeg&&(o=await this.fileParser.getOrFindSegment("tiff")),o===void 0)return;let c=await this.fileParser.ensureSegmentChunk(o),f=this.parsers.tiff=new n(c,e,i),r=await f.extractThumbnail();return i.close&&i.close(),r}}class g0{static findPosition(e,i){let n=e.getUint16(i+2)+2,o=typeof this.headerLength=="function"?this.headerLength(e,i,n):this.headerLength,c=i+o,f=n-o;return{offset:i,length:n,headerLength:o,start:c,size:f,end:c+f}}static parse(e,i={}){return new this(e,new $B({[this.type]:i}),e).parse()}normalizeInput(e){return e instanceof kd?e:new kd(e)}constructor(e,i={},n){Ls(this,"errors",[]),Ls(this,"raw",new Map),Ls(this,"handleError",o=>{if(!this.options.silentErrors)throw o;this.errors.push(o.message)}),this.chunk=this.normalizeInput(e),this.file=n,this.type=this.constructor.type,this.globalOptions=this.options=i,this.localOptions=i[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,i){let n=X3e.get(i),o=Z3e.get(i),c=VB.get(i),f=this.options[i],r=f.reviveValues&&!!n,x=f.translateValues&&!!o,S=f.translateKeys&&!!c,C={};for(let[I,N]of e)r&&n.has(I)?N=n.get(I)(N):x&&o.has(I)&&(N=this.translateValue(N,o.get(I))),S&&c.has(I)&&(I=c.get(I)||I),C[I]=N;return C}translateValue(e,i){return i[e]||i.DEFAULT||e}assignToOutput(e,i){this.assignObjectToOutput(e,this.constructor.type,i)}assignObjectToOutput(e,i,n){if(this.globalOptions.mergeOutput)return Object.assign(e,n);e[i]?Object.assign(e[i],n):e[i]=n}}Ls(g0,"headerLength",4),Ls(g0,"type",void 0),Ls(g0,"multiSegment",!1),Ls(g0,"canHandle",()=>!1);function Q3e(t){return t===192||t===194||t===196||t===219||t===221||t===218||t===254}function J3e(t){return t>=224&&t<=239}function e4e(t,e,i){for(let[n,o]of wd)if(o.canHandle(t,e,i))return n}class p7 extends class{constructor(e,i,n){Ls(this,"errors",[]),Ls(this,"ensureSegmentChunk",async o=>{let c=o.start,f=o.size||65536;if(this.file.chunked)if(this.file.available(c,f))o.chunk=this.file.subarray(c,f);else try{o.chunk=await this.file.readChunk(c,f)}catch(r){Ga(`Couldn't read segment: ${JSON.stringify(o)}. ${r.message}`)}else this.file.byteLength>c+f?o.chunk=this.file.subarray(c,f):o.size===void 0?o.chunk=this.file.subarray(c):Ga("Segment unreachable: "+JSON.stringify(o));return o.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=i,this.parsers=n}injectSegment(e,i){this.options[e].enabled&&this.createParser(e,i)}createParser(e,i){let n=new(wd.get(e))(i,this.options,this.file);return this.parsers[e]=n}createParsers(e){for(let i of e){let{type:n,chunk:o}=i,c=this.options[n];if(c&&c.enabled){let f=this.parsers[n];f&&f.append||f||this.createParser(n,o)}}}async readSegments(e){let i=e.map(this.ensureSegmentChunk);await Promise.all(i)}}{constructor(...e){super(...e),Ls(this,"appSegments",[]),Ls(this,"jpegSegments",[]),Ls(this,"unknownSegments",[])}static canHandle(e,i){return i===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(wd.keyList())):(e=e===void 0?wd.keyList().filter(i=>this.options[i].enabled):e.filter(i=>this.options[i].enabled&&wd.has(i)),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,i){this.setupSegmentFinderArgs(i);let{file:n,findAll:o,wanted:c,remaining:f}=this;if(!o&&this.file.chunked&&(o=Array.from(c).some(r=>{let x=wd.get(r),S=this.options[r];return x.multiSegment&&S.multiSegment}),o&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,n.byteLength),!this.options.onlyTiff&&n.chunked){let r=!1;for(;f.size>0&&!r&&(n.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:x}=n,S=this.appSegments.some(C=>!this.file.available(C.offset||C.start,C.length||C.size));if(r=e>x&&!S?!await n.readNextChunk(e):!await n.readNextChunk(x),(e=this.findAppSegmentsInRange(e,n.byteLength))===void 0)return}}}findAppSegmentsInRange(e,i){i-=2;let n,o,c,f,r,x,{file:S,findAll:C,wanted:I,remaining:N,options:D}=this;for(;e<i;e++)if(S.getUint8(e)===255){if(n=S.getUint8(e+1),J3e(n)){if(o=S.getUint16(e+2),c=e4e(S,e,o),c&&I.has(c)&&(f=wd.get(c),r=f.findPosition(S,e),x=D[c],r.type=c,this.appSegments.push(r),!C&&(f.multiSegment&&x.multiSegment?(this.unfinishedMultiSegment=r.chunkNumber<r.chunkCount,this.unfinishedMultiSegment||N.delete(c)):N.delete(c),N.size===0)))break;D.recordUnknownSegments&&(r=g0.findPosition(S,e),r.marker=n,this.unknownSegments.push(r)),e+=o+1}
vendor: 6,205 bytes, lines 3888-3889
3888else if(Q3e(n)){if(o=S.getUint16(e+2),n===218&&D.stopAfterSos!==!1)return;D.recordJpegSegments&&this.jpegSegments.push({offset:e,length:o,marker:n}),e+=o+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(i=>i.multiSegment))return;let e=function(i,n){let o,c,f,r=new Map;for(let x=0;x<i.length;x++)o=i[x],c=o[n],r.has(c)?f=r.get(c):r.set(c,f=[]),f.push(o);return Array.from(r)}(this.appSegments,"type");this.mergedAppSegments=e.map(([i,n])=>{let o=wd.get(i,this.options);return o.handleMultiSegments?{type:i,chunk:o.handleMultiSegments(n)}:n[0]})}getSegment(e){return this.appSegments.find(i=>i.type===e)}async getOrFindSegment(e){let i=this.getSegment(e);return i===void 0&&(await this.findAppSegments(0,[e]),i=this.getSegment(e)),i}}Ls(p7,"type","jpeg"),Rle.set("jpeg",p7);const t4e=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4];class i4e extends g0{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,i,n=new Map){let{pick:o,skip:c}=this.options[i];o=new Set(o);let f=o.size>0,r=c.size===0,x=this.chunk.getUint16(e);e+=2;for(let S=0;S<x;S++){let C=this.chunk.getUint16(e);if(f){if(o.has(C)&&(n.set(C,this.parseTag(e,C,i)),o.delete(C),o.size===0))break}else!r&&c.has(C)||n.set(C,this.parseTag(e,C,i));e+=12}return n}parseTag(e,i,n){let{chunk:o}=this,c=o.getUint16(e+2),f=o.getUint32(e+4),r=t4e[c];if(r*f<=4?e+=8:e=o.getUint32(e+8),(c<1||c>13)&&Ga(`Invalid TIFF value type. block: ${n.toUpperCase()}, tag: ${i.toString(16)}, type: ${c}, offset ${e}`),e>o.byteLength&&Ga(`Invalid TIFF value offset. block: ${n.toUpperCase()}, tag: ${i.toString(16)}, type: ${c}, offset ${e} is outside of chunk size ${o.byteLength}`),c===1)return o.getUint8Array(e,f);if(c===2)return(x=function(S){for(;S.endsWith("\0");)S=S.slice(0,-1);return S}(x=o.getString(e,f)).trim())===""?void 0:x;var x;if(c===7)return o.getUint8Array(e,f);if(f===1)return this.parseTagValue(c,e);{let S=new(function(I){switch(I){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(c))(f),C=r;for(let I=0;I<f;I++)S[I]=this.parseTagValue(c,e),e+=C;return S}}parseTagValue(e,i){let{chunk:n}=this;switch(e){case 1:return n.getUint8(i);case 3:return n.getUint16(i);case 4:return n.getUint32(i);case 5:return n.getUint32(i)/n.getUint32(i+4);case 6:return n.getInt8(i);case 8:return n.getInt16(i);case 9:return n.getInt32(i);case 10:return n.getInt32(i)/n.getInt32(i+4);case 11:return n.getFloat(i);case 12:return n.getDouble(i);case 13:return n.getUint32(i);default:Ga(`Invalid tiff type ${e}`)}}}class Dz extends i4e{static canHandle(e,i){return e.getUint8(i+1)===225&&e.getUint32(i+4)===1165519206&&e.getUint16(i+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let i=this[e]();return i.catch!==void 0&&(i=i.catch(this.handleError)),i}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),i=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(i)}}parseBlock(e,i){let n=new Map;return this[i]=n,this.parseTags(e,i,n),n}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Ga("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ga(`IFD0 offset points to outside of file. 3889this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,a7(this.options));let i=this.parseBlock(this.ifd0Offset,"ifd0");return i.size!==0?(this.exifOffset=i.get(34665),this.interopOffset=i.get(40965),this.gpsOffset=i.get(34853),this.xmp=i.get(700),this.iptc=i.get(33723),this.icc=i.get(34675),this.options.sanitize&&(i.delete(34665),i.delete(40965),i.delete(34853),i.delete(700),i.delete(33723),i.delete(34675)),i):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,a7(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,i){let n=e.get(i);n&&n.length===1&&e.set(i,n[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",f7(...e.get(2),e.get(1))),e.set("longitude",f7(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),i=this.ifd1.get(514);return this.chunk.getUint8Array(e,i)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,i,n,o={};for(i of Ra)if(e=this[i],!Dle(e))if(n=this.canTranslate?this.translateBlock(e,i):Object.fromEntries(e),this.options.mergeOutput){if(i==="ifd1")continue;Object.assign(o,n)}else o[i]=n;return this.makerNote&&(o.makerNote=this.makerNote),this.userComment&&(o.userComment=this.userComment),o}
vendor: 4,392 bytes, line 3889
3889assignToOutput(e,i){if(this.globalOptions.mergeOutput)Object.assign(e,i);else for(let[n,o]of Object.entries(i))this.assignObjectToOutput(e,n,o)}}function f7(t,e,i,n){var o=t+e/60+i/3600;return n!=="S"&&n!=="W"||(o*=-1),o}Ls(Dz,"type","tiff"),Ls(Dz,"headerLength",10),wd.set("tiff",Dz);const qB={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1};Object.assign({},qB,{firstChunkSize:4e4,gps:[1,2,3,4]});Object.assign({},qB,{tiff:!1,ifd1:!0,mergeOutput:!1});const n4e=Object.assign({},qB,{firstChunkSize:4e4,ifd0:[274]});async function r4e(t){let e=new Y3e(n4e);await e.read(t);let i=await e.parse();if(i&&i.ifd0)return i.ifd0[274]}const s4e=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}});let tT=!0,iT=!0;if(typeof navigator=="object"){let t=navigator.userAgent;if(t.includes("iPad")||t.includes("iPhone")){let e=t.match(/OS (\d+)_(\d+)/);if(e){let[,i,n]=e;tT=Number(i)+.1*Number(n)<13.4,iT=!1}}else if(t.includes("OS X 10")){let[,e]=t.match(/OS X 10[_.](\d+)/);tT=iT=Number(e)<15}if(t.includes("Chrome/")){let[,e]=t.match(/Chrome\/(\d+)/);tT=iT=Number(e)<81}else if(t.includes("Firefox/")){let[,e]=t.match(/Firefox\/(\d+)/);tT=iT=Number(e)<77}}async function o4e(t){let e=await r4e(t);return Object.assign({canvas:tT,css:iT},s4e[e])}class a4e extends kd{constructor(...e){super(...e),Ls(this,"ranges",new l4e),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,i,n){if(e===0&&this.byteLength===0&&n){let o=new DataView(n.buffer||n,n.byteOffset,n.byteLength);this._swapDataView(o)}else{let o=e+i;if(o>this.byteLength){let{dataView:c}=this._extend(o);this._swapDataView(c)}}}_extend(e){let i;i=Mle?Nle.allocUnsafe(e):new Uint8Array(e);let n=new DataView(i.buffer,i.byteOffset,i.byteLength);return i.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:i,dataView:n}}subarray(e,i,n=!1){return i=i||this._lengthToEnd(e),n&&this._tryExtend(e,i),this.ranges.add(e,i),super.subarray(e,i)}set(e,i,n=!1){n&&this._tryExtend(i,e.byteLength,e);let o=super.set(e,i);return this.ranges.add(i,o.byteLength),o}async ensureChunk(e,i){this.chunked&&(this.ranges.available(e,i)||await this.readChunk(e,i))}available(e,i){return this.ranges.available(e,i)}}class l4e{constructor(){Ls(this,"list",[])}get length(){return this.list.length}add(e,i,n=0){let o=e+i,c=this.list.filter(f=>m7(e,f.offset,o)||m7(e,f.end,o));if(c.length>0){e=Math.min(e,...c.map(r=>r.offset)),o=Math.max(o,...c.map(r=>r.end)),i=o-e;let f=c.shift();f.offset=e,f.length=i,f.end=o,this.list=this.list.filter(r=>!c.includes(r))}else this.list.push({offset:e,length:i,end:o})}available(e,i){let n=e+i;return this.list.some(o=>o.offset<=e&&n<=o.end)}}function m7(t,e,i){return t<=e&&e<=i}class c4e extends a4e{constructor(e,i){super(0),Ls(this,"chunksRead",0),this.input=e,this.options=i}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let i=this.options.chunkSize,n=await this.readChunk(e,i);return!!n&&n.byteLength===i}async readChunk(e,i){if(this.chunksRead++,(i=this.safeWrapAddress(e,i))!==0)return this._readChunk(e,i)}safeWrapAddress(e,i){return this.size!==void 0&&e+i>this.size?Math.max(0,this.size-e):i}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}}UB.set("blob",class extends c4e{async readWhole(){this.chunked=!1;let t=await IF(this.input);this._swapArrayBuffer(t)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}
3889async _readChunk(t,e){let i=e?t+e:void 0,n=this.input.slice(t,i),o=await IF(n);return this.set(o,t,!0)}});const u4e="@uppy/thumbnail-generator",d4e="Uppy plugin that generates small previews of images to show on your upload UI.",h4e="5.0.2",p4e="MIT",f4e="module",m4e=!1,g4e={build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},y4e=["file uploader","uppy","uppy-plugin","thumbnail","preview","resize"],_4e="https://uppy.io",v4e={url:"https://github.com/transloadit/uppy/issues"},x4e={type:"git",url:"git+https://github.com/transloadit/uppy.git"},b4e=["src","lib","dist","CHANGELOG.md"],w4e={".":"./lib/index.js","./package.json":"./package.json"},S4e={"@uppy/utils":"^7.1.1",exifr:"^7.0.0"},T4e={jsdom:"^26.1.0","namespace-emitter":"2.0.1",typescript:"^5.8.3",vitest:"^3.2.4"},C4e={"@uppy/core":"^5.1.1"},E4e={name:u4e,description:d4e,version:h4e,license:p4e,type:f4e,sideEffects:m4e,scripts:g4e,keywords:y4e,homepage:_4e,bugs:v4e,repository:x4e,files:b4e,exports:w4e,dependencies:S4e,devDependencies:T4e,peerDependencies:C4e},A4e={strings:{generatingThumbnails:"Generating thumbnails..."}};function I4e(t,e,i){try{t.getContext("2d").getImageData(0,0,1,1)}catch(n){if(n.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return t.toBlob?new Promise(n=>{t.toBlob(n,e,i)}).then(n=>{if(n===null)throw new Error("cannot read image, probably an svg with external resources");return n}):Promise.resolve().then(()=>rOe(t.toDataURL(e,i),{})).then(n=>{if(n===null)throw new Error("could not extract blob, probably an old browser");return n})}function k4e(t,e){let i=t.width,n=t.height;(e.deg===90||e.deg===270)&&(i=t.height,n=t.width);const o=document.createElement("canvas");o.width=i,o.height=n;const c=o.getContext("2d");return c.translate(i/2,n/2),e.canvas&&(c.rotate(e.rad),c.scale(e.scaleX,e.scaleY)),c.drawImage(t,-t.width/2,-t.height/2,t.width,t.height),o}function P4e(t){const e=t.width/t.height,i=5e6,n=4096;let o=Math.floor(Math.sqrt(i*e)),c=Math.floor(i/Math.sqrt(i*e));if(o>n&&(o=n,c=Math.round(o/e)),c>n&&(c=n,o=Math.round(e*c)),t.width>o){const f=document.createElement("canvas");return f.width=o,f.height=c,f.getContext("2d").drawImage(t,0,0,o,c),f}return t}const N4e={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1};class Ole extends aN{constructor(i,n){super(i,{...N4e,...n});je(this,"queue");je(this,"queueProcessing");je(this,"defaultThumbnailDimension");je(this,"thumbnailType");je(this,"onFileAdded",i=>{!i.preview&&i.data&&OG(i.type)&&!i.isRemote&&this.addToQueue(i.id)});je(this,"onCancelRequest",i=>{const n=this.queue.indexOf(i.id);n!==-1&&this.queue.splice(n,1)});je(this,"onFileRemoved",i=>{const n=this.queue.indexOf(i.id);n!==-1&&this.queue.splice(n,1),i.preview&&LG(i.preview)&&URL.revokeObjectURL(i.preview)});je(this,"onRestored",()=>{this.uppy.getFiles().filter(n=>n.isRestored).forEach(n=>{(!n.preview||LG(n.preview))&&this.addToQueue(n.id)})});je(this,"onAllFilesRemoved",()=>{this.queue=[]});je(this,"waitUntilAllProcessed",i=>{i.forEach(o=>{const c=this.uppy.getFile(o);
vendor: 4,101 bytes, line 3889
3889this.uppy.emit("preprocess-progress",c,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});const n=()=>{i.forEach(o=>{const c=this.uppy.getFile(o);this.uppy.emit("preprocess-complete",c)})};return new Promise(o=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{n(),o()}):(n(),o())})});if(this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=A4e,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(i,n,o){if(i.data==null)throw new Error("File data is empty");const c=URL.createObjectURL(i.data),f=new Promise((x,S)=>{const C=new Image;C.src=c,C.addEventListener("load",()=>{URL.revokeObjectURL(c),x(C)}),C.addEventListener("error",I=>{URL.revokeObjectURL(c),S(I.error||new Error("Could not create thumbnail"))})}),r=o4e(i.data).catch(()=>1);return Promise.all([f,r]).then(([x,S])=>{const C=this.getProportionalDimensions(x,n,o,S.deg),I=k4e(x,S),N=this.resizeImage(I,C.width,C.height);return I4e(N,this.thumbnailType,80)}).then(x=>URL.createObjectURL(x))}getProportionalDimensions(i,n,o,c){let f=i.width/i.height;if((c===90||c===270)&&(f=i.height/i.width),n!=null){let r=n;return i.width<n&&(r=i.width),{width:r,height:Math.round(r/f)}}if(o!=null){let r=o;return i.height<o&&(r=i.height),{width:Math.round(r*f),height:r}}return{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/f)}}resizeImage(i,n,o){let c=P4e(i),f=Math.ceil(Math.log2(c.width/n));f<1&&(f=1);let r=n*2**(f-1),x=o*2**(f-1);const S=2;for(;f--;){const C=document.createElement("canvas");C.width=r,C.height=x,C.getContext("2d").drawImage(c,0,0,r,x),c=C,r=Math.round(r/S),x=Math.round(x/S)}return c}setPreviewURL(i,n){this.uppy.setFileState(i,{preview:n})}addToQueue(i){this.queue.push(i),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){const i=this.uppy.getFile(this.queue.shift());return i?this.requestThumbnail(i).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(i){return OG(i.type)&&!i.isRemote?this.createThumbnail(i,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(n=>{this.setPreviewURL(i.id,n),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${i.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(i.id),n)}).catch(n=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${i.id}:`,"warning"),this.uppy.log(n,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(i.id),n)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}}
3889je(Ole,"VERSION",E4e.version);let M4e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Fle=(t=21)=>{let e="",i=t|0;for(;i--;)e+=M4e[Math.random()*64|0];return e};const D4e="@uppy/dashboard",R4e="Universal UI plugin for Uppy.",j4e="5.0.4",z4e="MIT",L4e="dist/style.min.css",O4e="module",F4e=["*.css"],B4e={build:"tsc --build tsconfig.build.json","build:css":"sass --load-path=../../ src/style.scss dist/style.css && postcss dist/style.css -u cssnano -o dist/style.min.css",typecheck:"tsc --build",test:"vitest run --silent='passed-only'","test:e2e":"vitest run --project browser"},U4e=["file uploader","uppy","uppy-plugin","dashboard","ui"],V4e="https://uppy.io",$4e={url:"https://github.com/transloadit/uppy/issues"},q4e={type:"git",url:"git+https://github.com/transloadit/uppy.git"},H4e=["src","lib","dist","CHANGELOG.md"],G4e={".":"./lib/index.js","./css/style.css":"./dist/style.css","./css/style.min.css":"./dist/style.min.css","./css/style.scss":"./src/style.scss","./package.json":"./package.json"},W4e={"@transloadit/prettier-bytes":"^0.3.4","@uppy/provider-views":"^5.1.2","@uppy/thumbnail-generator":"^5.0.2","@uppy/utils":"^7.1.3",classnames:"^2.2.6",lodash:"^4.17.21",nanoid:"^5.0.9",preact:"^10.5.13","shallow-equal":"^3.0.0"},K4e={"@uppy/core":"^5.1.1","@uppy/google-drive":"^5.0.1","@uppy/url":"^5.0.2","@uppy/webcam":"^5.0.2","@vitest/browser":"^3.2.4",cssnano:"^7.0.7",jsdom:"^26.1.0",playwright:"1.54.1",postcss:"^8.5.6","postcss-cli":"^11.0.1","resize-observer-polyfill":"^1.5.0",sass:"^1.89.2",typescript:"^5.8.3",vitest:"^3.2.4"},Z4e={"@uppy/core":"^5.1.1"},X4e={name:D4e,description:R4e,version:j4e,license:z4e,style:L4e,type:O4e,sideEffects:F4e,scripts:B4e,keywords:U4e,homepage:V4e,bugs:$4e,repository:q4e,files:H4e,exports:G4e,dependencies:W4e,devDependencies:K4e,peerDepen
3889dencies:Z4e};class Ble extends $h{constructor(){super(...arguments);je(this,"fileInput",null);je(this,"folderInput",null);je(this,"mobilePhotoFileInput",null);je(this,"mobileVideoFileInput",null);je(this,"triggerFileInputClick",()=>{var i;(i=this.fileInput)==null||i.click()});je(this,"triggerFolderInputClick",()=>{var i;(i=this.folderInput)==null||i.click()});je(this,"triggerVideoCameraInputClick",()=>{var i;(i=this.mobileVideoFileInput)==null||i.click()});je(this,"triggerPhotoCameraInputClick",()=>{var i;(i=this.mobilePhotoFileInput)==null||i.click()});je(this,"onFileInputChange",i=>{this.props.handleInputChange(i),i.currentTarget.value=""});je(this,"renderHiddenInput",(i,n)=>{var o;return qe("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:i,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:(o=this.props.allowedFileTypes)==null?void 0:o.join(", "),ref:n})});je(this,"renderHiddenCameraInput",(i,n,o)=>{const f={photo:"image/*",video:"video/*"}[i];return qe("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${i}`,onChange:this.onFileInputChange,capture:n===""?"environment":n,accept:f,ref:o})});je(this,"renderMyDeviceAcquirer",()=>qe("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice",children:qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick,children:[qe("div",{className:"uppy-DashboardTab-inner",children:qe("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:qe("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"})})}),qe("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("myDevice")})]})}));je(this,"renderPhotoCamera",()=>qe("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera",children:qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick,children:[qe("div",{className:"uppy-DashboardTab-inner",children:qe("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32",children:qe("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"})})}),qe("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("takePictureBtn")})]})}));je(this,"renderVideoCamera",()=>qe("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera",children:qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick,children:[qe("div",{className:"uppy-DashboardTab-inner",children:qe("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32",children:qe("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "})})}),qe("div",{className:"uppy-DashboardTab-name",children:this.props.i18n("recordVideoBtn")})]})}));je(this,"renderBrowseButton",(i,n)=>{const o=this.props.acquirers.length;return qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:n,"data-uppy-super-focusable":o===0,children:i})});je(this,"renderDropPasteBrowseTagline",i=>{const n=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),o=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),c=this.props.fileManagerSelectionType,f=c.charAt(0).toUpperCase()+c.slice(1);return qe("div",{class:"uppy-Dashboard-AddFiles-title",children:this.props.disableLocalFiles?this.props.i18n("importFiles"):i>0?this.props.i18nArray(`dropPasteImport${f}`,{browseFiles:n,browseFolders:o,browse:n}):this.props.i18nArray(`dropPaste${f}`,{browseFiles:n,browseFolders:o,browse:n})})});je(this,"renderAcquirer",i=>{var n;return qe("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":i.id,children:qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":i.id,"aria-controls":`uppy-DashboardContent-panel--${i.id}`,"aria-selected":((n=this.props.activePickerPanel)==null?void 0:n.id)===i.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(i.id),children:[qe("div",{className:"uppy-DashboardTab-inner",children:i.icon()}),qe("div",{className:"uppy-DashboardTab-name",children:i.name})]})})});je(this,"renderAcquirers",i=>{const n=[...i],o=n.splice(i.length-2,i.length);return qe(Zp,{children:[n.map(c=>this.renderAcquirer(c)),qe("span",{role:"presentation",style:{"white-space":"nowrap"},children:o.map(c=>this.renderAcquirer(c))})]})});je(this,"renderSourcesList",(i,n)=>{const{showNativePhotoCameraButton:o,showNativeVideoCameraButton:c}=this.props;let f=[];const r="myDevice";n||f.push({key:r,elements:this.renderMyDeviceAcquirer()}),o&&f.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),c&&f.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),f.push(...i.map(I=>({key:I.id,elements:this.renderAcquirer(I)}))),f.length===1&&f[0].key===r&&(f=[]);const S=[...f],C=S.splice(f.length-2,f.length);return qe(Zp,{children:[this.renderDropPasteBrowseTagline(f.length),qe("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist",children:[S.map(({key:I,elements:N})=>qe(Zp,{children:N},I)),qe("span",{role:"presentation",style:{"white-space":"nowrap"},children:C.map(({key:I,elements:N})=>qe(Zp,{children:N},I))})]})]})})}[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){const{i18nArray:i}=this.props,n=qe("span",{children:[qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",children:qe("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})}),qe("span",{className:"uppy-Dashboard-poweredByUppy",children:"Uppy"})]}),o=i("poweredBy",{uppy:n});return qe("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy",children:o})}render(){const{showNativePhotoCameraButton:i,showNativeVideoCameraButton:n,nativeCameraFacingMode:o}=this.props;return qe("div",{className:"uppy-Dashboard-AddFiles",children:[this.renderHiddenInput(!1,
vendor: 21,719 bytes, line 3889
3889c=>{this.fileInput=c}),this.renderHiddenInput(!0,c=>{this.folderInput=c}),i&&this.renderHiddenCameraInput("photo",o,c=>{this.mobilePhotoFileInput=c}),n&&this.renderHiddenCameraInput("video",o,c=>{this.mobileVideoFileInput=c}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),qe("div",{className:"uppy-Dashboard-AddFiles-info",children:[this.props.note&&qe("div",{className:"uppy-Dashboard-note",children:this.props.note}),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()]})]})}}const Y4e=t=>qe("div",{className:Ud("uppy-Dashboard-AddFilesPanel",t.className),"data-uppy-panelType":"AddFiles","aria-hidden":!t.showAddFilesPanel,children:[qe("div",{className:"uppy-DashboardContent-bar",children:[qe("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:t.i18n("addingMoreFiles")}),qe("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>t.toggleAddFilesPanel(!1),children:t.i18n("back")})]}),qe(Ble,{...t})]});function Q4e(t){const e=t.files[t.fileCardFor],i=()=>{t.uppy.emit("file-editor:cancel",e),t.closeFileEditor()};return qe("div",{className:Ud("uppy-DashboardContent-panel",t.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor",children:[qe("div",{className:"uppy-DashboardContent-bar",children:[qe("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:t.i18nArray("editing",{file:qe("span",{className:"uppy-DashboardContent-titleFile",children:e.meta?e.meta.name:e.name})})}),qe("button",{className:"uppy-DashboardContent-back",type:"button",onClick:i,children:t.i18n("cancel")}),qe("button",{className:"uppy-DashboardContent-save",type:"button",onClick:t.saveFileEditor,children:t.i18n("save")})]}),qe("div",{className:"uppy-DashboardContent-panelBody",children:t.editors.map(n=>t.uppy.getPlugin(n.id).render(t.state))})]})}function J4e(){return qe("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("g",{fill:"#686DE0",fillRule:"evenodd",children:[qe("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),qe("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),qe("circle",{cx:"7.5",cy:"9.5",r:"1.5"})]})})}function eBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"})})}function tBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"})})}function iBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"})})}function nBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"})})}function rBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("g",{fill:"#A7AFB7",fillRule:"nonzero",children:[qe("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),qe("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})]})})}function sBe(){return qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25",children:qe("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"})})}function HB(t){const e={color:"#838999",icon:rBe()};if(!t)return e;const i=t.split("/")[0],n=t.split("/")[1];return i==="text"?{color:"#5a5e69",icon:sBe()}:i==="image"?{color:"#686de0",icon:J4e()}:i==="audio"?{color:"#068dbb",icon:eBe()}:i==="video"?{color:"#19af67",icon:tBe()}:i==="application"&&n==="pdf"?{color:"#e25149",icon:iBe()}:i==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(n)!==-1?{color:"#00C469",icon:nBe()}:e}function Wm(t){const{tagName:e}=t.target;if(e==="INPUT"||e==="TEXTAREA"){t.stopPropagation();return}t.preventDefault(),t.stopPropagation()}function Ule(t){const{file:e}=t;if(e.preview)return qe("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});const{color:i,icon:n}=HB(e.type);return qe("div",{className:"uppy-Dashboard-Item-previewIconWrap",children:[qe("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:i},children:n}),qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76",children:qe("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})})]})}function oBe(t){const{computedMetaFields:e,requiredMetaFields:i,updateMeta:n,form:o,formState:c}=t,f={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(r=>{const x=`uppy-Dashboard-FileCard-input-${r.id}`,S=i.includes(r.id);return qe("fieldset",{className:"uppy-Dashboard-FileCard-fieldset",children:[qe("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:x,children:r.name}),r.render!==void 0?r.render({value:c[r.id],onChange:C=>n(C,r.id),fieldCSSClasses:f,required:S,form:o.id},RB):qe("input",{className:f.text,id:x,form:o.id,type:r.type||"text",required:S,value:c[r.id],placeholder:r.placeholder,onInput:C=>n(C.target.value,r.id),"data-uppy-super-focusable":!0})]},r.id)})}function aBe(t){const{files:e,fileCardFor:i,toggleFileCard:n,saveFileCard:o,metaFields:c,requiredMetaFields:f,openFileEditor:r,i18n:x,i18nArray:S,className:C,canEditFile:I}=t,N=()=>typeof c=="function"?c(e[i]):c,D=e[i],V=N()??[],B=I(D),W={};V.forEach(Ne=>{W[Ne.id]=D.meta[Ne.id]??""});const[$,G]=Vb(W),te=oN(Ne=>{Ne.preventDefault(),o($,i)},[o,$,i]),ce=(Ne,pe)=>{G({...$,[pe]:Ne})},_e=()=>{n(!1)},[Te]=Vb(()=>{const Ne=document.createElement("form");return Ne.setAttribute("tabindex","-1"),Ne.id=Fle(),Ne}),we=D0(null);return sN(()=>{var pe;const Ne=((pe=we.current)==null?void 0:pe.getRootNode())??document;return Ne instanceof Document?Ne.body.appendChild(Te):(Ne instanceof ShadowRoot,Ne.appendChild(Te)),Te.addEventListener("submit",te),()=>{Te.removeEventListener("submit",te),Te.parentNode&&Te.parentNode.removeChild(Te)}},[Te,te]),qe("div",{className:Ud("uppy-Dashboard-FileCard",C),"data-uppy-panelType":"FileCard",onDragOver:Wm,onDragLeave:Wm,onDrop:Wm,onPaste:Wm,ref:we,children:[qe("div",{className:"uppy-DashboardContent-bar",children:[qe("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:S("editing",{file:qe("span",{className:"uppy-DashboardContent-titleFile",children:D.meta?D.meta.name:D.name})})}),qe("button",{className:"uppy-DashboardContent-back",type:"button",form:Te.id,title:x("finishEditingFile"),onClick:_e,children:x("cancel")})]}),qe("div",{className:"uppy-Dashboard-FileCard-inner",children:[qe("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:HB(D.type).color},children:[qe(Ule,{file:D}),B&&qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:Ne=>{te(Ne),r(D)},children:x("editImage")})]}),qe("div",{className:"uppy-Dashboard-FileCard-info",children:qe(oBe,{computedMetaFields:V,requiredMetaFields:f,updateMeta:ce,form:Te,formState:$})}),qe("div",{className:"uppy-Dashboard-FileCard-actions",children:[qe("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:Te.id,children:x("saveChanges")}),qe("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:_e,form:Te.id,children:x("cancel")})]})]})]})}function lBe(t,e){if(t===e)return!0;if(!t||!e)return!1;const i=Object.keys(t),n=Object.keys(e),o=i.length;if(n.length!==o)return!1;for(let c=0;c<o;c++){const f=i[c];if(t[f]!==e[f]||!Object.prototype.hasOwnProperty.call(e,f))return!1}return!0}function cBe(t,e="Copy the URL below"){return new Promise(i=>{const n=document.createElement("textarea");n.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),n.value=t,document.body.appendChild(n),n.select();const o=()=>{document.body.removeChild(n),window.prompt(e,t),i()};try{return document.execCommand("copy")?(document.body.removeChild(n),i()):o()}catch{return document.body.removeChild(n),o()}})}function uBe({file:t,uploadInProgressOrComplete:e,metaFields:i,canEditFile:n,i18n:o,onClick:c}){return!e&&i&&i.length>0||!e&&n(t)?qe("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":o("editFileWithFilename",{file:t.meta.name}),title:o("editFileWithFilename",{file:t.meta.name}),onClick:()=>c(),children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14",children:qe("g",{fillRule:"evenodd",children:[qe("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),qe("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),qe("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})]})})}):null}function dBe({i18n:t,onClick:e,file:i}){return qe("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":t("removeFile",{file:i.meta.name}),title:t("removeFile",{file:i.meta.name}),onClick:()=>e(),children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18",children:[qe("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),qe("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})]})})}function hBe({file:t,uppy:e,i18n:i}){const n=o=>{cBe(t.uploadURL,i("copyLinkToClipboardFallback")).then(()=>{e.log("Link copied to clipboard."),e.info(i("copyLinkToClipboardSuccess"),"info",3e3)}).catch(e.log).then(()=>o.target.focus({preventScroll:!0}))};return qe("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":i("copyLink"),title:i("copyLink"),onClick:o=>n(o),children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12",children:qe("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})})})}function pBe(t){const{uppy:e,file:i,uploadInProgressOrComplete:n,canEditFile:o,metaFields:c,showLinkToFileUploadResult:f,showRemoveButton:r,i18n:x,toggleFileCard:S,openFileEditor:C}=t;return qe("div",{className:"uppy-Dashboard-Item-actionWrapper",children:[qe(uBe,{i18n:x,file:i,uploadInProgressOrComplete:n,canEditFile:o,metaFields:c,onClick:()=>{c&&c.length>0?S(!0,i.id):C(i)}}),f&&i.uploadURL?qe(hBe,{file:i,uppy:e,i18n:x}):null,r?qe(dBe,{i18n:x,file:i,onClick:()=>e.removeFile(i.id)}):null]})}const fBe=(t,e)=>(typeof e=="function"?e():e).filter(o=>o.id===t)[0].name;function Vle(t){const{file:e,toggleFileCard:i,i18n:n,metaFields:o}=t,{missingRequiredMetaFields:c}=e;if(!(c!=null&&c.length))return null;const f=c.map(r=>fBe(r,o)).join(", ");return qe("div",{className:"uppy-Dashboard-Item-errorMessage",children:[n("missingRequiredMetaFields",{smart_count:c.length,fields:f})," ",qe("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>i(!0,e.id),children:n("editFile")})]})}const mBe=t=>{const{author:e,name:i}=t.file.meta;function n(){return t.isSingleFile&&t.containerHeight>=350?90:t.containerWidth<=352?35:t.containerWidth<=576?60:e?20:30}return qe("div",{className:"uppy-Dashboard-Item-name",title:i,children:Jae(i,n())})},gBe=t=>{var o;const{author:e}=t.file.meta,i="remote"in t.file?(o=t.file.remote)==null?void 0:o.providerName:void 0,n="·";return e?qe("div",{className:"uppy-Dashboard-Item-author",children:[qe("a",{href:`${e.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",children:Jae(e.name,13)}),i?qe(Zp,{children:[` ${n} `,i,` ${n} `]}):null]}):null},yBe=t=>t.file.size&&qe("div",{className:"uppy-Dashboard-Item-statusSize",children:o_(t.file.size)}),_Be=t=>t.file.isGhost&&qe("span",{children:[" ⢠",qe("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>t.toggleAddFilesPanel(!0),children:t.i18n("reSelect")})]}),vBe=({file:t,onClick:e})=>t.error?qe("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":t.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:e,type:"button",children:"?"}):null;function xBe(t){const{file:e,i18n:i,toggleFileCard:n,metaFields:o,toggleAddFilesPanel:c,isSingleFile:f,containerHeight:r,containerWidth:x}=t;return qe("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source,children:[qe("div",{className:"uppy-Dashboard-Item-fileName",children:[mBe({file:e,isSingleFile:f,containerHeight:r,containerWidth:x}),qe(vBe,{file:e,onClick:()=>alert(e.error)})]}),qe("div",{className:"uppy-Dashboard-Item-status",children:[gBe({file:e}),yBe({file:e}),_Be({file:e,toggleAddFilesPanel:c,i18n:i})]}),qe(Vle,{file:e,i18n:i,toggleFileCard:n,metaFields:o})]})}function bBe(t){const{file:e,i18n:i,toggleFileCard:n,metaFields:o,showLinkToFileUploadResult:c}=t,r=e.preview?"rgba(255, 255, 255, 0.5)":HB(e.type).color;return qe("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:r},children:[c&&e.uploadURL&&qe("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name,children:qe("span",{hidden:!0,children:e.meta.name})}),qe(Ule,{file:e}),qe(Vle,{file:e,i18n:i,toggleFileCard:n,metaFields:o})]})}function wBe(t){if(!t.isUploaded){if(t.error&&!t.hideRetryButton){t.uppy.retryUpload(t.file.id);return}t.resumableUploads&&!t.hidePauseResumeButton?t.uppy.pauseResume(t.file.id):t.individualCancellation&&!t.hideCancelButton&&t.uppy.removeFile(t.file.id)}}function g7(t){return t.isUploaded?t.i18n("uploadComplete"):t.error?t.i18n("retryUpload"):t.resumableUploads?t.file.isPaused?t.i18n("resumeUpload"):t.i18n("pauseUpload"):t.individualCancellation?t.i18n("cancelUpload"):""}function Rz(t){return qe("div",{className:"uppy-Dashboard-Item-progress",children:qe("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":g7(t),title:g7(t),onClick:()=>wBe(t),children:t.children})})}function CI({children:t}){return qe("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle",children:t})}function jz({progress:t}){const e=2*Math.PI*15;return qe("g",{children:[qe("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),qe("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":e,"stroke-dashoffset":e-e/100*t})]})}function SBe(t){return!t.file.progress.uploadStarted||t.file.progress.percentage===void 0?null:t.isUploaded?qe("div",{className:"uppy-Dashboard-Item-progress",children:qe("div",{className:"uppy-Dashboard-Item-progressIndicator",children:qe(CI,{children:[qe("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),qe("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})]})})}):t.recoveredState?null:t.error&&!t.hideRetryButton?qe(Rz,{...t,children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19",children:[qe("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),qe("path",{d:"M7.9 3H10v2H7.9z"}),qe("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),qe("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"})]})}):t.resumableUploads&&!t.hidePauseResumeButton?qe(Rz,{...t,children:qe(CI,{children:[qe(jz,{progress:t.file.progress.percentage}),t.file.isPaused?qe("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):qe("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)",children:[qe("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),qe("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})]})]})}):!t.resumableUploads&&t.individualCancellation&&!t.hideCancelButton?qe(Rz,{...t,children:qe(CI,{children:[qe(jz,{progress:t.file.progress.percentage}),qe("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})]})}):qe("div",{className:"uppy-Dashboard-Item-progress",children:qe("div",{className:"uppy-Dashboard-Item-progressIndicator",children:qe(CI,{children:qe(jz,{progress:t.file.progress.percentage})})})})}class TBe extends $h{componentDidMount(){const{file:e}=this.props;
3889e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!lBe(this.props,e)}componentDidUpdate(){const{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){const{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){const{file:e}=this.props,i=e.progress.preprocess||e.progress.postprocess,n=!!e.progress.uploadComplete&&!i&&!e.error,o=!!e.progress.uploadStarted||!!i,c=e.progress.uploadStarted&&!e.progress.uploadComplete||i,f=e.error||!1,{isGhost:r}=e;let x=(this.props.individualCancellation||!c)&&!n;n&&this.props.showRemoveButtonAfterComplete&&(x=!0);const S=Ud({"uppy-Dashboard-Item":!0,"is-inprogress":c&&!this.props.recoveredState,"is-processing":i,"is-complete":n,"is-error":!!f,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":r});return qe("div",{className:S,id:`uppy_${e.id}`,role:this.props.role,children:[qe("div",{className:"uppy-Dashboard-Item-preview",children:[qe(bBe,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),qe(SBe,{uppy:this.props.uppy,file:e,error:f,isUploaded:n,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})]}),qe("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons",children:[qe(xBe,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),qe(pBe,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:x,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:o,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})]})]})}}function CBe(t,e){const i=[];let n=[];return t.forEach(o=>{n.length<e?n.push(o):(i.push(n),n=[o])}),n.length&&i.push(n),i}function EBe({id:t,i18n:e,uppy:i,files:n,resumableUploads:o,hideRetryButton:c,hidePauseResumeButton:f,hideCancelButton:r,showLinkToFileUploadResult:x,showRemoveButtonAfterComplete:S,metaFields:C,isSingleFile:I,toggleFileCard:N,handleRequestThumbn
3889ail:D,handleCancelThumbnail:V,recoveredState:B,individualCancellation:W,itemsPerRow:$,openFileEditor:G,canEditFile:te,toggleAddFilesPanel:ce,containerWidth:_e,containerHeight:Te}){const we=$===1?71:200,Ne=OB(()=>{const Pe=(Je,dt)=>Number(n[dt].isGhost)-Number(n[Je].isGhost),De=Object.keys(n);return B&&De.sort(Pe),CBe(De,$)},[n,$,B]),pe=Pe=>qe("div",{class:"uppy-Dashboard-filesInner",role:"presentation",children:Pe.map(De=>qe(TBe,{uppy:i,id:t,i18n:e,resumableUploads:o,individualCancellation:W,hideRetryButton:c,hidePauseResumeButton:f,hideCancelButton:r,showLinkToFileUploadResult:x,showRemoveButtonAfterComplete:S,metaFields:C,recoveredState:B,isSingleFile:I,containerWidth:_e,containerHeight:Te,toggleFileCard:N,handleRequestThumbnail:D,handleCancelThumbnail:V,role:"listitem",openFileEditor:G,canEditFile:te,toggleAddFilesPanel:ce,file:n[De]},De))},Pe[0]);return I?qe("div",{class:"uppy-Dashboard-files",children:pe(Ne[0])}):qe(BOe,{class:"uppy-Dashboard-files",role:"list",data:Ne,renderRow:pe,rowHeight:we})}const y7=300;class ABe extends $h{constructor(){super(...arguments);je(this,"ref",kOe())}componentWillEnter(i){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(i,y7)}componentWillLeave(i){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(i,y7)}render(){const{children:i}=this.props;return qe("div",{className:"uppy-Informer-animated",ref:this.ref,children:i})}}function IBe(t,e){return Object.assign(t,e)}function kBe(t,e){return(t==null?void 0:t.key)??e}function PBe(t,e){const i=t._ptgLinkedRefs||(t._ptgLinkedRefs={});return i[e]||(i[e]=n=>{t.refs[e]=n})}function jS(t){const e={};for(let i=0;i<t.length;i++)if(t[i]!=null){const n=kBe(t[i],i.toString(36));e[n]=t[i]}return e}function NBe(t,e){t=t||{},e=e||{};const i=f=>Object.hasOwn(e,f)?e[f]:t[f],n={};let o=[];for(const f in t)Object.hasOwn(e,f)?o.length&&(n[f]=o,o=[]):o.push(f);const c={};for(const f in e){if(Object.hasOwn(n,f))for(let r=0;r<n[f].length;r++){const x=n[f][r];c[n[f][r]]=i(x)}c[f]=i(f)}for(let f=0;f<o.length;f++)c[o[f]]=i(o[f]);return c}const MBe=t=>t;class $le extends $h{constructor(e,i){super(e,i),this.refs={},this.state={children:jS(Sm(Sm(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){const e=this.state.children;for(const i in e)e[i]&&this.performAppear(i)}componentWillReceiveProps(e){const i=jS(Sm(e.children)||[]),n=this.state.children;this.setState(c=>({children:NBe(c.children,i)}));let o;for(o in i)if(Object.hasOwn(i,o)){const c=n&&Object.hasOwn(n,o);i[o]&&c&&this.currentlyTransitioningKeys[o]?(this.keysToEnter.push(o),this.keysToAbortLeave.push(o)):i[o]&&!c&&!this.currentlyTransitioningKeys[o]&&this.keysToEnter.push(o)}for(o in n)if(Object.hasOwn(n,o)){const c=i&&Object.hasOwn(i,o);n[o]&&!c&&!this.currentlyTransitioningKeys[o]&&this.keysToLeave.push(o)}}componentDidUpdate(){const{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);const{keysToLeave:i}=this;this.keysToLeave=[],i.forEach(this.performLeave)}_finishAbort(e){const i=this.keysToAbortLeave.indexOf(e);i!==-1&&this.keysToAbortLeave.splice(i,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;const i=this.refs[e];i!=null&&i.componentWillAppear?i.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){const i=this.refs[e];i!=null&&i.componentDidAppear&&i.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);const n=jS(Sm(this.props.children)||[]);(!n||!Object.hasOwn(n,e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;const i=this.refs[e];i!=null&&i.componentWillEnter?i.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){const i=this.refs[e];i!=null&&i.componentDidEnter&&i.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);const n=jS(Sm(this.props.children)||[]);(!n||!Object.hasOwn(n,e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;const n=this.refs[e];n!=null&&n.componentWillLeave?n.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;const n=this.refs[e];n!=null&&n.componentDidLeave&&n.componentDidLeave(),delete this.currentlyTransitioningKeys[e];const o=jS(Sm(this.props.children)||[]);if(o&&Object.hasOwn(o,e))this.performEnter(e);else{const c=IBe({},this.state.children);delete c[e],this.setState({children:c})}}render({childFactory:e,transitionLeave:i,transitionName:n,transitionAppear:o,transitionEnter:c,transitionLeaveTimeout:f,transitionEnterTimeout:r,transitionAppearTimeout:x,component:S,...C},{children:I}){const N=Object.entries(I).map(([D,V])=>{if(!V)return;const B=PBe(this,D);return dle(e(V),{ref:B,key:D})}
3889).filter(Boolean);return RB(S,C,N)}}$le.defaultProps={component:"span",childFactory:MBe};class _7 extends $h{render(){const{info:e}=this.props.uppy.getState();return qe("div",{className:"uppy uppy-Informer",children:qe($le,{children:e.map(i=>qe(ABe,{children:qe("p",{role:"alert",children:[i.message," ",i.details&&qe("span",{"aria-label":i.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${i.message} 3890 3891 ${i.details}`),children:"?"})]})},i.message))})})}}function DBe({activePickerPanel:t,className:e,hideAllPanels:i,i18n:n,state:o,uppy:c}){const f=D0(null);return qe("div",{className:Ud("uppy-DashboardContent-panel",e),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${t.id}`,onDragOver:Wm,onDragLeave:Wm,onDrop:Wm,onPaste:Wm,children:[qe("div",{className:"uppy-DashboardContent-bar",children:[qe("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":1,children:n("importFrom",{name:t.name})}),qe("button",{className:"uppy-DashboardContent-back",type:"button",onClick:i,children:n("cancel")})]}),qe("div",{ref:f,className:"uppy-DashboardContent-panelBody",children:c.getPlugin(t.id).render(o,f.current)})]})}const mh={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function RBe(t,e,i,n={}){if(t)return mh.STATE_ERROR;if(e)return mh.STATE_COMPLETE;if(i)return mh.STATE_PAUSED;let o=mh.STATE_WAITING;const c=Object.keys(n);for(let f=0;f<c.length;f++){const{progress:r}=n[c[f]];if(r.uploadStarted&&!r.uploadComplete)return mh.STATE_UPLOADING;r.preprocess&&o!==mh.STATE_UPLOADING&&(o=mh.STATE_PREPROCESSING),r.postprocess&&o!==mh.STATE_UPLOADING&&o!==mh.STATE_PREPROCESSING&&(o=mh.STATE_POSTPROCESSING)}return o}function jBe({files:t,i18n:e,isAllComplete:i,isAllErrored:n,isAllPaused:o,inProgressNotPausedFiles:c,newFiles:f,processingFiles:r}){switch(RBe(n,i,o,t)){case"uploading":return e("uploadingXFiles",{smart_count:c.length});case"preprocessing":case"postprocessing":return e("processingXFiles",{smart_count:r.length});case"paused":return e("uploadPaused");case"waiting":return e("xFilesSelected",{smart_count:f.length});case"complete":return e("uploadComplete");case"error":return e("error")}}function zBe(t){const{i18n:e,isAllComplete:i,hideCancelButton:n,maxNumberOfFiles:o,toggleAddFilesPanel:c,uppy:f}=t;let{allowNewUpload:r}=t;return r&&o&&(r=t.totalFileCount<t.maxNumberOfFiles),qe("div",{className:"uppy-DashboardContent-bar",children:[!i&&!n?qe("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>f.cancelAll(),children:e("cancel")}):qe("div",{}),qe("div",{className:"uppy-DashboardContent-title",children:qe(jBe,{...t})}),r?qe("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>c(!0),children:[qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15",children:qe("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})}),qe("span",{className:"uppy-DashboardContent-addMoreCaption",children:e("addMore")})]}):qe("div",{})]})}
vendor: 5,768 bytes, line 3891
3891const Zx="uppy-transition-slideDownUp",v7=250;function EI({children:t}){const[e,i]=Vb(null),[n,o]=Vb(""),c=D0(),f=D0(),r=D0(),x=oN(()=>{o(`${Zx}-enter`),cancelAnimationFrame(r.current),clearTimeout(f.current),f.current=void 0,r.current=requestAnimationFrame(()=>{o(`${Zx}-enter ${Zx}-enter-active`),c.current=setTimeout(()=>{o("")},v7)})},[]),S=oN(()=>{o(`${Zx}-leave`),cancelAnimationFrame(r.current),clearTimeout(c.current),c.current=void 0,r.current=requestAnimationFrame(()=>{o(`${Zx}-leave ${Zx}-leave-active`),f.current=setTimeout(()=>{i(null),o("")},v7)})},[]);return sN(()=>{const C=Sm(t)[0];e!==C&&(C&&!e?x():e&&!C&&!f.current&&S(),i(C))},[t,e,x,S]),sN(()=>()=>{clearTimeout(c.current),clearTimeout(f.current),cancelAnimationFrame(r.current)},[]),e?dle(e,{className:Ud(n,e.props.className)}):null}const bh={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"},LBe="·",x7=()=>` ${LBe} `;function OBe(t){const{newFiles:e,isUploadStarted:i,recoveredState:n,i18n:o,uploadState:c,isSomeGhost:f,startUpload:r}=t,x=Ud("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":c===bh.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":f}),S=e&&i&&!n?o("uploadXNewFiles",{smart_count:e}):o("uploadXFiles",{smart_count:e});return qe("button",{type:"button",className:x,"aria-label":o("uploadXFiles",{smart_count:e}),onClick:r,disabled:f,"data-uppy-super-focusable":!0,children:S})}function FBe(t){const{i18n:e,uppy:i}=t;return qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>i.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry",children:[qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10",children:qe("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})}),e("retry")]})}function BBe(t){const{i18n:e,uppy:i}=t;return qe("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>i.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0,children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:qe("g",{fill:"none",fillRule:"evenodd",children:[qe("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),qe("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"})]})})})}function UBe(t){const{isAllPaused:e,i18n:i,isAllComplete:n,resumableUploads:o,uppy:c}=t,f=i(e?"resume":"pause");function r(){if(!n){if(!o){c.cancelAll();return}if(e){c.resumeAll();return}c.pauseAll()}}return qe("button",{title:f,"aria-label":f,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:r,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0,children:qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16",children:qe("g",{fill:"none",fillRule:"evenodd",children:[qe("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),qe("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"})]})})})}function VBe(t){const{i18n:e,doneButtonHandler:i}=t;return qe("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:i,"data-uppy-super-focusable":!0,children:e("done")})}function qle(){return qe("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14",children:qe("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"})})}function $Be(t){const{progress:e}=t,{value:i,mode:n,message:o}=e;return qe("div",{className:"uppy-StatusBar-content",children:[qe(qle,{}),n==="determinate"?`${Math.round(i*100)}% · `:"",o]})}function qBe(t){const{numUploads:e,complete:i,totalUploadedSize:n,totalSize:o,totalETA:c,i18n:f}=t,r=e>1,x=o_(n);return qe("div",{className:"uppy-StatusBar-statusSecondary",children:[r&&f("filesUploadedOfTotal",{complete:i,smart_count:e}),qe("span",{className:"uppy-StatusBar-additionalInfo",children:[r&&x7(),o!=null?f("dataUploadedOfTotal",{complete:x,total:o_(o)}):f("dataUploadedOfUnknown",{complete:x}),x7(),c!=null&&f("xTimeLeft",{time:wOe(c)})]})]})}function Hle(t){const{i18n:e,complete:i,numUploads:n}=t;return qe("div",{className:"uppy-StatusBar-statusSecondary",children:e("filesUploadedOfTotal",{complete:i,smart_count:n})})}function HBe(t){const{i18n:e,newFiles:i,startUpload:n}=t,o=Ud("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return qe("div",{className:"uppy-StatusBar-statusSecondary",children:[qe("div",{className:"uppy-StatusBar-statusSecondaryHint",children:e("xMoreFilesAdded",{smart_count:i})}),qe("button",{type:"button",className:o,"aria-label":e("uploadXFiles",{smart_count:i}),onClick:n,children:e("upload")})]})}function GBe(t){const{i18n:e,supportsUploadProgress:i,totalProgress:n,hideProgressDetail
3891s:o,isUploadStarted:c,isAllComplete:f,isAllPaused:r,newFiles:x,numUploads:S,complete:C,totalUploadedSize:I,totalSize:N,totalETA:D,startUpload:V}=t,B=x&&c;if(!c||f)return null;const W=e(r?"paused":"uploading");function $(){return!r&&!B&&!o?i?qe(qBe,{numUploads:S,complete:C,totalUploadedSize:I,totalSize:N,totalETA:D,i18n:e}):qe(Hle,{i18n:e,complete:C,numUploads:S}):null}return qe("div",{className:"uppy-StatusBar-content",title:W,children:[r?null:qe(qle,{}),qe("div",{className:"uppy-StatusBar-status",children:[qe("div",{className:"uppy-StatusBar-statusPrimary",children:i&&n!==0?`${W}: ${n}%`:W}),$(),B?qe(HBe,{i18n:e,newFiles:x,startUpload:V}):null]})]})}function WBe(t){const{i18n:e}=t;return qe("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete"),children:qe("div",{className:"uppy-StatusBar-status",children:qe("div",{className:"uppy-StatusBar-statusPrimary",children:[qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11",children:qe("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})}),e("complete")]})})})}function KBe(t){const{error:e,i18n:i,complete:n,numUploads:o}=t;function c(){const f=`${i("uploadFailed")} 3892 3893 ${e}`;alert(f)}return qe("div",{className:"uppy-StatusBar-content",title:i("uploadFailed"),children:[qe("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11",children:qe("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})}),qe("div",{className:"uppy-StatusBar-status",children:[qe("div",{className:"uppy-StatusBar-statusPrimary",children:[i("uploadFailed"),qe("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":i("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:c,type:"button",children:"?"})]}),qe(Hle,{i18n:i,complete:n,numUploads:o})]})]})}function zz(t){const e=[];let i="indeterminate",n;for(const{progress:c}of Object.values(t)){const{preprocess:f,postprocess:r}=c;n==null&&(f||r)&&({mode:i,message:n}=f||r),(f==null?void 0:f.mode)==="determinate"&&e.push(f.value),(r==null?void 0:r.mode)==="determinate"&&e.push(r.value)}const o=e.reduce((c,f)=>c+f/e.length,0);return{mode:i,message:n,value:o}}const{STATE_ERROR:b7,STATE_WAITING:ZBe,STATE_PREPROCESSING:Lz,STATE_UPLOADING:AI,STATE_POSTPROCESSING:Oz,STATE_COMPLETE:II}=bh;function XBe({newFiles:t,allowNewUpload:e,isUploadInProgress:i,isAllPaused:n,resumableUploads:o,error:c,hideUploadButton:f=void 0,hidePauseResumeButton:r=!1,hideCancelButton:x=!1,hideRetryButton:S=!1,recoveredState:C,uploadState:I,totalProgress:N,files:D,supportsUploadProgress:V,hideAfterFinish:B=!1,isSomeGhost:W,doneButtonHandler:$=void 0,isUploadStarted:G,i18n:te,startUpload:ce,uppy:_e,isAllComplete:Te,hideProgressDetails:we=void 0,numUploads:Ne,complete:pe,totalSize:Pe,totalETA:De,totalUploadedSize:Je}){function dt(){switch(I){case Oz:case Lz:{const Oi=zz(D);return Oi.mode==="determinate"?Oi.value*100:N}case b7:return null;case AI:return V?N:null;default:return N}}function At(){switch(I){case Oz:case Lz:{const{mode:Oi}=zz(D);return Oi==="indeterminate"}case AI:return!V;default:return!1}}const qt=dt(),kt=qt??100,Vt=!c&&t&&(!i&&!n||C)&&e&&!f,Fe=!x&&I!==ZBe&&I!==II,lt=o&&!r&&I===AI,pt=c&&!Te&&!S,Ge=$&&I===II,Rt=Ud("uppy-StatusBar-progress",{"is-indeterminate":At()}),Ot=Ud("uppy-StatusBar",`is-${I}`,{"has-ghosts":W}),Ci=(()=>{switch(I){case Lz:case Oz:return qe($Be,{progress:zz(D)});case II:return qe(WBe,{i18n:te});case b7:return qe(KBe,{error:c,i18n:te,numUploads:Ne,complete:pe});case AI:return qe(GBe,{i18n:te,supportsUploadProgress:V,totalProgress:N,hideProgressDetails:we,isUploadStarted:G,isAllComplete:Te,isAllPaused:n,newFiles:t,numUploads:Ne,complete:pe,totalUploadedSize:Je,totalSize:Pe,totalETA:De,startUpload:ce});default:return null}})();return!(Vt||pt||lt||Fe||Ge)&&!Ci||I===II&&B?null:qe("div",{className:Ot,children:[qe("div",{className:Rt,style:{width:`${kt}%`},role:"progressbar","aria-label":`${kt}%`,"aria-valuetext":`${kt}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":qt}),Ci,qe("div",{className:"uppy-StatusBar-actions",children:[Vt?qe(OBe,{newFiles:t,isUploadStarted:G,recoveredState:C,i18n:te,isSomeGhost:W,startUpload:ce,uploadState:I}):null,pt?qe(FBe,{i18n:te,uppy:_e}):null,lt?qe(UBe,{isAllPaused:n,i18n:te,isAllComplete:Te,resumableUploads:o,uppy:_e}):null,Fe?qe(BBe,{i18n:te,uppy:_e}):null,Ge?qe(VBe,{i18n:te,doneButtonHandler:$}):null]})]})}const YBe=2e3,QBe=2e3;function JBe(t,e,i,n){if(t)return bh.STATE_ERROR;if(e)return bh.STATE_COMPLETE;if(i)return bh.STATE_WAITING;let o=bh.STATE_WAITING;const c=Object.keys(n);for(let f=0;f<c.length;f++){const{progress:r}=n[c[f]];if(r.uploadStarted&&!r.uploadComplete)return bh.STATE_UPLOADING;r.preprocess&&(o=bh.STATE_PREPROCESSING),r.postprocess&&o!==bh.STATE_PREPROCESSING&&(o=bh.STATE_POSTPROCESSING)}return o}var Fm,kh,__,Vp,$C,vN,Gle;class e5e extends $h{constructor(){super(...arguments);Wt(this,vN);Wt(this,Fm);Wt(this,kh);Wt(this,__);Wt(this,Vp);Wt(this,$C,()=>{const{recoveredState:i}=this.props.uppy.getState();if(Jt(this,__,null),Jt(this,Vp,null),i){Jt(this,kh,Object.values(i.files).reduce((n,{progress:o})=>n+(o.bytesUploaded||0),0));return}Jt(this,Fm,performance.now()),Jt(this,kh,0)});je(this,"startUpload",()=>{const{recoveredState:i}=this.props.uppy.getState();i?this.props.uppy.emit("restore-confirmed"):this.props.uppy.upload().catch(()=>{})})}componentDidMount(){Jt(this,Fm,performance.now()),Jt(this,kh,this.props.uppy.getFiles().reduce((i,n)=>i+(n.progress.bytesUploaded||0),0)),this.props.uppy.on("upload",he(this,$C))}componentWillUnmount(){this.props.uppy.off("upload",he(this,$C))}render(){const{capabilities:i,files:n,allowNewUpload:o,totalProgress:c,error:f,recoveredState:r}=this.props.uppy.getState(),{newFiles:x,startedFiles:S,completeFiles:C,isUploadStarted:I,isAllComplete:N,isAllPaused:D,isUploadInProgress:V,isSomeGhost:B}=this.props.uppy.getObjectOfFilesPerState(),W=r?Object.values(n):x,$=!!i.resumableUploads,G=i.uploadProgress!==!1;let te=null,ce=0;S.every(Te=>Te.progress.bytesTotal!=null&&Te.progress.bytesTotal!==0)?(te=0,S.forEac
3893h(Te=>{te+=Te.progress.bytesTotal||0,ce+=Te.progress.bytesUploaded||0})):S.forEach(Te=>{ce+=Te.progress.bytesUploaded||0});const _e=ci(this,vN,Gle).call(this,{uploaded:ce,total:te});return qe(XBe,{error:f,uploadState:JBe(f,N,r,n||{}),allowNewUpload:o,totalProgress:c,totalSize:te,totalUploadedSize:ce,isAllComplete:N,isAllPaused:D,isUploadStarted:I,isUploadInProgress:V,isSomeGhost:B,recoveredState:r,complete:C.length,newFiles:W.length,numUploads:S.length,totalETA:_e,files:n,i18n:this.props.i18n,uppy:this.props.uppy,startUpload:this.startUpload,doneButtonHandler:this.props.doneButtonHandler,resumableUploads:$,supportsUploadProgress:G,hideProgressDetails:this.props.hideProgressDetails,hideUploadButton:this.props.hideUploadButton,hideRetryButton:this.props.hideRetryButton,hidePauseResumeButton:this.props.hidePauseResumeButton,hideCancelButton:this.props.hideCancelButton,hideAfterFinish:this.props.hideAfterFinish})}}Fm=new WeakMap,kh=new WeakMap,__=new WeakMap,Vp=new WeakMap,$C=new WeakMap,vN=new WeakSet,Gle=function(i){if(i.total==null||i.total===0)return null;const n=i.total-i.uploaded;if(n<=0)return null;he(this,Fm)??Jt(this,Fm,performance.now());const o=performance.now()-he(this,Fm);if(o===0)return Math.round((he(this,Vp)??0)/100)/10;if(he(this,kh)==null)return Jt(this,kh,i.uploaded),null;const c=i.uploaded-he(this,kh);if(Jt(this,kh,i.uploaded),c<=0)return Math.round((he(this,Vp)??0)/100)/10;const f=c/o;if(!Number.isFinite(f)||f<=0)return null;const r=he(this,__)==null?f:MG(f,he(this,__),YBe,o);if(!Number.isFinite(r)||r<=0)return null;Jt(this,__,r);const x=n/r;if(!Number.isFinite(x)||x<0)return null;const S=Math.max((he(this,Vp)??0)-o,0),C=he(this,Vp)==null?x:MG(x,S,QBe,o);return!Number.isFinite(C)||C<0?null:(Jt(this,Vp,C),Jt(this,Fm,performance.now()),Math.round(C/100)/10)};const w7=900,S7=700,Fz=576,T7=330;function t5e(t){const e=t.totalFileCount===0,i=t.totalFileCount===1,n=t.containerWidth>Fz,o=t.containerHeight>T7,c=Ud({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":t.disabled,"uppy-Dashboard--animateOpenClose":t.animateOpenClose,"uppy-Dashboard--isClosing":t.isClosing,"uppy-Dashboard--isDraggingOver":t.isDraggingOver,"uppy-Dashboard--modal":!t.inline,"uppy-size--md":t.containerWidth>Fz,"uppy-size--lg":t.containerWidth>S7,"uppy-size--xl":t.containerWidth>w7,"uppy-size--height-md":t.containerHeight>T7,"uppy-Dashboard--isAddFilesPanelVisible":t.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":t.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":t.singleFileFullScreen&&i&&o});let f=1;t.containerWidth>w7?f=5:t.containerWidth>S7?f=4:t.containerWidth>Fz&&(f=3);const r=t.showSelectedFiles&&!e,x=t.recoveredState?Object.keys(t.recoveredState.files).length:null,S=t.files?Object.keys(t.files).filter(N=>t.files[N].isGhost).length:0,C=()=>S>0?t.i18n("recoveredXFiles",{smart_count:S}):t.i18n("recoveredAllFiles");return qe("div",{className:c,"data-uppy-theme":t.theme,"data-uppy-num-acquirers":t.acquirers.length,"data-uppy-drag-drop-supported":!t.disableLocalFiles&&xOe(),"aria-hidden":t.inline?"false":t.isHidden,"aria-disabled":t.disabled,"aria-label":t.inline?t.i18n("dashboardTitle"):t.i18n("dashboardWindowTitle"),onPaste:t.handlePaste,onDragOver:t.handleDragOver,onDragLeave:t.handleDragLeave,onDrop:t.handleDrop,children:[qe("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:t.handleClickOutside}),qe("div",{className:"uppy-Dashboard-inner",role:t.inline?void 0:"dialog",style:{width:t.inline&&t.width?t.width:"",height:t.inline&&t.height?t.height:""},children:[t.inline?null:qe("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":t.i18n("closeModal"),title:t.i18n("closeModal"),onClick:t.closeModal,children:qe("span",{"aria-hidden":"true",children:"Ã"})}),qe("div",{className:"uppy-Dashboard-innerWrap",children:[qe("div",{className:"uppy-Dashboard-dropFilesHereHint",children:t.i18n("dropHint")}),r&&qe(zBe,{...t}),x&&qe("div",{className:"uppy-Dashboard-serviceMsg",children:[qe("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19",children:qe("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd",children:[qe("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),qe("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),qe("circle",{fill:"#000",cx:"12",cy:"17",r:"1"})]})}),qe("strong",{className:"uppy-Dashboard-serviceMsg-title",children:t.i18n("sessionRestored")}),qe("div",{className:"uppy-Dashboard-serviceMsg-text",children:C()})]}),r?qe(EBe,{id:t.id,i18n:t.i18n,uppy:t.uppy,files:t.files,resumableUploads:t.resumableUploads,hideRetryButton:t.hideRetryButton,hidePauseResumeButton:t.hidePauseResumeButton,hideCancelButton:t.hideCancelButton,showLinkToFileUploadResult:t.showLinkToFileUploadResult,showRemoveButtonAfterComplete:t.showRemoveButtonAfterComplete,metaFields:t.metaFields,toggleFileCard:t.toggleFileCard,handleRequestThumbn
3893ail:t.handleRequestThumbnail,handleCancelThumbnail:t.handleCancelThumbnail,recoveredState:t.recoveredState,individualCancellation:t.individualCancellation,openFileEditor:t.openFileEditor,canEditFile:t.canEditFile,toggleAddFilesPanel:t.toggleAddFilesPanel,isSingleFile:i,itemsPerRow:f,containerWidth:t.containerWidth,containerHeight:t.containerHeight}):qe(Ble,{i18n:t.i18n,i18nArray:t.i18nArray,acquirers:t.acquirers,handleInputChange:t.handleInputChange,maxNumberOfFiles:t.maxNumberOfFiles,allowedFileTypes:t.allowedFileTypes,showNativePhotoCameraButton:t.showNativePhotoCameraButton,showNativeVideoCameraButton:t.showNativeVideoCameraButton,nativeCameraFacingMode:t.nativeCameraFacingMode,showPanel:t.showPanel,activePickerPanel:t.activePickerPanel,disableLocalFiles:t.disableLocalFiles,fileManagerSelectionType:t.fileManagerSelectionType,note:t.note,proudlyDisplayPoweredByUppy:t.proudlyDisplayPoweredByUppy}),qe(EI,{children:t.showAddFilesPanel?qe(Y4e,{...t,isSizeMD:n},"AddFiles"):null}),qe(EI,{children:t.fileCardFor?qe(aBe,{...t},"FileCard"):null}),qe(EI,{children:t.activePickerPanel?qe(DBe,{...t},"Picker"):null}),qe(EI,{children:t.showFileEditor?qe(Q4e,{...t},"Editor"):null}),qe("div",{className:"uppy-Dashboard-progressindicators",children:[!t.disableInformer&&qe(_7,{uppy:t.uppy}),!t.disableStatusBar&&qe(e5e,{uppy:t.uppy,i18n:t.i18n,hideProgressDetails:t.hideProgressDetails,hideUploadButton:t.hideUploadButton,hideRetryButton:t.hideRetryButton,hidePauseResumeButton:t.hidePauseResumeButton,hideCancelButton:t.hideCancelButton,hideAfterFinish:t.hideProgressAfterFinish,doneButtonHandler:t.doneButtonHandler}),!t.disableInformer&&qe(_7,{uppy:t.uppy}),t.progressindicators.map(N=>t.uppy.getPlugin(N.id).render(t.state))]})]})]})]})}const i5e={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video",uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};function Wle(t,e){if(e){const i=t.querySelector(`[data-uppy-paneltype="${e}"]`);if(i)return i}return t}function n5e(){let t=!1;return p3e((i,n)=>{const o=Wle(i,n),c=o.contains(document.activeElement);if(c&&t)return;const f=o.querySelector("[data-uppy-super-focusable]");if(!(c&&!f))if(f)f.focus({preventScroll:!0}),t=!0;else{const r=o.querySelector(Vae);r==null||r.focus({preventScroll:!0}),t=!1}},260)}function C7(t,e){const i=e[0];i&&(i.focus(),t.preventDefault())}function r5e(t,e){const i=e[e.length-1];i&&(i.focus(),t.preventDefault())}function s5e(t){return t.contains(document.activeElement)}function Kle(t,e,i){const n=Wle(i,e),o=PT(n.querySelectorAll(Vae)),c=o.indexOf(document.activeElement);s5e(n)?t.shiftKey&&c===0?r5e(t,o):!t.shiftKey&&c===o.length-1&&C7(t,o):C7(t,o)}function o5e(t,e,i){e===null||Kle(t,e,i)}const E7=9,a5e=27;function A7(){const t={};return t.promise=new Promise((e,i)=>{t.resolve=e,t.reject=i}),t}const l5e={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:H3e,showLinkToFileUploadResult:!1,hideProgressDetail
3893s:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550};var Gz,ib,v_,qC,nb,xN,bN,wN,x_,SN,TN,rb,Ig,PF,NF;let c5e=(Gz=class extends aN{constructor(i,n){var c;const o=(n==null?void 0:n.autoOpen)??null;super(i,{...l5e,...n,autoOpen:o});Wt(this,Ig);Wt(this,ib);je(this,"modalName",`uppy-Dashboard-${Fle()}`);je(this,"superFocus",n5e());je(this,"ifFocusedOnUppyRecently",!1);je(this,"dashboardIsDisabled");je(this,"savedScrollPosition");je(this,"savedActiveElement");je(this,"resizeObserver");je(this,"darkModeMediaQuery");je(this,"makeDashboardInsidesVisibleAnywayTimeout");je(this,"removeTarget",i=>{const o=this.getPluginState().targets.filter(c=>c.id!==i.id);this.setPluginState({targets:o})});je(this,"addTarget",i=>{const n=i.id||i.constructor.name,o=i.title||n,c=i.type;if(c!=="acquirer"&&c!=="progressindicator"&&c!=="editor")return this.up
3893py.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;const f={id:n,name:o,type:c},x=this.getPluginState().targets.slice();return x.push(f),this.setPluginState({targets:x}),this.el});je(this,"hideAllPanels",()=>{var o;const i=this.getPluginState(),n={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};i.activePickerPanel===n.activePickerPanel&&i.showAddFilesPanel===n.showAddFilesPanel&&i.showFileEditor===n.showFileEditor&&i.activeOverlayType===n.activeOverlayType||(this.setPluginState(n),this.uppy.emit("dashboard:close-panel",(o=i.activePickerPanel)==null?void 0:o.id))});je(this,"showPanel",i=>{const{targets:n}=this.getPluginState(),o=n.find(c=>c.type==="acquirer"&&c.id===i);this.setPluginState({activePickerPanel:o,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",i)});je(this,"canEditFile",i=>{const{targets:n}=this.getPluginState();return he(this,x_).call(this,n).some(c=>this.uppy.getPlugin(c.id).canEditFile(i))});je(this,"openFileEditor",i=>{const{targets:n}=this.getPluginState(),o=he(this,x_).call(this,n);this.setPluginState({showFileEditor:!0,fileCardFor:i.id||null,activeOverlayType:"FileEditor"}),o.forEach(c=>{this.uppy.getPlugin(c.id).selectFile(i)})});je(this,"closeFileEditor",()=>{const{metaFields:i}=this.getPluginState();i&&i.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})});je(this,"saveFileEditor",()=>{const{targets:i}=this.getPluginState();he(this,x_).call(this,i).forEach(o=>{this.uppy.getPlugin(o.id).save()}),this.closeFileEditor()});je(this,"openModal",()=>{const{promise:i,resolve:n}=A7();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){const o=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",o,!1),n()};this.el.addEventListener("animationend",o,!1)}else this.setPluginState({isHidden:!1}),n();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),i});je(this,"closeModal",i=>{var x;const n=(i==null?void 0:i.manualClose)??!0,{isHidden:o,isClosing:c}=this.getPluginState();if(o||c)return;const{promise:f,resolve:r}=A7();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});const S=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",S,!1),r()};this.el.addEventListener("animationend",S,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),r();return document.removeEventListener("keydown",this.handleKeyDownInModal),n&&this.opts.browserBackButtonClose&&(x=history.state)!=null&&x[this.modalName]&&history.back(),this.uppy.emit("dashboard:modal-closed"),f});je(this,"isModalOpen",()=>!this.getPluginState().isHidden||!1);je(this,"requestCloseModal",()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal());je(this,"setDarkModeCapability",i=>{const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,darkMode:i}})});je(this,"handleSystemDarkModeChange",i=>{const n=i.matches;this.uppy.log(`[Dashboard] Dark mode is ${n?"on":"off"}`),this.setDarkModeCapability(n)});je(this,"toggleFileCard",(i,n)=>{const o=this.uppy.getFile(n);i?this.uppy.emit("dashboard:file-edit-start",o):this.uppy.emit("dashboard:file-edit-complete",o),this.setPluginState({fileCardFor:i?n:null,activeOverlayType:i?"FileCard":null})});je(this,"toggleAddFilesPanel",i=>{this.setPluginState({showAddFilesPanel:i,activeOverlayType:i?"AddFiles":null})});je(this,"addFiles",i=>{const n=i.map(o=>({source:this.id,name:o.name,type:o.type,data:o,meta:{relativePath:o.relativePath||o.webkitRelativePath||null}}));
3893try{this.uppy.addFiles(n)}catch(o){this.uppy.log(o)}});je(this,"startListeningToResize",()=>{this.resizeObserver=new ResizeObserver(i=>{const n=i[0],{width:o,height:c}=n.contentRect;this.setPluginState({containerWidth:o,containerHeight:c,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{const i=this.getPluginState(),n=!this.opts.inline&&i.isHidden;!i.areInsidesReadyToBeVisible&&!n&&(this.uppy.log("[Dashboard] resize event didnât fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)});je(this,"stopListeningToResize",()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)});je(this,"recordIfFocusedOnUppyRecently",i=>{this.el.contains(i.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())});je(this,"disableInteractiveElements",i=>{const n=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],o=he(this,ib)??PT(this.el.querySelectorAll(n)).filter(c=>!c.classList.contains("uppy-Dashboard-close"));for(const c of o)c.tagName==="A"?c.setAttribute("aria-disabled",i):c.disabled=i;i?Jt(this,ib,o):Jt(this,ib,null),this.dashboardIsDisabled=i});je(this,"updateBrowserHistory",()=>{var i;(i=history.state)!=null&&i[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)});je(this,"handlePopState",i=>{var n;this.isModalOpen()&&(!i.state||!i.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&((n=i.state)!=null&&n[this.modalName])&&history.back()});je(this,"handleKeyDownInModal",i=>{i.keyCode===a5e&&this.requestCloseModal(),i.keyCode===E7&&Kle(i,this.getPluginState().activeOverlayType,this.el)});je(this,"handleClickOutside",()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()});je(this,"handlePaste",i=>{this.uppy.iteratePlugins(o=>{var c;o.type==="acquirer"&&((c=o.handleRootPaste)==null||c.call(o,i))});const n=PT(i.clipboardData.files);n.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(n))});je(this,"handleInputChange",i=>{i.preventDefault();const n=PT(i.currentTarget.files||[]);n.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(n))});je(this,"handleDragOver",i=>{i.preventDefault(),i.stopPropagation();const n=()=>{let r=!0;
3893return this.uppy.iteratePlugins(x=>{var S;(S=x.canHandleRootDrop)!=null&&S.call(x,i)&&(r=!0)}),r},o=()=>{const{types:r}=i.dataTransfer;return r.some(x=>x==="Files")},c=n(),f=o();if(!c&&!f||this.opts.disabled||this.opts.disableLocalFiles&&(f||!c)||!this.uppy.getState().allowNewUpload){i.dataTransfer.dropEffect="none";return}i.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(i)});je(this,"handleDragLeave",i=>{i.preventDefault(),i.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(i)});je(this,"handleDrop",async i=>{i.preventDefault(),i.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(f=>{var r;f.type==="acquirer"&&((r=f.handleRootDrop)==null||r.call(f,i))});let n=!1;const o=f=>{this.uppy.log(f,"error"),n||(this.uppy.info(f.message,"error"),n=!0)};this.uppy.log("[Dashboard] Processing dropped files");const c=await yOe(i.dataTransfer,{logDropError:o});c.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(c)),this.opts.onDrop(i)});
3893je(this,"handleRequestThumbnail",i=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",i)});je(this,"handleCancelThumbnail",i=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",i)});je(this,"handleKeyDownInInline",i=>{i.keyCode===E7&&o5e(i,this.getPluginState().activeOverlayType,this.el)});je(this,"handlePasteOnBody",i=>{this.el.contains(document.activeElement)&&this.handlePaste(i)});je(this,"handleComplete",({failed:i})=>{this.opts.closeAfterFinish&&!(i!=null&&i.length)&&this.requestCloseModal()});Wt(this,v_,()=>{if(this.opts.disableThumbnailGenerator)return;const i=600,n=this.uppy.getFiles();if(n.length===1){const o=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);o==null||o.setOptions({thumbnailWidth:i});const c={...n[0],preview:void 0};o==null||o.requestThumbnail(c).then(()=>{o==null||o.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}});Wt(this,qC,i=>{const n=i[0],{metaFields:o}=this.getPluginState(),c=o&&o.length>0,f=this.canEditFile(n);c&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,n.id):f&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(n)});je(this,"initEvents",()=>{if(this.opts.trigger&&!this.opts.inline){const i=DG(this.opts.trigger);i?i.forEach(n=>n.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openM
3893odal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",he(this,rb)),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",he(this,v_)),this.uppy.on("file-removed",he(this,v_)),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",he(this,qC))});je(this,"removeEvents",()=>{const i=DG(this.opts.trigger);!this.opts.inline&&i&&i.forEach(n=>n.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",he(this,rb)),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",he(this,v_)),this.uppy.off("file-removed",he(this,v_)),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",he(this,qC))});je(this,"superFocusOnEachUpdate",()=>{const i=this.el.contains(document.activeElement),n=document.activeElement===document.body||document.activeElement===null,o=this.uppy.getState().info.length===0,c=!this.opts.inline;o&&(c||i||n&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()});je(this,"afterUpdate",()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()});je(this,"saveFileCard",(i,n)=>{this.uppy.setFileMeta(n,i),this.toggleFileCard(!1,n)});Wt(this,nb,i=>{const n=this.uppy.getPlugin(i.id);return{...i,icon:n.icon||this.opts.defaultPickerIcon,render:n.render}});Wt(this,xN,i=>{const n=this.uppy.getPlugin(i.id);return typeof n.isSupported!="function"?!0:n.isSupported()});Wt(this,bN,i=>i.filter(n=>n.type==="acquirer"&&he(this,xN).call(this,n)).map(he(this,nb)));Wt(this,wN,i=>i.filter(n=>n.type==="progressindicator").map(he(this,nb)));Wt(this,x_,i=>i.filter(n=>n.type==="editor").map(he(this,nb)));je(this,"render",i=>{const n=this.getPluginState(),{files:o,capabilities:c,allowNewUpload:f}=i,{newFiles:r,uploadStartedFiles:x,completeFiles:S,erroredFiles:C,inProgressFiles:I,inProgressNotPausedFiles:N,processingFiles:D,isUploadStarted:V,isAllComplete:B,isAllPaused:W}=this.uppy.getObjectOfFilesPerState(),$=he(this,bN).call(this,n.targets),G=he(this,wN).call(this,n.targets),te=he(this,x_).call(this,n.targets);let ce;return this.opts.theme==="auto"?ce=c.darkMode?"dark":"light":ce=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),t5e({state:i,isHidden:n.isHidden,files:o,newFiles:r,uploadStartedFiles:x,completeFiles:S,erroredFiles:C,inProgressFiles:I,inProgressNotPausedFiles:N,processingFiles:D,isUploadStarted:V,isAllComplete:B,isAllPaused:W,totalFileCount:Object.keys(o).length,totalProgress:i.totalProgress,allowNewUpload:f,acquirers:$,theme:ce,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:n.activePickerPanel,showFileEditor:n.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:n.isClosing,progressindicators:G,editors:te,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:i.recoveredState,metaFields:n.metaFields,resumableUploads:c.resumableUploads||!1,individualCancellation:c.individualCancellation,isMobileDevice:c.isMobileDevice,fileCardFor:n.fileC
3893ardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:n.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:n.containerWidth,containerHeight:n.containerHeight,areInsidesReadyToBeVisible:n.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleRequestThumbn
3893ail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:n.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop,disableInformer:this.opts.disableInformer,disableStatusBar:this.opts.disableStatusBar,hideProgressDetails:this.opts.hideProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideProgressAfterFinish:this.opts.hideProgressAfterFinish,doneButtonHandler:this.opts.doneButtonHandler})});Wt(this,SN,()=>{const{plugins:i}=this.opts;i.forEach(n=>{const o=this.uppy.getPlugin(n);o?o.mount(this,o):this.uppy.log(`[Uppy] Dashboard could not find plugin '${n}', make sure to uppy.use() the plugins you are specifying`,"warning")})});Wt(this,TN,()=>{this.uppy.iteratePlugins(he(this,rb))});Wt(this,rb,i=>{var o;const n=["acquirer","editor"];i&&!((o=i.opts)!=null&&o.target)&&n.includes(i.type)&&(this.getPluginState().targets.some(f=>i.id===f.id)||i.mount(this,i))});je(this,"install",()=>{var x;this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});const{inline:i,closeAfterFinish:n}=this.opts;if(i&&n)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");const{allowMultipleUploads:o,allowMultipleUploadBatches:c}=this.uppy.opts;(o||c)&&n&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");const{target:f}=this.opts;f&&this.mount(f,this),this.opts.disableThumbnailGenerator||this.uppy.use(Ole,{id:ci(this,Ig,NF).call(this),...ci(this,Ig,PF).call(this)}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;const r=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;this.uppy.log(`[Dashboard] Dark mode is ${r?"on":"off"}`),this.setDarkModeCapability(r),this.opts.theme==="auto"&&((x=this.darkModeMediaQuery)==null||x.addListener(this.handleSystemDarkModeChange)),he(this,SN).call(this),he(this,TN).call(this),this.initEvents()});je(this,"uninstall",()=>{var n;if(!this.opts.disableThumbnailGenerator){const o=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);o&&this.uppy.removePlugin(o)}const{plugins:i}=this.opts;i.forEach(o=>{const c=this.uppy.getPlugin(o);c&&c.unmount()}),this.opts.theme==="auto"&&((n=this.darkModeMediaQuery)==null||n.removeListener(this.handleSystemDarkModeChange)),this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()});this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=i5e,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(c=this.opts).onRequestCloseModal??(c.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(i){var n;super.setOptions(i),(n=this.uppy.getPlugin(ci(this,Ig,NF).call(this)))==null||n.setOptions(ci(this,Ig,PF).call(this))}},ib=new WeakMap,v_=new WeakMap,qC=new WeakMap,nb=new WeakMap,xN=new WeakMap,bN=new WeakMap,wN=new WeakMap,x_=new WeakMap,SN=new WeakMap,TN=new WeakMap,rb=new WeakMap,Ig=new WeakSet,PF=function(){const{thumbnailWidth:i,thumbnailHeight:n,thumbnailType:o,waitForThumbnailsBeforeUpload:c}=this.opts;return{thumbnailWidth:i,thumbnailHeight:n,thumbnailType:o,waitForThumbnailsBeforeUpload:c,lazy:!c}},NF=function(){return`${this.id}:ThumbnailGenerator`},je(Gz,"VERSION",X4e.version),Gz);const u5e=["defaultChecked","defaultValue","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML","accessKey","className","contentEditable","contextMenu","dir","draggable","hidden","id","lang","placeholder","slot","spell
3893Check","style","tabIndex","title","translate","radioGroup","role","about","datatype","inlist","prefix","property","resource","typeof","vocab","autoCapitalize","autoCorrect","autoSave","color","itemProp","itemScope","itemType","itemID","itemRef","results","security","unselectable","inputMode","is","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],d5e=/^(aria-|data-)/,Zle=t=>Object.fromEntries(Object.entries(t).filter(([e])=>d5e.test(e)||u5e.includes(e)));function h5e(t,e){const i=Zle(t);return Object.keys(t).some(n=>!Object.hasOwn(i,n)&&t[n]!==e[n])}class Xle extends K.Component{constructor(){super(...arguments);je(this,"container");je(this,"plugin")}componentDidMount(){this.installPlugin()}componentDidUpdate(i){const{uppy:n,open:o,onRequestClose:c}=this.props;if(i.uppy!==n)this.uninstallPlugin(i),this.installPlugin();else if(h5e(this.props,i)){const{uppy:f,...r}={...this.props,inline:!1,onRequestCloseModal:c};this.plugin.setOptions(r)}i.open&&!o?this.plugin.closeModal():!i.open&&o&&this.plugin.openModal()}componentWillUnmount(){this.uninstallPlugin()}installPlugin(){const{target:i=this.container,open:n,onRequestClose:o,uppy:c,...f}=this.props,r={id:"DashboardModal",...f,inline:!1,target:i,open:n,onRequestCloseModal:o};c.use(c5e,r),this.plugin=c.getPlugin(r.id),n&&this.plugin.openModal()}uninstallPlugin(i=this.props){const{uppy:n}=i;n.removePlugin(this.plugin)}render(){return K.createElement("div",{className:"uppy-Container",ref:i=>{this.container=i},...Zle(this.props)})}}je(Xle,"defaultProps",{open:void 0,onRequestClose:void 0});var Yle={};function $u(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var p5e=$u;$u.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};$u.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};$u.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var i=this._timeouts.shift();if(i===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),i=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},i),this._options.unref&&this._timer.unref(),!0};$u.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var i=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){i._operationTimeoutCb()},i._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};$u.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};$u.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};$u.prototype.start=$u.prototype.try;$u.prototype.errors=function(){return this._errors};$u.prototype.attempts=function(){return this._attempts};$u.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,i=0,n=0;n<this._errors.length;n++){var o=this._errors[n],c=o.message,f=(t[c]||0)+1;t[c]=f,f>=i&&(e=o,i=f)}return e};(function(t){var e=p5e;t.operation=function(i){var n=t.timeouts(i);return new e(n,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})},t.timeouts=function(i){if(i instanceof Array)return[].concat(i);var n={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var o in i)n[o]=i[o];if(n.minTimeout>n.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var c=[],f=0;f<n.retries;f++)c.push(this.createTimeout(f,n));return i&&i.forever&&!c.length&&c.push(this.createTimeout(f,n)),c.sort(function(r,x){return r-x}),c},t.createTimeout=function(i,n){var o=n.randomize?Math.random()+1:1,c=Math.round(o*Math.max(n.minTimeout,1)*Math.pow(n.factor,i));return c=Math.min(c,n.maxTimeout),c},t.wrap=function(i,n,o){if(n instanceof Array&&(o=n,n=null),!o){o=[];for(var c in i)typeof i[c]=="function"&&o.push(c)}for(var f=0;f<o.length;f++){var r=o[f],x=i[r];i[r]=(function(C){var I=t.operation(n),N=Array.prototype.slice.call(arguments,1
3893),D=N.pop();N.push(function(V){I.retry(V)||(V&&(arguments[0]=I.mainError()),D.apply(this,arguments))}),I.attempt(function(){C.apply(i,N)})}).bind(i,x),i[r].options=n}}})(Yle);var f5e=Yle;const m5e=Xh(f5e),g5e=Object.prototype.toString,y5e=t=>g5e.call(t)==="[object Error]",_5e=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function v5e(t){if(!(t&&y5e(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;const{message:i,stack:n}=t;return i==="Load failed"?n===void 0||"__sentry_captured__"in t:i.startsWith("error sending request for url")?!0:_5e.has(i)}class MF extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const I7=(t,e,i)=>{const n=i.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t};async function k7(t,e){return new Promise((i,n)=>{e={...e},e.onFailedAttempt??(e.onFailedAttempt=()=>{}),e.shouldRetry??(e.shouldRetry=()=>!0),e.retries??(e.retries=10);const o=m5e.operation(e),c=()=>{var r;o.stop(),n((r=e.signal)==null?void 0:r.reason)};e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",c,{once:!0});const f=()=>{var r;(r=e.signal)==null||r.removeEventListener("abort",c),o.stop()};o.attempt(async r=>{try{const x=await t(r);f(),i(x)}catch(x){try{if(!(x instanceof Error))throw new TypeError(`Non-error was thrown: "${x}". You should only throw errors.`);if(x instanceof MF)throw x.originalError;if(x instanceof TypeError&&!v5e(x))throw x;if(I7(x,r,e),await e.shouldRetry(x)||(o.stop(),n(x)),await e.onFailedAttempt(x),!o.retry(x))throw o.mainError()}catch(S){I7(S,r,e),f(),n(S)}}})})}const x5e="@uppy/companion-client",b5e="Client library for communication with Companion. Intended for use in Uppy plugins.",w5e="5.1.1",S5e="MIT",T5e="module",C5e=!1,E5e={build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},A5e=["file uploader","uppy","uppy-plugin","companion","provider"],I5e="https://uppy.io",k5e={url:"https://github.com/transloadit/uppy/issues"},P5e={type:"git",url:"git+https://github.com/transloadit/uppy.git"},N5e=["src","lib","dist","CHANGELOG.md"],M5e={".":"./lib/index.js","./package.json":"./package.json"},D5e={"@uppy/utils":"^7.1.1","namespace-emitter":"^2.0.1","p-retry":"^6.1.0"},R5e={jsdom:"^26.1.0",typescript:"^5.8.3",vitest:"^3.2.4"},j5e={"@uppy/core":"^5.1.1"},z5e={name:x5e,description:b5e,version:w5e,license:S5e,type:T5e,sideEffects:C5e,scripts:E5e,keywords:A5e,homepage:I5e,bugs:k5e,repository:P5e,files:N5e,exports:M5e,dependencies:D5e,devDependencies:R5e,peerDependencies:j5e};class L5e extends Error{constructor(){super("Authorization required");je(this,"isAuthError");this.name="AuthError",this.isAuthError=!0}}function O5e(t){return t.replace(/\/$/,"")}const P7=10,F5e=5*60*1e3,B5e=401;class U5e extends Error{constructor({statusCode:i,message:n}){super(n);je(this,"statusCode");this.name="HttpError",this.statusCode=i}}async function V5e(t){if(t.status===B5e)throw new L5e;if(t.ok)return t.json();let e=`Failed request with status: ${t.status}. ${t.statusText}`,i;try{i=await t.json(),i.message&&(e=`${e} message: ${i.message}`),i.requestId&&(e=`${e} request-Id: ${i.requestId}`)}catch(n){throw new Error(e,{cause:n})}throw t.status>=400&&t.status<=499&&i.message?new AOe(i.message):new U5e({statusCode:t.status,message:e})}function $5e(t,e,i){const{progress:n,bytesUploaded:o,bytesTotal:c}=e;n&&(t.uppy.log(`Upload progress: ${n}`),t.uppy.emit("upload-progress",i,{uploadStarted:i.progress.uploadStarted??0,bytesUploaded:o,bytesTotal:c}))}var b_,kg,DF,CN,RF;class Qle{constructor(e,i){Wt(this,kg);Wt(this,b_);je(this,"uppy");je(this,"opts");Wt(this,CN,async({file:e,postBody:i,signal:n})=>{var c;if(((c=e.remote)==null?void 0:c.url)==null)throw new Error("Cannot connect to an undefined URL");return(await this.post(e.remote.url,{...e.remote.body,...i},{signal:n})).token});
3893this.uppy=e,this.opts=i,this.onReceiveResponse=this.onReceiveResponse.bind(this),Jt(this,b_,i.companionHeaders)}setCompanionHeaders(e){Jt(this,b_,e)}[Symbol.for("uppy test: getCompanionHeaders")](){return he(this,b_)}get hostname(){const{companion:e}=this.uppy.getState(),i=this.opts.companionUrl;return O5e(e!=null&&e[i]?e[i]:i)}async headers(e=!1){return{...{Accept:"application/json",...e?void 0:{"Content-Type":"application/json"}},...he(this,b_)}}onReceiveResponse(e){const{headers:i}=e,o=this.uppy.getState().companion||{},c=this.opts.companionUrl;i.has("i-am")&&i.get("i-am")!==o[c]&&this.uppy.setState({companion:{...o,[c]:i.get("i-am")}})}async request({path:e,method:i="GET",data:n,skipPostResponse:o,signal:c}){try{const f=await this.headers(!n),r=await aOe(ci(this,kg,DF).call(this,e),{method:i,signal:c,headers:f,credentials:this.opts.companionCookiesRule||"same-origin",body:n?JSON.stringify(n):null});return o||this.onReceiveResponse(r),await V5e(r)}catch(f){throw f.isAuthError||f.name==="UserFacingApiError"||f.name==="AbortError"?f:new sOe(`Could not ${i} ${ci(this,kg,DF).call(this,e)}`,{cause:f})}}async get(e,i){return this.request({...i,path:e})}async post(e,i,n){return this.request({...n,path:e,method:"POST",data:i})}async delete(e,i,n){return this.request({...n,path:e,method:"DELETE",data:i})}async uploadRemoteFile(e,i,n){try{const{signal:o,getQueue:c}=n||{};return await k7(async()=>{var S;const f=(S=this.uppy.getFile(e.id))==null?void 0:S.serverToken;
3893if(f!=null)return this.uppy.log(`Connecting to exiting websocket ${f}`),ci(this,kg,RF).call(this,{file:e,queue:c(),signal:o});const x=await c().wrapPromiseFunction(async(...C)=>{try{return await he(this,CN).call(this,...C)}catch(I){if(I.isAuthError)throw new MF(I);if(I.cause==null)throw I;const N=I.cause,D=()=>[408,409,429,418,423].includes(N.statusCode)||N.statusCode>=500&&N.statusCode<=599&&![501,505].includes(N.statusCode);throw N.name==="HttpError"&&!D()?new MF(N):N}},{priority:-1})({file:e,postBody:i,signal:o}).abortOn(o);if(this.uppy.getFile(e.id))return this.uppy.setFileState(e.id,{serverToken:x}),ci(this,kg,RF).call(this,{file:this.uppy.getFile(e.id),queue:c(),signal:o})},{retries:P7,signal:o,onFailedAttempt:f=>this.uppy.log(`Retrying upload due to: ${f.message}`,"warning")})}catch(o){if(o.name==="AbortError")return;throw this.uppy.emit("upload-error",e,o),o}}}b_=new WeakMap,kg=new WeakSet,DF=function(e){return/^(https?:|)\/\//.test(e)?e:`${this.hostname}/${e}`},CN=new WeakMap,RF=async function({file:e,queue:i,signal:n}){let o;const{capabilities:c}=this.uppy.getState();try{return await new Promise((f,r)=>{const x=e.serverToken,S=_Oe(e.remote.companionUrl);let C,I,N,{isPaused:D}=e;const V=(we,Ne)=>{if(C==null||C.readyState!==C.OPEN){this.uppy.log(`Cannot send "${we}" to socket ${e.id} because the socket state was ${String(C==null?void 0:C.readyState)}`,"warning");return}C.send(JSON.stringify({action:we,payload:Ne??{}}))};function B(){c.resumableUploads&&V(D?"pause":"resume")}const W=async()=>{I&&I.abort(),I=new AbortController;const we=pe=>{var Pe;this.uppy.setFileState(e.id,{serverToken:null}),(Pe=I==null?void 0:I.abort)==null||Pe.call(I),r(pe)};function Ne(){clearTimeout(N),!D&&(N=setTimeout(()=>we(new Error("Timeout waiting for message from Companion socket")),F5e))}try{await i.wrapPromiseFunction(async()=>{await k7(async()=>new Promise((Pe,De)=>{C=new WebSocket(`${S}/api/${x}`),Ne(),C.addEventListener("close",()=>{C=void 0,De(new Error("Socket closed unexpectedly"))}),C.addEventListener("error",dt=>{this.uppy.log(`Companion socket error ${JSON.stringify(dt)}, closing socket`,"warning"),C==null||C.close()}),C.addEventListener("open",()=>{B()}),C.addEventListener("message",dt=>{var At,qt,kt;Ne();try{const{action:Vt,payload:Fe}=JSON.parse(dt.data);switch(Vt){case"progress":{$5e(this,Fe,this.uppy.getFile(e.id));break}case"success":{const lt=(At=Fe.response)==null?void 0:At.responseText;this.uppy.emit("upload-success",this.uppy.getFile(e.id),{uploadURL:Fe.url,status:((qt=Fe.response)==null?void 0:qt.status)??200,body:lt?JSON.parse(lt):void 0}),(kt=I==null?void 0:I.abort)==null||kt.call(I),f();break}case"error":{const{message:lt}=Fe.error;throw Object.assign(new Error(lt),{cause:Fe.error})}default:this.uppy.log(`Companion socket unknown action ${Vt}`,"warning")}}catch(Vt){we(Vt)}});const Je=()=>{this.uppy.log(`Closing socket ${e.id}`),clearTimeout(N),C&&C.close(),C=void 0};I.signal.addEventListener("abort",()=>{Je()})}),{retries:P7,signal:I.signal,onFailedAttempt:()=>{I.signal.aborted||this.uppy.log(`Retrying websocket ${e.id}`)}})})().abortOn(I.signal)}catch(pe){if(I.signal.aborted)return;we(pe)}},$=we=>{c.resumableUploads&&(D=we,C&&B())},G=we=>{var Ne;c.individualCancellation&&we.id===e.id&&(V("cancel"),(Ne=I==null?void 0:I.abort)==null||Ne.call(I),this.uppy.log(`upload ${e.id} was removed`),f())},te=()=>{var we;V("cancel"),(we=I==null?void 0:I.abort)==null||we.call(I),this.uppy.log(`upload ${e.id} was canceled`),f()},ce=(we,Ne)=>{(we==null?void 0:we.id)===e.id&&$(Ne)},_e=()=>$(!0),Te=()=>$(!1);this.uppy.on("file-removed",G),this.uppy.on("cancel-all",te),this.uppy.on("upload-pause",ce),this.uppy.on("pause-all",_e),this.uppy.on("resume-all",Te),o=()=>{this.uppy.off("file-removed",G),this.uppy.off("cancel-all",te),this.uppy.off("upload-pause",ce),this.uppy.off("pause-all",_e),this.uppy.off("resume-all",Te)},n.addEventListener("abort",()=>{I==null||I.abort()}),W()})}finally{o==null||o()}},je(Qle,"VERSION",z5e.version);const q5e="@uppy/aws-s3",H5e="Upload to Amazon S3 with Uppy",G5e="5.0.2",W5e="MIT",K5e="module",Z5e=!1,X5e={build:"tsc --build tsconfig.build.json",typecheck:"tsc --build",test:"vitest run --environment=jsdom --silent='passed-only'"},Y5e=["file uploader","aws s3","amazon s3","s3","uppy","uppy-plugin","multipart"],Q5e="https://uppy.io",J5e={url:"https://github.com/transloadit/uppy/issues"},eUe={type:"git",url:"git+https://github.com/transloadit/uppy.git"},tUe=["src","lib","dist","CHANGELOG.md"],iUe={".":"./lib/index.js","./package.json":"./package.json"},nUe={"@uppy/companion-client":"^5.1.1","@uppy/utils":"^7.1.1"},rUe={"@aws-sdk/client-s3":"^3.362.0","@aws-sdk/s3-request-presigner":"^3.362.0","@uppy/core":"^5.1.1",jsdom:"^26.1.0",nock:"^13.1.0",typescript:"^5.8.3",vitest:"^3.2.4","whatwg-fetch":"3.6.2"},sUe={"@uppy/core":"^5.1.1"},oUe={name:q5e,description:H5e,version:G5e,license:W5e,type:K5e,sideEffects:Z5e,scripts:X5e,keywords:Y5e,homepage:Q5e,bugs:J5e,repository:eUe,files:tUe,exports:iUe,depen
3893dencies:nUe,devDependencies:rUe,peerDependencies:sUe};function aUe({method:t="PUT",CanonicalUri:e="/",CanonicalQueryString:i="",SignedHeaders:n,HashedPayload:o}){const c=Object.keys(n).map(f=>f.toLowerCase()).sort();return[t,e,i,...c.map(f=>`${f}:${n[f]}`),"",c.join(";"),o].join(` 3894`)}const GB=new TextEncoder,WB={name:"HMAC",hash:"SHA-256"};async function lUe(t){const{subtle:e}=globalThis.crypto;return e.digest(WB.hash,GB.encode(t))}async function cUe(t){const{subtle:e}=globalThis.crypto;return e.importKey("raw",typeof t=="string"?GB.encode(t):t,WB,!1,["sign"])}function N7(t){const e=new Uint8Array(t);let i="";for(let n=0;n<e.length;n++)i+=e[n].toString(16).padStart(2,"0");return i}async function zS(t,e){const{subtle:i}=globalThis.crypto;return i.sign(WB,await cUe(t),GB.encode(e))}async function uUe({accountKey:t,accountSecret:e,sessionToken:i,bucketName:n,Key:o,Region:c,expires:f,uploadId:r,partNumber:x}){const S="s3",C=`${S}.${c}.amazonaws.com`,I=`/${n}/${encodeURI(o).replace(/[;?:@&=+$,#!'()*]/g,pe=>`%${pe.charCodeAt(0).toString(16).toUpperCase()}`)}`,N="UNSIGNED-PAYLOAD",D=new Date().toISOString().replace(/[-:]|\.\d+/g,""),V=D.slice(0,8),B=`${V}/${c}/${S}/aws4_request`,W=new URL(`https://${C}${I}`);W.searchParams.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),W.searchParams.set("X-Amz-Content-Sha256",N),W.searchParams.set("X-Amz-Credential",`${t}/${B}`),W.searchParams.set("X-Amz-Date",D),W.searchParams.set("X-Amz-Expires",f),W.searchParams.set("X-Amz-Security-Token",i),W.searchParams.set("X-Amz-SignedHeaders","host"),x&&W.searchParams.set("partNumber",x),r&&W.searchParams.set("uploadId",r),W.searchParams.set("x-id",x&&r?"UploadPart":"PutObject");const $=aUe({CanonicalUri:I,CanonicalQueryString:W.search.slice(1),SignedHeaders:{host:C},HashedPayload:N}),G=N7(await lUe($)),te=["AWS4-HMAC-SHA256",D,B,G].join(` 3895`),ce=await zS(`AWS4${e}`,V),_e=await zS(ce,c),Te=await zS(_e,S),we=await zS(Te,"aws4_request"),Ne=N7(await zS(we,te));return W.searchParams.set("X-Amz-Signature",Ne),W}const dUe=1024*1024,M7={getChunkSize(t){return Math.ceil(t.size/1e4)},onProgress(){},onPartComplete(){},onSuccess(){},onError(t){throw t}};function hUe(t){if(typeof t=="string")return parseInt(t,10);if(typeof t=="number")return t;throw new TypeError("Expected a number")}const ak=Symbol("pausing upload, not an actual error");var gd,Cu,Ph,$p,qp,HC,GC,sb,w_,ob,WC,ab,KC,$d,Jle,ece,jF,ZC,XC,tce;class pUe{constructor(e,i){Wt(this,$d);je(this,"options");Wt(this,gd,new Ez);Wt(this,Cu,[]);Wt(this,Ph,[]);Wt(this,$p);Wt(this,qp);Wt(this,HC,!1);Wt(this,GC);Wt(this,sb);Wt(this,w_);Wt(this,ob);Wt(this,WC,e=>(e==null?void 0:e.cause)===ak?null:he(this,GC).call(this,e));Wt(this,ab,1e4);Wt(this,KC,5*dUe);Wt(this,ZC,e=>i=>{if(!i.lengthComputable)return;he(this,Ph)[e].uploaded=hUe(i.loaded);const n=he(this,Ph).reduce((o,c)=>o+c.uploaded,0);this.options.onProgress(n,he(this,$p).size)});Wt(this,XC,e=>i=>{he(this,Cu)[e]=null,he(this,Ph)[e].etag=i,he(this,Ph)[e].done=!0;const n={PartNumber:e+1,ETag:i};this.options.onPartComplete(n)});var n;this.options={...M7,...i},(n=this.options).getChunkSize??(n.getChunkSize=M7.getChunkSize),Jt(this,$p,e),Jt(this,qp,i.file),Jt(this,sb,this.options.onSuccess),Jt(this,GC,this.options.onError),Jt(this,w_,this.options.shouldUseMultipart),Jt(this,ob,i.uploadId&&i.key),ci(this,$d,Jle).call(this)}start(){he(this,HC)?(he(this,gd).signal.aborted||he(this,gd).abort(ak),Jt(this,gd,new Ez),ci(this,$d,jF).call(this)):he(this,ob)?(this.options.companionComm.restoreUploadFile(he(this,qp),{uploadId:this.options.uploadId,key:this.options.key}),ci(this,$d,jF).call(this)):ci(this,$d,ece).call(this)}pause(){he(this,gd).abort(ak),Jt(this,gd,new Ez)}abort(e){e!=null&&e.really?ci(this,$d,tce).call(this):this.pause()}[Symbol.for("uppy test: getChunkState")](){return he(this,Ph)}}gd=new WeakMap,Cu=new WeakMap,Ph=new WeakMap,$p=new WeakMap,qp=new WeakMap,HC=new WeakMap,GC=new WeakMap,sb=new WeakMap,w_=new WeakMap,ob=new WeakMap,WC=new WeakMap,ab=new WeakMap,KC=new WeakMap,$d=new WeakSet,Jle=function(){const e=he(this,$p).size,i=typeof he(this,w_)=="function"?he(this,w_).call(this,he(this,qp)):!!he(this,w_);if(i&&e>he(this,KC)){let n=Math.max(this.options.getChunkSize(he(this,$p)),he(this,KC)),o=Math.floor(e/n);o>he(this,ab)&&(o=he(this,ab),n=e/he(this,ab)),Jt(this,Cu,Array(o));for(let c=0,f=0;c<e;c+=n,f++){const r=Math.min(e,c+n),x=()=>{const S=c;return he(this,$p).slice(S,r)};if(he(this,Cu)[f]={getData:x,onProgress:he(this,ZC).call(this,f),onComplete:he(this,XC).call(this,f),shouldUseMultipart:i},he(this,ob)){const S=c+n>e?e-c:n;he(this,Cu)[f].setAsUploaded=()=>{he(this,Cu)[f]=null,he(this,Ph)[f].uploaded=S}}}}else Jt(this,Cu,[{getData:()=>he(this,$p),onProgress:he(this,ZC).call(this,0),onComplete:he(this,XC).call(this,0),shouldUseMultipart:i}]);Jt(this,Ph,he(this,Cu).map(()=>({uploaded:0})))},ece=function(){this.options.companionComm.uploadFile(he(this,qp),he(this,Cu),he(this,gd).signal).then(
3895he(this,sb),he(this,WC)),Jt(this,HC,!0)},jF=function(){this.options.companionComm.resumeUploadFile(he(this,qp),he(this,Cu),he(this,gd).signal).then(he(this,sb),he(this,WC))},ZC=new WeakMap,XC=new WeakMap,tce=function(){he(this,gd).abort(),this.options.companionComm.abortFileUpload(he(this,qp)).catch(e=>this.options.log(e))};function Sl(t){if(t!=null&&t.aborted)throw Uae("The operation was aborted",{cause:t.reason})}function fUe(t){const e=new URL(t);return e.search="",e.hash="",e.href}var YC,yd,QC,JC,eE,tE,lb,cb,ub,db,S_,hb,_d,nv,ice,zF;class mUe{constructor(e,i,n,o){Wt(this,nv);Wt(this,YC);Wt(this,yd,new WeakMap);Wt(this,QC);Wt(this,JC);Wt(this,eE);Wt(this,tE);Wt(this,lb);Wt(this,cb);Wt(this,ub);Wt(this,db);Wt(this,S_);Wt(this,hb);Wt(this,_d);Jt(this,cb,e),Jt(this,S_,n),Jt(this,_d,o),this.setOptions(i)}setOptions(e){const i=he(this,cb);"abortMultipartUpload"in e&&Jt(this,YC,i.wrapPromiseFunction(e.abortMultipartUpload,{priority:1})),"createMultipartUpload"in e&&Jt(this,QC,i.wrapPromiseFunction(e.createMultipartUpload,{priority:-1})),"signPart"in e&&Jt(this,JC,i.wrapPromiseFunction(e.signPart)),"listParts"in e&&Jt(this,tE,i.wrapPromiseFunction(e.listParts)),"completeMultipartUpload"in e&&Jt(this,db,i.wrapPromiseFunction(e.completeMultipartUpload,{priority:1})),"retryDelays"in e&&Jt(this,ub,e.retryDelays??[]),"uploadPartBytes"in e&&Jt(this,hb,i.wrapPromiseFunction(e.uploadPartBytes,{priority:1/0})),"getUploadParameters"in e&&Jt(this,eE,i.wrapPromiseFunction(e.getUploadParameters))}async getUploadId(e,i){let n;for(;;){if(e.data==null)throw new Error("File data is empty");if(n=he(this,yd).get(e.data),n==null)break;try{return await n}catch{}}const o=he(this,QC).call(this,he(this,_d).call(this,e),i),c=()=>{if(e.data==null)throw new Error("File data is empty");o.abort(i.reason),he(this,yd).delete(e.data)};return i.addEventListener("abort",c,{once:!0}),he(this,yd).set(e.data,o),o.then(async f=>{if(i.removeEventListener("abort",c),he(this,S_).call(this,e,f),e.data==null)throw new Error("File data is empty");he(this,yd).set(e.data,f)},()=>{if(i.removeEventListener("abort",c),e.data==null)throw new Error("File data is empty");he(this,yd).delete(e.data)}),o}async abortFileUpload(e){if(e.data==null)throw new Error("File data is empty");const i=he(this,yd).get(e.data);if(i==null)return;he(this,yd).delete(e.data),he(this,S_).call(this,e,Object.create(null));let n;try{n=await i}catch{return}await he(this,YC).call(this,he(this,_d).call(this,e),n)}async uploadFile(e,i,n){if(Sl(n),i.length===1&&!i[0].shouldUseMultipart)return ci(this,nv,zF).call(this,e,i[0],n);const{uploadId:o,key:c}=await this.getUploadId(e,n);Sl(n);try{const f=await Promise.all(i.map((r,x)=>this.uploadChunk(e,x+1,r,n)));return Sl(n),await he(this,db).call(this,he(this,_d).call(this,e),{key:c,uploadId:o,parts:f,signal:n},n).abortOn(n)}catch(f){throw(f==null?void 0:f.cause)!==ak&&(f==null?void 0:f.name)!=="AbortError"&&this.abortFileUpload(e),f}}restoreUploadFile(e,i){if(e.data==null)throw new Error("File data is empty");he(this,yd).set(e.data,i)}async resumeUploadFile(e,i,n){if(Sl(n),i.length===1&&i[0]!=null&&!i[0].shouldUseMultipart)return ci(this,nv,zF).call(this,e,i[0],n);const{uploadId:o,key:c}=await this.getUploadId(e,n);Sl(n);const f=await he(this,tE).call(this,he(this,_d).call(this,e),{uploadId:o,key:c,signal:n},n).abortOn(n);Sl(n);const r=await Promise.all(i.map((x,S)=>{var N;const C=S+1,I=f.find(({PartNumber:D})=>D===C);return I==null?this.uploadChunk(e,C,x,n):((N=x==null?void 0:x.setAsUploaded)==null||N.call(x),{PartNumber:C,ETag:I.ETag})}));return Sl(n),he(this,db).call(this,he(this,_d).call(this,e),{key:c,uploadId:o,parts:r,signal:n},n).abortOn(n)}async uploadChunk(e,i,n,o){Sl(o);const{uploadId:c,key:f}=await this.getUploadId(e,o),r=he(this,ub).values(),x=he(this,ub).values(),S=()=>{const C=r.next();return C==null||C.done?null:C.value};for(;;){Sl(o);const C=n.getData(),{onProgress:I,onComplete:N}=n;let D;try{D=await he(this,JC).call(this,he(this,_d).call(this,e),{uploadId:c,key:f,partNumber:i,body:C,signal:o}).abortOn(o)}catch(V){const B=S();if(B==null||o.aborted)throw V;await new Promise(W=>setTimeout(W,B));continue}Sl(o);try{return{PartNumber:i,...await he(this,hb).call(this,{signature:D,body:C,size:C.size,onProgress:I,onComplete:N,signal:o}).abortOn(o)}}catch(V){if(!await ci(this,nv,ice).call(this,V,x))throw V}}}}YC=new WeakMap,yd=new WeakMap,QC=new WeakMap,JC=new WeakMap,eE=new WeakMap,tE=new WeakMap,lb=new WeakMap,cb=ne
3895w WeakMap,ub=new WeakMap,db=new WeakMap,S_=new WeakMap,hb=new WeakMap,_d=new WeakMap,nv=new WeakSet,ice=async function(e,i){var c;const n=he(this,cb),o=(c=e==null?void 0:e.source)==null?void 0:c.status;if(o==null)return!1;if(o===403&&e.message==="Request has expired"){if(!n.isPaused){if(n.limit===1||he(this,lb)==null){const f=i.next();if(f==null||f.done)return!1;Jt(this,lb,f.value)}n.rateLimit(0),await new Promise(f=>setTimeout(f,he(this,lb)))}}else if(o===429){if(!n.isPaused){const f=i.next();if(f==null||f.done)return!1;n.rateLimit(f.value)}}else{if(o>400&&o<500&&o!==409)return!1;if(typeof navigator<"u"&&navigator.onLine===!1)n.isPaused||(n.pause(),window.addEventListener("online",()=>{n.resume()},{once:!0}));else{const f=i.next();if(f==null||f.done)return!1;await new Promise(r=>setTimeout(r,f.value))}}return!0},zF=async function(e,i,n){const{method:o="POST",url:c,fields:f,headers:r}=await he(this,eE).call(this,he(this,_d).call(this,e),{signal:n}).abortOn(n);let x;const S=i.getData();if(o.toUpperCase()==="POST"){const V=new FormData;Object.entries(f).forEach(([B,W])=>V.set(B,W)),V.set("file",S),x=V}else x=S;const{onProgress:C,onComplete:I}=i,N=await he(this,hb).call(this,{signature:{url:c,headers:r,method:o},body:x,size:S.size,onProgress:C,onComplete:I,signal:n}).abortOn(n),D=f==null?void 0:f.key;return he(this,S_).call(this,e,{key:D}),{...N,location:N.location??fUe(c),bucket:f==null?void 0:f.bucket,key:D}};function Xx(t){if(t!=null&&t.error){const e=new Error(t.message);throw Object.assign(e,t.error),e}return t}function D7(t){const e=t.Expiration;if(e){const i=Math.floor((new Date(e)-Date.now())/1e3);if(i>9)return i}}function R7({meta:t,allowedMetaFields:e,querify:i=!1}){const n=e??Object.keys(t);return t?Object.fromEntries(n.filter(o=>t[o]!=null).map(o=>{const c=i?`metadata[${o}]`:o,f=String(t[o]);return[c,f]})):{}}const gUe={allowedMetaFields:!0,limit:6,getTemporarySecurityCredentials:!1,shouldUseMultipart:t=>(t.size||0)>100*1024*1024,retryDelays:[0,1e3,3e3,5e3]};var pb,Ql,ba,OF,ym,vd,nce,EN,fb,rce,sce,iE,mb,T_,nE;const AN=class AN extends mle{constructor(i,n){super(i,{...gUe,uploadPartBytes:AN.uploadPartBytes,createMultipartUpload:null,listParts:null,abortMultipartUpload:null,completeMultipartUpload:null,signPart:null,getUploadParameters:null,...n});Wt(this,ba);Wt(this,pb);Wt(this,Ql);je(this,"requests");je(this,"uploaderEvents");je(this,"uploaders");Wt(this,vd);Wt(this,EN,(i,{key:n,uploadId:o})=>{const c=this.uppy.getFile(i.id);c!=null&&this.uppy.setFileState(i.id,{s3Multipart:{...c.s3Multipart,ke
3895y:n,uploadId:o}})});Wt(this,fb,i=>this.uppy.getFile(i.id)||i);Wt(this,iE,async i=>{if(i.length===0)return;const n=this.uppy.getFilesByIds(i),o=lOe(n),c=cOe(o);this.uppy.emit("upload-start",c);const f=o.map(x=>{if(x.isRemote){const S=()=>this.requests;he(this,T_).call(this,!1);const C=new AbortController,I=D=>{D.id===x.id&&C.abort()};this.uppy.on("file-removed",I);const N=this.uppy.getRequestClientForFile(x).uploadRemoteFile(x,ci(this,ba,sce).call(this,x),{signal:C.signal,getQueue:S});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",I)},{priority:-1})(),N}return ci(this,ba,rce).call(this,x)}),r=await Promise.allSettled(f);return he(this,T_).call(this,!0),r});Wt(this,mb,()=>{var i;(i=he(this,Ql))==null||i.setCompanionHeaders(this.opts.headers)});Wt(this,T_,i=>{const{capabilities:n}=this.uppy.getState();this.uppy.setState({capabilities:{...n,resumableUploads:i}})});Wt(this,nE,()=>{he(this,T_).call(this,!0)});this.type="uploader",this.id=this.opts.id||"AwsS3Multipart",ci(this,ba,OF).call(this,n);const o={createMultipartUpload:this.createMultipartUpload,listParts:this.listParts,abortMultipartUpload:this.abortMultipartUpload,completeMultipartUpload:this.completeMultipartUpload,signPart:n!=null&&n.getTemporarySecurityCredentials?this.createSignedURL:this.signPart,getUploadParameters:n!=null&&n.getTemporarySecurityCredentials?this.createSignedURL:this.getUploadParameters};for(const c of Object.keys(o))this.opts[c]==null&&(this.opts[c]=o[c].bind(this));this.requests=this.opts.rateLimitedQueue??new TOe(this.opts.limit),Jt(this,pb,new mUe(this.requests,this.opts,he(this,EN),he(this,fb))),this.uploaders=Object.create(null),this.uploaderEvents=Object.create(null)}[Symbol.for("uppy test: getClient")](){return he(this,Ql)}setOptions(i){he(this,pb).setOptions(i),super.setOptions(i),ci(this,ba,OF).call(this,i)}resetUploaderReferences(i,n){this.uploaders[i]&&(this.uploaders[i].abort({really:(n==null?void 0:n.abort)||!1}),this.uploaders[i]=null),this.uploaderEvents[i]&&(this.uploaderEvents[i].remove(),this.uploaderEvents[i]=null)}createMultipartUpload(i,n){ci(this,ba,ym).call(this,"createMultipartUpload"),Sl(n);const o=zG(this.opts.allowedMetaFields,i.meta),c=R7({meta:i.meta,allowedMetaFields:o});return he(this,Ql).post("s3/multipart",{filename:i.name,type:i.type,metadata:c},{signal:n}).then(Xx)}listParts(i,{key:n,uploadId:o,signal:c},f){c??(c=f),ci(this,ba,ym).call(this,"listParts"),Sl(c);const r=encodeURIComponent(n);return he(this,Ql).get(`s3/multipart/${encodeURIComponent(o)}?key=${r}`,{signal:c}).then(Xx)}completeMultipartUpload(i,{key:n,uploadId:o,parts:c,signal:f},r){f??(f=r),ci(this,ba,ym).call(this,"completeMultipartUpload"),Sl(f);const x=encodeURIComponent(n),S=encodeURIComponent(o);return he(this,Ql).post(`s3/multipart/${S}/complete?key=${x}`,{parts:c.map(({ETag:C,PartNumber:I})=>({ETag:C,PartNumber:I}))},{signal:f}).then(Xx)}async createSignedURL(i,n){const o=await ci(this,ba,nce).call(this,n),c=D7(o.credentials)||604800,{uploadId:f,key:r,partNumber:x}=n;return{method:"PUT",expires:c,fields:{},url:`${await uUe({accountKey:o.credentials.AccessKeyId,accountSecret:o.credentials.SecretAccessKey,sessionToken:o.credentials.SessionToken,expires:c,bucketName:o.bucket,Region:o.region,Key:r??`${crypto.randomUUID()}-${i.name}`,uploadId:f,partNumber:x})}`,headers:{"Content-Type":i.type}}}signPart(i,{uploadId:n,key:o,partNumber:c,signal:f}){if(ci(this,ba,ym).call(this,"signPart"),Sl(f),n==null||o==null||c==null)throw new Error("Cannot sign without a key, an uploadId, and a partNumber");const r=encodeURIComponent(o);return he(this,Ql).get(`s3/multipart/${encodeURIComponent(n)}/${c}?key=${r}`,{signal:f}).then(Xx)}abortMultipartUpload(i,{key:n,uploadId:o,signal:c}){ci(this,ba,ym).call(this,"abortMultipartUpload");const f=encodeURIComponent(n),r=encodeURIComponent(o);return he(this,Ql).delete(`s3/multipart/${r}?key=${f}`,void 0,{signal:c}).then(Xx)}getUploadParameters(i,n){ci(this,ba,ym).call(this,"getUploadParameters");const{meta:o}=i,{type:c,name:f}=o,r=zG(this.opts.allowedMetaFields,i.meta),x=R7({meta:o,allowedMetaFields:r,querify:!0}),S=new URLSearchParams({filename:f,type:c,...x});return he(this,Ql).get(`s3/params?${S}`,n)}static async uploadPartBytes({signature:{url:i,expires:n,headers:o,method:c="PUT"},body:f,size:r=f.size,onProgress:x,onComplete:S,signal:C}){if(Sl(C),i==null)throw new Error("Cannot upload to an undefined URL");return new Promise((I,N)=>{const D=new XMLHttpRequest;
3895D.open(c,i,!0),o&&Object.keys(o).forEach(W=>{D.setRequestHeader(W,o[W])}),D.responseType="text",typeof n=="number"&&(D.timeout=n*1e3);function V(){D.abort()}function B(){C==null||C.removeEventListener("abort",V)}C==null||C.addEventListener("abort",V),D.upload.addEventListener("progress",W=>{x(W)}),D.addEventListener("abort",()=>{B(),N(Uae())}),D.addEventListener("timeout",()=>{B();const W=new Error("Request has expired");W.source={status:403},N(W)}),D.addEventListener("load",()=>{if(B(),D.status===403&&D.responseText.includes("<Message>Request has expired</Message>")){const ce=new Error("Request has expired");ce.source=D,N(ce);return}if(D.status<200||D.status>=300){const ce=new Error("Non 2xx");ce.source=D,N(ce);return}x==null||x({loaded:r,lengthComputable:!0});const W=D.getAllResponseHeaders().trim().split(/[\r\n]+/),$={__proto__:null};for(const ce of W){const _e=ce.split(": "),Te=_e.shift(),we=_e.join(": ");$[Te]=we}const{etag:G,location:te}=$;if(c.toUpperCase()==="POST"&&te==null&&console.error("@uppy/aws-s3: Could not read the Location header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket"),G==null){console.error("@uppy/aws-s3: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. See https://uppy.io/docs/aws-s3/#setting-up-your-s3-bucket");return}S==null||S(G),I({...$,ETag:G})}),D.addEventListener("error",W=>{B();const $=new Error("Unknown error");$.source=W.target,N($)}),D.send(f)})}install(){he(this,T_).call(this,!0),this.uppy.addPreProcessor(he(this,mb)),this.uppy.addUploader(he(this,iE)),this.uppy.on("cancel-all",he(this,nE))}uninstall(){this.uppy.removePreProcessor(he(this,mb)),this.uppy.removeUploader(he(this,iE)),this.uppy.off("cancel-all",he(this,nE))}};pb=new WeakMap,Ql=new WeakMap,ba=new WeakSet,OF=function(i){i==null||!("endpoint"in i||"companionUrl"in i||"headers"in i||"companionHeaders"in i||"cookiesRule"in i||"companionCookiesRule"in i)||("companionUrl"in i&&!("endpoint"in i)&&this.uppy.log("`companionUrl` option has been removed in @uppy/aws-s3, use `endpoint` instead.","warning"),"companionHeaders"in i&&!("headers"in i)&&this.uppy.log("`companionHeaders` option has been removed in @uppy/aws-s3, use `headers` instead.","warning"),"companionCookiesRule"in i&&!("cookiesRule"in i)&&this.uppy.log("`companionCookiesRule` option has been removed in @uppy/aws-s3, use `cookiesRule` instead.","warning"),"endpoint"in i?Jt(this,Ql,new Qle(this.uppy,{pluginId:this.id,provider:"AWS",companionUrl:this.opts.endpoint,companionHeaders:this.opts.headers,companionCookiesRule:this.opts.cookiesRule})):("headers"in i&&he(this,mb).call(this),"cookiesRule"in i&&(he(this,Ql).opts.companionCookiesRule=i.cookiesRule)))},ym=function(i){if(!he(this,Ql))throw new Error(`Expected a \`endpoint\` option containing a URL, or if you are not using Companion, a custom \`${i}\` implementation.`)},vd=new WeakMap,nce=async function(i){if(Sl(i==null?void 0:i.signal),he(this,vd)==null){const{getTemporarySecurityCredentials:n}=this.opts;n===!0?(ci(this,ba,ym).call(this,"getTemporarySecurityCredentials"),Jt(this,vd,he(this,Ql).get("s3/sts",i).then(Xx))):Jt(this,vd,n(i)),Jt(this,vd,await he(this,vd)),setTimeout(()=>{Jt(this,vd,null)},(D7(he(this,vd).credentials)||0)*500)}return he(this,vd)},EN=new WeakMap,fb=new WeakMap,rce=function(i){return new Promise((n,o)=>{const c=(C,I)=>{const N=this.uppy.getFile(i.id);this.uppy.emit("upload-progress",N,{uploadStarted:N.progress.uploadStarted??0,bytesUploaded:C,bytesTotal:I})},f=C=>{this.uppy.log(C),this.uppy.emit("upload-error",i,C),this.resetUploaderReferences(i.id),o(C)},r=C=>{const I={body:{...C},status:200,uploadURL:C.location};this.resetUploaderReferences(i.id),this.uppy.emit("upload-success",he(this,fb).call(this,i),I),C.location&&this.uppy.log(`Download ${i.name} from ${C.location}`),n(void 0)};if(i.data==null)throw new Error("File data is empty");const x=new pUe(i.data,{companionComm:he(this,pb),log:(...C)=>this.uppy.log(...C),getChunkSize:this.opts.getChunkSize?this.opts.getChunkSize.bind(this):void 0,onProgress:c,onError:f,onSuccess:r,onPartComplete:C=>
3895{this.uppy.emit("s3-multipart:part-uploaded",he(this,fb).call(this,i),C)},file:i,shouldUseMultipart:this.opts.shouldUseMultipart,...i.s3Multipart});this.uploaders[i.id]=x;const S=new UOe(this.uppy);this.uploaderEvents[i.id]=S,S.onFileRemove(i.id,C=>{x.abort(),this.resetUploaderReferences(i.id,{abort:!0}),n(`upload ${C} was removed`)}),S.onCancelAll(i.id,()=>{x.abort(),this.resetUploaderReferences(i.id,{abort:!0}),n(`upload ${i.id} was canceled`)}),S.onFilePause(i.id,C=>{C?x.pause():x.start()}),S.onPauseAll(i.id,()=>{x.pause()}),S.onResumeAll(i.id,()=>{x.start()}),x.start()})},sce=function(i){var n;return{..."remote"in i&&((n=i.remote)==null?void 0:n.body),protocol:"s3-multipart",size:i.data.size,metadata:i.meta}},iE=new WeakMap,mb=new WeakMap,T_=new WeakMap,nE=new WeakMap,je(AN,"VERSION",oUe.version);let LF=AN;function MT({maxNumberOfFiles:t=1,maxFileSize:e=10485760,allowedFileTypes:i,onGetUploadParameters:n,onComplete:o,buttonClassName:c,children:f}){const{t:r,i18n:x}=pr(),[S,C]=K.useState(!1),[I,N]=K.useState(null),D=K.useRef(o);if(K.useEffect(()=>{D.current=o},[o]),K.useEffect(()=>{const B=new yF({restrictions:{maxNumberOfFiles:t,maxFileSize:e,allowedFileTypes:i},autoProceed:!1}).use(LF,{shouldUseMultipart:!1,getUploadParameters:n}).on("complete",W=>{var $;($=D.current)==null||$.call(D,W)});return N(B),()=>{B.cancelAll()}},[t,e,i,n]),!I)return null;const V={strings:{browse:r("upload.browse"),dropPasteImportFiles:r("upload.dropPasteFiles"),dropHint:r("upload.dropHint"),uploading:r("upload.uploading"),complete:r("upload.complete"),uploadFailed:r("upload.failed"),cancel:r("common.cancel")}};return d.jsxs(d.Fragment,{children:[d.jsx("style",{children:` 3896 .uppy-Dashboard-browse { 3897 color: hsl(var(--primary)) !important; 3898 font-weight: 600 !important; 3899 text-decoration: underline !important; 3900 cursor: pointer !important; 3901 } 3902 3903 .uppy-Dashboard-browse:hover { 3904 color: hsl(var(--primary) / 0.8) !important; 3905 } 3906 3907 .uppy-Dashboard-AddFiles-title { 3908 font-size: 16px !important; 3909 color: hsl(var(--foreground)) !important; 3910 } 3911 `}),d.jsxs("div",{children:[d.jsx(tt,{type:"button",onClick:()=>C(!0),className:c,"data-testid":"button-upload-trigger",children:f}),d.jsx(Xle,{uppy:I,open:S,onRequestClose:()=>C(!1),proudlyDisplayPoweredByUppy:!1,closeModalOnClickOutside:!0,locale:V})]})]})}function yUe(t){return Xt.object({title:Xt.string().min(5,t("validation.titleMin")).max(200),description:Xt.string().min(20,t("validation.descMin")),categoryId:Xt.string().optional(),serviceType:Xt.enum(["product_service","volunteer_request"]).default("product_service"),priceEuros:Xt.string().optional(),priceCredits:Xt.string().optional(),isRecurring:Xt.boolean().optional(),maxVolunteers:Xt.string().optional(),requiresContact:Xt.boolean().optional(),address:Xt.string().optional(),city:Xt.string().optional(),country:Xt.string().optional(),latitude:Xt.string().optional(),longitude:Xt.string().optional(),isActive:Xt.boolean().optional()})}function j7(){const{t}=pr(),[,e]=uE("/listings/:id/edit"),[,i]=$o(),{isAuthenticated:n,user:o}=Ka();dv();const{toast:c}=ks(),f=e==null?void 0:e.id,r=!!f,[x,S]=K.useState([]),[C,I]=K.useState(""),[N,D]=K.useState(!1),V=K.useCallback(async()=>({method:"PUT",url:(await(await fetch("/api/objects/upload",{method:"POST",credentials:"include"})).json()).uploadURL}),[]),B=K.useCallback(async pt=>{const Ge=[];let Rt=0;for(const Ot of pt.successful||[])if(Ot.uploadURL)try{const Hi=await(await fetch("/api/listing-files",{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({fileURL:Ot.uploadURL})})).json();Hi.objectPath?Ge.push(Hi.objectPath):(console.error("[Upload] Missing objectPath in response:",Hi),Rt++)}catch(Ci){console.error("[Upload] Error confirming image upload:",Ci),Rt++}Ge.length>0&&(S(Ot=>[...Ot,...Ge]),c({title:t("upload.uploadSuccess"),description:t("upload.uploadSuccessDesc",{count:Ge.length})})),Rt>0&&c({title:t("common.error","Errore"),description:t("upload.imageConfirmError",`${Rt} immagine/i non salvata/e correttamente. Riprova.`),variant:"destructive"})},[c,t]),W=K.useCallback(async pt=>{if(pt.successful&&pt.successful.length>0){const Ge=pt.successful[0];if(Ge.uploadURL){const Ot=await(await fetch("/api/listing-files",{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({fileURL:Ge.uploadURL})})).json();Ot.objectPath&&(I(Ot.objectPath),D(!1),c({title:t("upload.uploadSuccess"),description:t("upload.videoUploadSuccess")}))}}},[c,t]),$=K.useMemo(()=>["image/*"],[]),G=K.useMemo(()=>["video/*"],[]),te=K.useMemo(()=>o!=null&&o.isProfessional?10:3,[o==null?void 0:o.isProfessional]),ce=K.useMemo(()=>5*1024*1024,[]),_e=K.useMemo(()=>50*1024*1024,[]);if(!n)return window.location.href="/api/auth/login",null;const{data:Te=[]}=Xn({queryKey:["/api/categories"],staleTime:0,refetchOnMount:"always"}),{data:we,isLoading:Ne}=Xn({queryKey:["/api/listings",f],queryFn:()=>fetch(`/api/listings/${f}`).then(pt=>pt.json()),enabled:r}),pe=zg({resolver:Lg(yUe(t)),defaultValues:{title:"",description:"",categoryId:"",serviceType:"product_service",priceEuros:"",priceCredits:"",isRecurring:!1,maxVolunteers:"",requiresContact:!1,address:"",city:"",country:"",latitude:"",longitude:"",isActive:!0}});K.useEffect(()=>{if(!r&&o&&!we){const pt=pe.getValues();!pt.address&&!pt.city&&pe.reset({...pt,address:o.address??"",city:o.city??"",latitude:o.latitude??"",longitude:o.longitude??""})}},[o,r,we,pe]),K.useEffect(()=>{const pt=pe.watch((Ge,{name:Rt})=>{if(Rt==="address"||Rt==="city"){const Ot=Ge.address||"",Ci=Ge.city||"";!Ot.trim()&&!Ci.trim()&&(pe.setValue("latitude",""),pe.setValue("longitude",""))}});return()=>pt.unsubscribe()},[pe]),K.useEffect(()=>{const pt=pe.watch((Ge,{name:Rt})=>{if(Rt==="categoryId"&&Ge.categoryId){const Ot=Te.find(Ci=>Ci.id===Ge.categoryId);
3911if(Ot){const Ci=Ot.name==="Volunteer Services";pe.setValue("serviceType",Ci?"volunteer_request":"product_service",{shouldValidate:!1})}}});return()=>pt.unsubscribe()},[pe,Te]),K.useEffect(()=>{if(Te.length>0){const pt=pe.getValues("categoryId");if(pt){const Ge=Te.find(Rt=>Rt.id===pt);if(Ge){const Rt=Ge.name==="Volunteer Services",Ot=pe.getValues("serviceType"),Ci=Rt?"volunteer_request":"product_service";Ot!==Ci&&pe.setValue("serviceType",Ci,{shouldValidate:!1})}}}},[Te,pe]),K.useEffect(()=>{we&&(pe.reset({title:we.title,description:we.description,categoryId:we.categoryId??"",serviceType:we.serviceType??"product_service",priceEuros:we.priceEuros??"",priceCredits:we.priceCredits??"",isRecurring:we.isRecurring??!1,maxVolunteers:we.maxVolunteers?String(we.maxVolunteers):"",requiresContact:we.requiresContact??!1,address:we.address??"",city:we.city??"",country:we.country??"",latitude:we.latitude??"",longitude:we.longitude??"",isActive:we.isActive}),S(we.images??[]),I(we.videoUrl??""),D(!1))},[we,pe]);const Pe=$n({mutationFn:pt=>{const Ge=r?`/api/listings/${f}`:"/api/listings";return xn(r?"PATCH":"POST",Ge,pt)},onSuccess:()=>{c({title:t("createListing.success"),description:t(r?"createListing.listingUpdated":"createListing.listingCreated")}),Qi.invalidateQueries({queryKey:["/api/my-listings"]}),Qi.invalidateQueries({queryKey:["/api/listings"]}),Qi.invalidateQueries({queryKey:["/api/listings","map-view"]}),i("/dashboard")},onError:pt=>{c({title:t("createListing.error"),description:pt.message||t(r?"createListing.updateError":"createListing.createError"),variant:"destructive"})}}),De=pt=>{var Oi,Ei;const Ge=At,Rt=Te.find(Ai=>Ai.id===pt.categoryId),Ot=(Rt==null?void 0:Rt.priceOptional)===!0,Ci=/^\d+(\.\d+)?$/,Hi=(Oi=pt.priceEuros)==null?void 0:Oi.trim(),ei=(Ei=pt.priceCredits)==null?void 0:Ei.trim();if(Ge&&(!ei||!Ci.test(ei)||parseFloat(ei)<1)){c({title:t("createListing.error"),description:t("volunteer.compensationRequired","Il compenso in crediti CEI è obbligatorio per le richieste di volontariato (minimo 1 CEI)"),variant:"destructive"});return}if(!Ge&&!Ot){if(!ei||!Ci.test(ei)||parseFloat(ei)<=0){c({title:t("createListing.error"),description:t("validation.creditsRequired"),variant:"destructive"});return}if(Hi){if(!Ci.test(Hi)){c({title:t("createListing.error"),description:t("createListing.validationError"),variant:"destructive"});return}if(parseFloat(Hi)<0){c({title:t("createListing.error"),description:t("createListing.validationError"),variant:"destructive"});return}}if(Hi&&ei){const Ai=parseFloat(Hi),Xi=parseFloat(ei);if(Number.isFinite(Ai)&&Number.isFinite(Xi)&&Ai>0&&Xi>0){const Nn=Ai+Xi;if(Xi<Nn*.2){c({title:t("createListing.error"),description:t("validation.creditsMinimum"),variant:"destructive"});return}}}}const si={title:pt.title,description:pt.description,categoryId:pt.categoryId||void 0,serviceType:Ge?"volunteer_request":"product_service",priceEuros:Ge?void 0:Hi||(r?null:void 0),priceCredits:ei||(r?null:void 0),isRecurring:Ge?pt.isRecurring:void 0,maxVolunteers:Ge&&pt.maxVolunteers?parseInt(pt.maxVolunteers):void 0,requiresContact:pt.requiresContact??!1,address:pt.address||void 0,city:pt.city||void 0,country:pt.country||void 0,latitude:pt.latitude||void 0,longitude:pt.longitude||void 0,images:x.length>0?x:void 0,videoUrl:N?null:C||void 0};r&&(si.isActive=pt.isActive??!0),Pe.mutate(si)},Je=pe.watch("categoryId"),dt=Te.find(pt=>pt.id===Je),At=(dt==null?void 0:dt.name)==="Volunteer Services",qt=(dt==null?void 0:dt.priceOptional)===!0,kt=pe.watch("priceEuros"),Vt=pe.watch("priceCredits"),Fe=!!kt&&!!Vt,lt=Fe?(()=>{const pt=parseFloat(kt),Ge=parseFloat(Vt),Rt=pt+Ge;return Ge>=Rt*.2})():!0;return r&&Ne?d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsx("div",{className:"text-muted-foreground",children:t("common.loading")})}):d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsx("div",{className:"container mx-auto px-4 py-4",children:d.jsx("div",{className:"flex items-center gap-4",children:d.jsxs(tt,{variant:"ghost",onClick:()=>i("/dashboard"),"data-testid":"button-back-dashboard",children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("common.backToDashboard")]})})})}),d.jsx("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsx(kn,{"data-testid":"text-page-title",children:t(r?"createListing.editTitle":"createListing.createTitle")}),d.jsx(da,{children:t("createListing.basicInfoDesc")})]}),d.jsx(Ji,{children:d.jsx($g,{...pe,children:d.jsxs("form",{onSubmit:pe.handleSubmit(De),className:"space-y-6",children:[d.jsx(ns,{control:pe.control,name:"title",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsxs(ds,{children:[t("createListing.title")," *"]}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("createListing.titlePlaceholder"),...pt,"data-testid":"input-title"})}),d.jsx(zp,{children:t("createListing.basicInfoDesc")}),d.jsx(Is,{})]})}),d.jsx(ns,{control:pe.control,name:"categoryId",render:({field:pt})=>(console.log("[CREATE-LISTING] Categories available:",Te.length,Te),d.jsxs(Yr,{children:[d.jsx(ds,{children:t("createListing.category")}),d.jsx(Qr,{children:d.jsxs("select",{className:"flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
3911ing-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",value:pt.value??"",onChange:Ge=>pt.onChange(Ge.target.value),"data-testid":"select-category",size:1,children:[d.jsx("option",{value:"",disabled:!0,children:t("createListing.selectCategory")}),[...Te].sort((Ge,Rt)=>Ge.name==="Volunteer Services"?-1:Rt.name==="Volunteer Services"?1:Ge.name.localeCompare(Rt.name)).map(Ge=>d.jsx("option",{value:Ge.id,"data-testid":`option-category-${Ge.id}`,children:Tne(Ge.name)},Ge.id))]})}),d.jsx(Is,{})]}))}),d.jsx(ns,{control:pe.control,name:"description",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsxs(ds,{children:[t("createListing.description")," *"]}),d.jsx(Qr,{children:d.jsx(WLe,{content:pt.value||"",onChange:pt.onChange,placeholder:t("createListing.descriptionPlaceholder")})}),d.jsx(zp,{children:t("createListing.basicInfoDesc")}),d.jsx(Is,{})]})}),At&&d.jsxs("div",{className:"space-y-4 p-4 border rounded-lg bg-muted/20",children:[d.jsx("h3",{className:"text-sm font-semibold",children:t("volunteer.requestDetails","Dettagli Richiesta Volontariato")}),d.jsx(ns,{control:pe.control,name:"priceCredits",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsxs(ds,{children:[t("volunteer.compensation","Compenso in Crediti CEI")," *"]}),d.jsx(Qr,{children:d.jsx(an,{type:"number",step:"1",min:"1",placeholder:"50",...pt,"data-testid":"input-volunteer-compensation"})}),d.jsx(zp,{children:t("volunteer.compensationDesc","Quanti crediti CEI riceverà il volontario al completamento del servizio. La piattaforma pagherà questo importo.")}),d.jsx(Is,{})]})}),d.jsx(ns,{control:pe.control,name:"isRecurring",render:({field:pt})=>d.jsxs(Yr,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx(ds,{className:"text-base",children:t("volunteer.recurringService","Servizio Ricorrente")}),d.jsx(zp,{children:t("volunteer.recurringServiceDesc","à un'opportunità di volontariato singola o ricorrente?")})]}),d.jsx(Qr,{children:d.jsx(ou,{checked:pt.value,onCheckedChange:pt.onChange,"data-testid":"switch-is-recurring"})})]})}),d.jsx(ns,{control:pe.control,name:"maxVolunteers",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("volunteer.maxVolunteers","Massimo Volontari")}),d.jsx(Qr,{children:d.jsx(an,{type:"number",min:"1",placeholder:"e.g., 5",...pt,"data-testid":"input-max-volunteers"})}),d.jsx(zp,{children:t("volunteer.maxVolunteersDesc","Quanti volontari possono aiutare con questa richiesta? Lascia vuoto per illimitato.")}),d.jsx(Is,{})]})})]}),!At&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h3",{className:"text-lg font-semibold mb-2",children:[t("createListing.pricing"),!qt&&" *"]}),d.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:qt?t("createListing.pricingOptionalDesc","Per questa categoria il prezzo è opzionale. Puoi lasciare i campi vuoti."):t("createListing.pricingDesc")}),!qt&&d.jsxs(nk,{children:[d.jsx(wJ,{className:"h-4 w-4"}),d.jsx(rk,{className:"text-sm",children:t("validation.creditsRequired")})]})]}),qt&&(kt||Vt)&&d.jsxs(tt,{type:"button",variant:"outline",size:"sm",onClick:()=>{pe.setValue("priceEuros",""),pe.setValue("priceCredits","")},"data-testid":"button-clear-prices",children:[d.jsx(Fa,{className:"w-4 h-4 mr-2"}),t("createListing.clearPrices","Cancella prezzi")]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(ns,{control:pe.control,name:"priceEuros",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsxs(ds,{children:[t("createListing.priceEuros")," (",t("common.optional"),")"]}),d.jsx(Qr,{children:d.jsx(an,{type:"text",inputMode:"decimal",placeholder:"0.00",...pt,value:pt.value??"",onChange:Ge=>{const Rt=Ge.target.value;(Rt===""||/^\d*\.?\d*$/.test(Rt))&&pt.onChange(Rt)},"data-testid":"input-price-euros"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:pe.control,name:"priceCredits",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsxs(ds,{children:[t("createListing.priceCredits"),!qt&&" *"]}),d.jsx(Qr,{children:d.jsx(an,{type:"text",inputMode:"decimal",placeholder:"0.00",...pt,value:pt.value??"",onChange:Ge=>{const Rt=Ge.target.value;(Rt===""||/^\d*\.?\d*$/.test(Rt))&&pt.onChange(Rt)},"data-testid":"input-price-credits"})}),d.jsx(Is,{})]})})]}),Fe&&!lt&&d.jsxs(nk,{variant:"destructive",children:[d.jsx(Jb,{className:"h-4 w-4"}),d.jsx(rk,{children:t("validation.creditsMinimum")})]}
3911),Fe&<&&d.jsx(nk,{children:d.jsxs(rk,{className:"text-sm",children:["â ",t("validation.creditsMinimum")]})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-semibold mb-2",children:t("createListing.location")}),d.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("createListing.locationDesc")})]}),d.jsx(ns,{control:pe.control,name:"address",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("createListing.address")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("createListing.address"),...pt,"data-testid":"input-address"})}),d.jsx(Is,{})]})}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(ns,{control:pe.control,name:"city",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("createListing.city")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("createListing.city"),...pt,"data-testid":"input-city"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:pe.control,name:"country",render:({field:pt})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("createListing.country")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("createListing.country"),...pt,"data-testid":"input-country"})}),d.jsx(Is,{})]})})]}),d.jsx(ns,{control:pe.control,name:"latitude",render:({field:pt})=>d.jsx(Yr,{className:"hidden",children:d.jsx(Qr,{children:d.jsx(an,{type:"hidden",...pt})})})}),d.jsx(ns,{control:pe.control,name:"longitude",render:({field:pt})=>d.jsx(Yr,{className:"hidden",children:d.jsx(Qr,{children:d.jsx(an,{type:"hidden",...pt})})})})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-semibold mb-2",children:t("createListing.images")}),d.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:o!=null&&o.isProfessional?t("upload.professionalLimit"):t("upload.freeLimit")})]}),d.jsxs("div",{children:[d.jsxs("h4",{className:"text-sm font-medium mb-2",children:[t("createListing.images")," ",(o==null?void 0:o.isProfessional)&&"(max 10)"]}),d.jsx(MT,{maxNumberOfFiles:te,maxFileSize:ce,allowedFileTypes:$,onGetUploadParameters:V,onComplete:B,buttonClassName:"w-full",children:t("upload.uploadImages")}),x.length>0&&d.jsxs("div",{className:"mt-3 space-y-2",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:t("upload.imagesUploaded",{count:x.length})}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("upload.selectPreviewHint","Clicca su un'immagine per impostarla come anteprima")}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:x.map((pt,Ge)=>d.jsxs("div",{className:`relative group cursor-pointer rounded-lg overflow-hidden border-2 transition-all ${Ge===0?"border-primary ring-2 ring-primary/30":"border-muted hover:border-muted-foreground/50"}`,onClick:()=>{if(Ge!==0){const Rt=[...x],[Ot]=Rt.splice(Ge,1);Rt.unshift(Ot),S(Rt)}},"data-testid":`image-preview-${Ge}`,children:[d.jsx("img",{src:pt,alt:`${t("upload.image")} ${Ge+1}`,className:"w-20 h-20 object-cover"}),Ge===0&&d.jsx("div",{className:"absolute top-1 left-1 bg-primary text-primary-foreground rounded-full p-1",children:d.jsx(Ru,{className:"w-3 h-3 fill-current"})}),d.jsx("button",{type:"button",onClick:Rt=>{Rt.stopPropagation(),S(Ot=>Ot.filter((Ci,Hi)=>Hi!==Ge))},className:"absolute top-1 right-1 bg-destructive text-destructive-foreground rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity","data-testid":`button-remove-image-${Ge}`,children:d.jsx(Fa,{className:"w-3 h-3"})})]},Ge))})]})]}),(o==null?void 0:o.isProfessional)&&d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-medium mb-2",children:"Video (max 1)"}),C?d.jsxs("div",{className:"mt-2 flex items-center justify-between p-3 bg-muted rounded-md",children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:t("upload.videoUploaded")}),d.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>{I(""),D(!0)},className:"text-destructive hover:text-destructive","data-testid":"button-remove-video",children:t("common.delete")})]}):d.jsx(MT,{maxNumberOfFiles:1,maxFileSize:_e,allowedFileTypes:G,onGetUploadParameters:V,onComplete:W,buttonClassName:"w-full",children:t("upload.uploadVideo")})]})]}),d.jsx(ns,{control:pe.control,name:"requiresContact",render:({field:pt})=>d.jsxs(Yr,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx(ds,{className:"text-base",children:t("createListing.requiresContact")}),d.jsx(zp,{children:t("createListing.requiresContactDesc")})]}),d.jsx(Qr,{children:d.jsx(ou,{checked:pt.value,onCheckedChange:pt.onChange,"data-testid":"switch-requires-contact"})})]})}),r&&d.jsx(ns,{control:pe.control,name:"isActive",render:({field:pt})=>d.jsxs(Yr,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx(ds,{className:"text-base",children:t("createListing.activeStatus")}),d.jsx(zp,{children:t("createListing.activeStatusDesc")})]}),d.jsx(Qr,{children:d.jsx(ou,{checked:pt.value,onCheckedChange:pt.onChange,"data-testid":"switch-is-active"})})]})}),d.jsxs("div",{className:"flex gap-3 pt-4",children:[d.jsx(tt,{type:"submit",disabled:Pe.isPending||Fe&&!lt,className:"flex-1","data-testid":"button-save-listing",children:Pe.isPending?t("createListing.saving"):d.jsxs(d.Fragment,{children:[d.jsx(IJ,{className:"mr-2 h-4 w-4"}),t(r?"createListing.updateButton":"createListing.createButton")]})}),d.jsx(tt,{type:"button",variant:"outline",onClick:()=>i("/dashboard"),"data-testid":"button-cancel",children:t("createListing.cancel")})]})]})})})]})})]})}function _Ue(){const{t}=pr(),{user:e,isLoading:i,isAuthenticated:n}=Ka();dv();const[,o]=$o(),{toast:c}=ks(),[f,r]=K.useState(!1),[x,S]=K.useState(null);K.useEffect(()=>{!i&&!n&&o("/")}
3911,[i,n,o]);const C=(e==null?void 0:e.id)||"",{data:I=[],isLoading:N}=Xn({queryKey:["/api/my-listings"],enabled:!!C&&!i,queryFn:async()=>{if(!C)return[];const G=await fetch("/api/my-listings");if(!G.ok)throw new Error("Failed to fetch listings");return G.json()}}),D=$n({mutationFn:async G=>xn("DELETE",`/api/listings/${G}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/my-listings"]}),c({title:t("myListings.listingDeleted"),description:t("myListings.listingDeletedDesc")}),r(!1),S(null)},onError:G=>{c({title:t("myListings.deleteFailed"),description:G.message||t("myListings.deleteError"),variant:"destructive"})}}),V=$n({mutationFn:async({id:G,isActive:te})=>xn("PATCH",`/api/listings/${G}`,{isActive:te}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/my-listings"]}),c({title:t("myListings.statusUpdated"),description:t("myListings.statusUpdatedDesc")})},onError:G=>{c({title:t("myListings.statusFailed"),description:G.message||t("myListings.statusError"),variant:"destructive"})}}),B=G=>{S(G),r(!0)},W=()=>{x&&D.mutate(x)},$=(G,te)=>{V.mutate({id:G,isActive:!te})};return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[(i||N)&&d.jsx("div",{className:"flex items-center justify-center py-12",children:d.jsx("div",{className:"text-center",children:d.jsx("div",{className:"text-lg text-secondary-foreground",children:t("common.loading")})})}),!i&&!N&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center justify-between mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold",children:t("myListings.title")}),d.jsx("p",{className:"text-secondary-foreground mt-1",children:t("myListings.noListingsDesc")})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{variant:"outline",onClick:()=>o("/"),"data-testid":"button-back-dashboard",children:t("common.back")}),d.jsxs(tt,{onClick:()=>o("/listings/new"),"data-testid":"button-create-listing",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("myListings.createNew")]})]})]}),I.length===0&&d.jsx(Ti,{className:"p-12",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-5xl mb-4",children:"ð¦"}),d.jsx("h2",{className:"text-2xl font-semibold mb-2",children:t("myListings.noListings")}),d.jsx("p",{className:"text-secondary-foreground mb-6",children:t("myListings.noListingsDesc")}),d.jsxs(tt,{onClick:()=>o("/listings/new"),"data-testid":"button-create-first-listing",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("myListings.createNew")]})]})}),I.length>0&&d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:I.map(G=>d.jsxs(Ti,{"data-testid":`card-listing-${G.id}`,children:[G.images&&G.images[0]&&d.jsx("div",{className:"aspect-video w-full overflow-hidden rounded-t-md",children:d.jsx("img",{src:G.images[0],alt:G.title,className:"w-full h-full object-cover","data-testid":`img-listing-${G.id}`})}),d.jsx(In,{children:d.jsxs("div",{className:"flex items-start justify-between gap-2",children:[d.jsx(kn,{className:"line-clamp-2",children:G.title}),d.jsx(En,{variant:G.isActive?"default":"secondary","data-testid":`badge-status-${G.id}`,children:G.isActive?t("myListings.active"):t("myListings.inactive")})]})}),d.jsxs(Ji,{className:"space-y-3",children:[d.jsx("p",{className:"text-sm text-secondary-foreground line-clamp-2",children:tP(G.description)}),G.city&&d.jsxs("div",{className:"flex items-center gap-1 text-sm text-secondary-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:G.city})]}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[G.priceEuros&&d.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[d.jsx(Yve,{className:"w-4 h-4"}),d.jsx("span",{className:"font-semibold",children:G.priceEuros})]}),G.priceCredits&&d.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[d.jsx(e1,{className:"w-4 h-4"}),d.jsxs("span",{className:"font-semibold",children:[G.priceCredits," CEI"]})]})]}),d.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[d.jsx(ou,{id:`active-${G.id}`,checked:G.isActive,onCheckedChange:()=>$(G.id,G.isActive),disabled:V.isPending,"data-testid":`switch-active-${G.id}`}),d.jsx(Fn,{htmlFor:`active-${G.id}`,className:"text-sm cursor-pointer",children:G.isActive?t("myListings.active"):t("myListings.inactive")})]})]}),d.jsxs(yie,{className:"flex gap-2",children:[d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>o(`/listings/${G.id}/edit`),"data-testid":`button-edit-${G.id}`,className:"flex-1",children:[d.jsx(QN,{className:"w-4 h-4 mr-2"}),t("myListings.edit")]}),d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>B(G.id),disabled:D.isPending,"data-testid":`button-delete-${G.id}`,className:"flex-1",children:[d.jsx(Ld,{className:"w-4 h-4 mr-2"}),t("myListings.delete")]})]})]},G.id))})]})]}),d.jsx(q_,{open:f,onOpenChange:r,children:d.jsxs(gg,{children:[d.jsxs(yg,{children:[d.jsx(vg,{children:t("myListings.deleteTitle")}),d.jsx(xg,{children:t("myListings.deleteDesc")})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-delete",children:t("common.cancel")}),d.jsx(H_,{onClick:W,"data-testid":"button-confirm-delete",children:t("myListings.delete")})]})]})})]})}var KB="Tabs",[vUe,B8e]=Wa(KB,[vM]),oce=vM(),[xUe,ZB]=vUe(KB),ace=K.forwardRef((t,e)=>{const{__scopeTabs:i,value:n,onValueChange:o,defaultValue:c,orientation:f="horizontal",dir:r,activationMode:x="automatic",...S}=t,C=o1(r),[I,N]=lu({prop:n,onChange:o,defaultProp:c});return d.jsx(xUe,{scope:i,baseId:nu(),value:I,onValueChange:N,orientation:f,dir:C,activationMode:x,children:d.jsx(vn.div,{dir:C,"data-orientation":f,...S,ref:e})})});ace.displayName=KB;var lce="TabsList",cce=K.forwardRef((t,e)=>{const{__scopeTabs:i,loop:n=!0,...o}=t,c=ZB(lce,i),f=oce(i);return d.jsx(Eie,{asChild:!0,...f,orientation:c.orientation,dir:c.dir,loop:n,children:d.jsx(vn.div,{role:"tablist","aria-orientation":c.orientation,...o,ref:e})})});cce.displayName=lce;var uce="TabsTrigger",dce=K.forwardRef((t,e)=>{const{__scopeTabs:i,value:n,disabled:o=!1,...c}=t,f=ZB(uce,i),r=oce(i),x=fce(f.baseId,n),S=mce(f.baseId,n),C=n===f.value;return d.jsx(Aie,{asChild:!0,...r,focusable:!o,active:C,children:d.jsx(vn.button,{type:"button",role:"tab","aria-selected":C,"aria-controls":S,"data-state":C?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:x,...c,ref:e,onMouseDown:Ni(t.onMouseDown,I=>{!o&&I.button===0&&I.ctrlKey===!1?f.onValueChange(n):I.preventDefault()}),onKeyDown:Ni(t.onKeyDown,I=>{[" ","Enter"].includes(I.key)&&f.onValueChange(n)}),onFocus:Ni(t.onFocus,()=>{const I=f.activationMode!=="manual";!C&&!o&&I&&f.onValueChange(n)})})})});dce.displayName=uce;var hce="TabsContent",pce=K.forwardRef((t,e)=>{const{__scopeTabs:i,value:n,forceMount:o,children:c,...f}=t,r=ZB(hce,i),x=fce(r.baseId,n),S=mce(r.baseId,n),C=n===r.value,I=K.useRef(C);return K.useEffect(()=>{const N=requestAnimationFrame(()=>I.current=!1);return()=>cancelAnimationFrame(N)},[]),d.jsx(Ea,{present:o||C,children:({present:N})=>d.jsx(vn.div,{"data-state":C?"active":"inactive","data-orientation":r.orientation,role:"tabpanel","aria-labelledby":x,hidden:!N,id:S,tabIndex:0,...f,ref:e,style:{...t.style,animationDuration:I.current?"0s":void 0},children:N&&c})})});pce.displayName=hce;function fce(t,e){return`${t}-trigger-${e}`}function mce(t,e){return`${t}-content-${e}`}var bUe=ace,gce=cce,yce=dce,_ce=pce;const qM=bUe,RE=K.forwardRef(({className:t,...e},i)=>d.jsx(gce,{ref:i,className:nn("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));RE.displayName=gce.displayName;const za=K.forwardRef(({className:t,...e},i)=>d.jsx(yce,{ref:i,className:nn("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));za.displayName=yce.displayName;const La=K.forwardRef(({className:t,...e},i)=>d.jsx(_ce,{ref:i,className:nn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));La.displayName=_ce.displayName;function Zs(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function Ag(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const vce=6048e5,wUe=864e5,kI=43200,z7=1440;let SUe={};function jE(){return SUe}function iv(t,e){var r,x,S,C;const i=jE(),n=(e==null?void 0:e.weekStartsOn)??((x=(r=e==null?void 0:e.locale)==null?void 0:r.options)==null?void 0:x.weekStartsOn)??i.weekStartsOn??((C=(S=i.locale)==null?void 0:S.options)==null?void 0:C.weekStartsOn)??0,o=Zs(t),c=o.getDay(),f=(c<n?7:0)+c-n;return o.setDate(o.getDate()-f),o.setHours(0,0,0,0),o}function cN(t){return iv(t,{weekStartsOn:1}
3911)}function xce(t){const e=Zs(t),i=e.getFullYear(),n=Ag(t,0);n.setFullYear(i+1,0,4),n.setHours(0,0,0,0);const o=cN(n),c=Ag(t,0);c.setFullYear(i,0,4),c.setHours(0,0,0,0);const f=cN(c);return e.getTime()>=o.getTime()?i+1:e.getTime()>=f.getTime()?i:i-1}function L7(t){const e=Zs(t);return e.setHours(0,0,0,0),e}function uN(t){const e=Zs(t),i=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return i.setUTCFullYear(e.getFullYear()),+t-+i}function TUe(t,e){const i=L7(t),n=L7(e),o=+i-uN(i),c=+n-uN(n);return Math.round((o-c)/wUe)}function CUe(t){const e=xce(t),i=Ag(t,0);return i.setFullYear(e,0,4),i.setHours(0,0,0,0),cN(i)}function lk(t,e){const i=Zs(t),n=Zs(e),o=i.getTime()-n.getTime();return o<0?-1:o>0?1:o}function EUe(t){return Ag(t,Date.now())}function AUe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function IUe(t){if(!AUe(t)&&typeof t!="number")return!1;const e=Zs(t);return!isNaN(Number(e))}function kUe(t,e){const i=Zs(t),n=Zs(e),o=i.getFullYear()-n.getFullYear(),c=i.getMonth()-n.getMonth();return o*12+c}function PUe(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function NUe(t,e){return+Zs(t)-+Zs(e)}function MUe(t){const e=Zs(t);return e.setHours(23,59,59,999),e}function DUe(t){const e=Zs(t),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}function RUe(t){const e=Zs(t);return+MUe(e)==+DUe(e)}function jUe(t,e){const i=Zs(t),n=Zs(e),o=lk(i,n),c=Math.abs(kUe(i,n));let f;if(c<1)f=0;else{i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*c);let r=lk(i,n)===-o;RUe(Zs(t))&&c===1&&lk(t,n)===1&&(r=!1),f=o*(c-Number(r))}return f===0?0:f}function zUe(t,e,i){const n=NUe(t,e)/1e3;return PUe(i==null?void 0:i.roundingMethod)(n)}function LUe(t){const e=Zs(t),i=Ag(t,0);return i.setFullYear(e.getFullYear(),0,1),i.setHours(0,0,0,0),i}const OUe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},FUe=(t,e,i)=>{let n;const o=OUe[t];return typeof o=="string"?n=o:e===1?n=o.one:n=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+n:n+" ago":n};function R0(t){return(e={})=>{const i=e.width?String(e.width):t.defaultWidth;return t.formats[i]||t.formats[t.defaultWidth]}}const BUe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},UUe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},VUe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$Ue={date:R0({formats:BUe,defaultWidth:"full"}),time:R0({formats:UUe,defaultWidth:"full"}),dateTime:R0({formats:VUe,defaultWidth:"full"})},qUe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},HUe=(t,e,i,n)=>qUe[t];function Dh(t){return(e,i)=>{const n=i!=null&&i.context?String(i.context):"standalone";let o;if(n==="formatting"&&t.formattingValues){const f=t.defaultFormattingWidth||t.defaultWidth,r=i!=null&&i.width?String(i.width):f;o=t.formattingValues[r]||t.formattingValues[f]}else{const f=t.defaultWidth,r=i!=null&&i.width?String(i.width):t.defaultWidth;o=t.values[r]||t.values[f]}const c=t.argumentCallback?t.argumentCallback(e):e;return o[c]}}const GUe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},WUe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},KUe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ZUe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
3911ay","Saturday"]},XUe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},YUe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},QUe=(t,e)=>{const i=Number(t),n=i%100;if(n>20||n<10)switch(n%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},JUe={ordinalNumber:QUe,era:Dh({values:GUe,defaultWidth:"wide"}),quarter:Dh({values:WUe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Dh({values:KUe,defaultWidth:"wide"}),day:Dh({values:ZUe,defaultWidth:"wide"}),dayPeriod:Dh({values:XUe,defaultWidth:"wide",formattingValues:YUe,defaultFormattingWidth:"wide"})};function Rh(t){return(e,i={})=>{const n=i.width,o=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],c=e.match(o);if(!c)return null;const f=c[0],r=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],x=Array.isArray(r)?tVe(r,I=>I.test(f)):eVe(r,I=>I.test(f));let S;
vendor: 4,573 bytes, line 3911
3911S=t.valueCallback?t.valueCallback(x):x,S=i.valueCallback?i.valueCallback(S):S;const C=e.slice(f.length);return{value:S,rest:C}}}function eVe(t,e){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&e(t[i]))return i}function tVe(t,e){for(let i=0;i<t.length;i++)if(e(t[i]))return i}function bce(t){return(e,i={})=>{const n=e.match(t.matchPattern);if(!n)return null;const o=n[0],c=e.match(t.parsePattern);if(!c)return null;let f=t.valueCallback?t.valueCallback(c[0]):c[0];f=i.valueCallback?i.valueCallback(f):f;const r=e.slice(o.length);return{value:f,rest:r}}}const iVe=/^(\d+)(th|st|nd|rd)?/i,nVe=/\d+/i,rVe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},sVe={any:[/^b/i,/^(a|c)/i]},oVe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aVe={any:[/1/i,/2/i,/3/i,/4/i]},lVe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cVe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},uVe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},dVe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},hVe={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},pVe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fVe={ordinalNumber:bce({matchPattern:iVe,parsePattern:nVe,valueCallback:t=>parseInt(t,10)}),era:Rh({matchPatterns:rVe,defaultMatchWidth:"wide",parsePatterns:sVe,defaultParseWidth:"any"}),quarter:Rh({matchPatterns:oVe,defaultMatchWidth:"wide",parsePatterns:aVe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Rh({matchPatterns:lVe,defaultMatchWidth:"wide",parsePatterns:cVe,defaultParseWidth:"any"}),day:Rh({matchPatterns:uVe,defaultMatchWidth:"wide",parsePatterns:dVe,defaultParseWidth:"any"}),dayPeriod:Rh({matchPatterns:hVe,defaultMatchWidth:"any",parsePatterns:pVe,defaultParseWidth:"any"})},wce={code:"en-US",formatDistance:FUe,formatLong:$Ue,formatRelative:HUe,localize:JUe,match:fVe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mVe(t){const e=Zs(t);return TUe(e,LUe(e))+1}function gVe(t){const e=Zs(t),i=+cN(e)-+CUe(e);return Math.round(i/vce)+1}function Sce(t,e){var C,I,N,D;const i=Zs(t),n=i.getFullYear(),o=jE(),c=(e==null?void 0:e.firstWeekContainsDate)??((I=(C=e==null?void 0:e.locale)==null?void 0:C.options)==null?void 0:I.firstWeekContainsDate)??o.firstWeekContainsDate??((D=(N=o.locale)==null?void 0:N.options)==null?void 0:D.firstWeekContainsDate)??1,f=Ag(t,0);f.setFullYear(n+1,0,c),f.setHours(0,0,0,0);const r=iv(f,e),x=Ag(t,0);x.setFullYear(n,0,c),x.setHours(0,0,0,0);const S=iv(x,e);return i.getTime()>=r.getTime()?n+1:i.getTime()>=S.getTime()?n:n-1}function yVe(t,e){var r,x,S,C;const i=jE(),n=(e==null?void 0:e.firstWeekContainsDate)??((x=(r=e==null?void 0:e.locale)==null?void 0:r.options)==null?void 0:x.firstWeekContainsDate)??i.firstWeekContainsDate??((C=(S=i.locale)==null?void 0:S.options)==null?void 0:C.firstWeekContainsDate)??1,o=Sce(t,e),c=Ag(t,0);return c.setFullYear(o,0,n),c.setHours(0,0,0,0),iv(c,e)}function _Ve(t,e){const i=Zs(t),n=+iv(i,e)-+yVe(i,e);return Math.round(n/vce)+1}function Us(t,e){const i=t<0?"-":"",n=Math.abs(t).toString().padStart(e,"0");return i+n}const hm={y(t,e){const i=t.getFullYear(),n=i>0?i:1-i;return Us(e==="yy"?n%100:n,e.length)},M(t,e){const i=t.getMonth();return e==="M"?String(i+1):Us(i+1,2)},d(t,e){return Us(t.getDate(),e.length)},a(t,e){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];case"aaaa":default:return i==="am"?"a.m.":"p.m."}},h(t,e){return Us(t.getHours()%12||12,e.length)},H(t,e){return Us(t.getHours(),e.length)},m(t,e){return Us(t.getMinutes(),e.length)},s(t,e){return Us(t.getSeconds(),e.length)},S(t,e){const i=e.length,n=t.getMilliseconds(),o=Math.trunc(n*Math.pow(10,i-3));return Us(o,e.length)}},Yx={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}
vendor: 4,182 bytes, line 3911
3911,O7={G:function(t,e,i){const n=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})}},y:function(t,e,i){if(e==="yo"){const n=t.getFullYear(),o=n>0?n:1-n;return i.ordinalNumber(o,{unit:"year"})}return hm.y(t,e)},Y:function(t,e,i,n){const o=Sce(t,n),c=o>0?o:1-o;if(e==="YY"){const f=c%100;return Us(f,2)}return e==="Yo"?i.ordinalNumber(c,{unit:"year"}):Us(c,e.length)},R:function(t,e){const i=xce(t);return Us(i,e.length)},u:function(t,e){const i=t.getFullYear();return Us(i,e.length)},Q:function(t,e,i){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Us(n,2);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,e,i){const n=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Us(n,2);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,e,i){const n=t.getMonth();switch(e){case"M":case"MM":return hm.M(t,e);case"Mo":return i.ordinalNumber(n+1,{unit:"month"});case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})}},L:function(t,e,i){const n=t.getMonth();switch(e){case"L":return String(n+1);case"LL":return Us(n+1,2);case"Lo":return i.ordinalNumber(n+1,{unit:"month"});case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})}},w:function(t,e,i,n){const o=_Ve(t,n);return e==="wo"?i.ordinalNumber(o,{unit:"week"}):Us(o,e.length)},I:function(t,e,i){const n=gVe(t);return e==="Io"?i.ordinalNumber(n,{unit:"week"}):Us(n,e.length)},d:function(t,e,i){return e==="do"?i.ordinalNumber(t.getDate(),{unit:"date"}):hm.d(t,e)},D:function(t,e,i){const n=mVe(t);return e==="Do"?i.ordinalNumber(n,{unit:"dayOfYear"}):Us(n,e.length)},E:function(t,e,i){const n=t.getDay();switch(e){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})}},e:function(t,e,i,n){const o=t.getDay(),c=(o-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(c);case"ee":return Us(c,2);case"eo":return i.ordinalNumber(c,{unit:"day"});case"eee":return i.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(o,{width:"short",context:"formatting"});case"eeee":default:return i.day(o,{width:"wide",context:"formatting"})}},c:function(t,e,i,n){const o=t.getDay(),c=(o-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(c);case"cc":return Us(c,e.length);case"co":return i.ordinalNumber(c,{unit:"day"});case"ccc":return i.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(o,{width:"narrow",context:"standalone"});case"cccccc":return i.day(o,{width:"short",context:"standalone"});case"cccc":default:return i.day(o,{width:"wide",context:"standalone"})}},i:function(t,e,i){const n=t.getDay(),o=n===0?7:n;switch(e){case"i":return String(o);case"ii":return Us(o,e.length);case"io":return i.ordinalNumber(o,{unit:"day"});case"iii":return i.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(n,{width:"short",context:"formatting"});case"iiii":default:return i.day(n,{width:"wide",context:"formatting"})}}
vendor: 5,214 bytes, line 3911
3911,a:function(t,e,i){const o=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return i.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,e,i){const n=t.getHours();let o;switch(n===12?o=Yx.noon:n===0?o=Yx.midnight:o=n/12>=1?"pm":"am",e){case"b":case"bb":return i.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,e,i){const n=t.getHours();let o;switch(n>=17?o=Yx.evening:n>=12?o=Yx.afternoon:n>=4?o=Yx.morning:o=Yx.night,e){case"B":case"BB":case"BBB":return i.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,e,i){if(e==="ho"){let n=t.getHours()%12;return n===0&&(n=12),i.ordinalNumber(n,{unit:"hour"})}return hm.h(t,e)},H:function(t,e,i){return e==="Ho"?i.ordinalNumber(t.getHours(),{unit:"hour"}):hm.H(t,e)},K:function(t,e,i){const n=t.getHours()%12;return e==="Ko"?i.ordinalNumber(n,{unit:"hour"}):Us(n,e.length)},k:function(t,e,i){let n=t.getHours();return n===0&&(n=24),e==="ko"?i.ordinalNumber(n,{unit:"hour"}):Us(n,e.length)},m:function(t,e,i){return e==="mo"?i.ordinalNumber(t.getMinutes(),{unit:"minute"}):hm.m(t,e)},s:function(t,e,i){return e==="so"?i.ordinalNumber(t.getSeconds(),{unit:"second"}):hm.s(t,e)},S:function(t,e){return hm.S(t,e)},X:function(t,e,i){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return B7(n);case"XXXX":case"XX":return Gy(n);case"XXXXX":case"XXX":default:return Gy(n,":")}},x:function(t,e,i){const n=t.getTimezoneOffset();switch(e){case"x":return B7(n);case"xxxx":case"xx":return Gy(n);case"xxxxx":case"xxx":default:return Gy(n,":")}},O:function(t,e,i){const n=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+F7(n,":");case"OOOO":default:return"GMT"+Gy(n,":")}},z:function(t,e,i){const n=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+F7(n,":");case"zzzz":default:return"GMT"+Gy(n,":")}},t:function(t,e,i){const n=Math.trunc(t.getTime()/1e3);return Us(n,e.length)},T:function(t,e,i){const n=t.getTime();return Us(n,e.length)}};function F7(t,e=""){const i=t>0?"-":"+",n=Math.abs(t),o=Math.trunc(n/60),c=n%60;return c===0?i+String(o):i+String(o)+e+Us(c,2)}function B7(t,e){return t%60===0?(t>0?"-":"+")+Us(Math.abs(t)/60,2):Gy(t,e)}function Gy(t,e=""){const i=t>0?"-":"+",n=Math.abs(t),o=Us(Math.trunc(n/60),2),c=Us(n%60,2);return i+o+e+c}const U7=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Tce=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},vVe=(t,e)=>{const i=t.match(/(P+)(p+)?/)||[],n=i[1],o=i[2];if(!o)return U7(t,e);let c;switch(n){case"P":c=e.dateTime({width:"short"});break;case"PP":c=e.dateTime({width:"medium"});break;case"PPP":c=e.dateTime({width:"long"});break;case"PPPP":default:c=e.dateTime({width:"full"});break}return c.replace("{{date}}",U7(n,e)).replace("{{time}}",Tce(o,e))},xVe={p:Tce,P:vVe},bVe=/^D+$/,wVe=/^Y+$/,SVe=["D","DD","YY","YYYY"];function TVe(t){return bVe.test(t)}function CVe(t){return wVe.test(t)}function EVe(t,e,i){const n=AVe(t,e,i);if(console.warn(n),SVe.includes(t))throw new RangeError(n)}function AVe(t,e,i){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${n} to the input \`${i}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const IVe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,kVe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,PVe=/^'([^]*?)'?$/,NVe=/''/g,MVe=/[a-zA-Z]/;function rc(t,e,i){var C,I,N,D,V,B,W,$;const n=jE(),o=(i==null?void 0:i.locale)??n.locale??wce,c=(i==null?void 0:i.firstWeekContainsDate)??((I=(C=i==null?void 0:i.locale)==null?void 0:C.options)==null?void 0:I.firstWeekContainsDate)??n.firstWeekContainsDate??((D=(N=n.locale)==null?void 0:N.options)==null?void 0:D.firstWeekContainsDate)??1,f=(i==null?void 0:i.weekStartsOn)??((B=(V=i==null?void 0:i.locale)==null?void 0:V.options)==null?void 0:B.weekStartsOn)??n.weekStartsOn??(($=(W=n.locale)==null?void 0:W.options)==null?void 0:$.weekStartsOn)??0,r=Zs(t);if(!IUe(r))throw new RangeError("Invalid time value");let x=e.match(kVe).map(G=>{const te=G[0];if(te==="p"||te==="P"){const ce=xVe[te];return ce(G,o.formatLong)}return G}).join("").match(IVe).map(G=>{if(G==="''")return{isToken:!1,value:"'"};const te=G[0];if(te==="'")return{isToken:!1,value:DVe(G)};if(O7[te])return{isToken:!0,value:G};
3911if(te.match(MVe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+te+"`");return{isToken:!1,value:G}});o.localize.preprocessor&&(x=o.localize.preprocessor(r,x));const S={firstWeekContainsDate:c,weekStartsOn:f,locale:o};return x.map(G=>{if(!G.isToken)return G.value;const te=G.value;(!(i!=null&&i.useAdditionalWeekYearTokens)&&CVe(te)||!(i!=null&&i.useAdditionalDayOfYearTokens)&&TVe(te))&&EVe(te,e,String(t));const ce=O7[te[0]];return ce(r,te,o.localize,S)}).join("")}function DVe(t){const e=t.match(PVe);return e?e[1].replace(NVe,"'"):t}function RVe(t,e,i){const n=jE(),o=(i==null?void 0:i.locale)??n.locale??wce,c=2520,f=lk(t,e);if(isNaN(f))throw new RangeError("Invalid time value");const r=Object.assign({},i,{addSuffix:i==null?void 0:i.addSuffix,comparison:f});let x,S;f>0?(x=Zs(e),S=Zs(t)):(x=Zs(t),S=Zs(e));const C=zUe(S,x),I=(uN(S)-uN(x))/1e3,N=Math.round((C-I)/60);let D;if(N<2)return i!=null&&i.includeSeconds?C<5?o.formatDistance("lessThanXSeconds",5,r):C<10?o.formatDistance("lessThanXSeconds",10,r):C<20?o.formatDistance("lessThanXSeconds",20,r):C<40?o.formatDistance("halfAMinute",0,r):C<60?o.formatDistance("lessThanXMinutes",1,r):o.formatDistance("xMinutes",1,r):N===0?o.formatDistance("lessThanXMinutes",1,r):o.formatDistance("xMinutes",N,r);if(N<45)return o.formatDistance("xMinutes",N,r);if(N<90)return o.formatDistance("aboutXHours",1,r);if(N<z7){const V=Math.round(N/60);return o.formatDistance("aboutXHours",V,r)}else{if(N<c)return o.formatDistance("xDays",1,r);if(N<kI){const V=Math.round(N/z7);return o.formatDistance("xDays",V,r)}else if(N<kI*2)return D=Math.round(N/kI),o.formatDistance("aboutXMonths",D,r)}if(D=jUe(S,x),D<12){const V=Math.round(N/kI);return o.formatDistance("xMonths",V,r)}else{const V=D%12,B=Math.trunc(D/12);return V<3?o.formatDistance("aboutXYears",B,r):V<9?o.formatDistance("overXYears",B,r):o.formatDistance("almostXYears",B+1,r)}}function ck(t,e){return RVe(t,EUe(t),e)}function V7(t,e,i){const n=iv(t,i),o=iv(e,i);return+n==+o}function jVe(){const{user:t,isLoading:e,isAuthenticated:i}=Ka();dv();const[,n]=$o(),{toast:o}=ks(),{t:c}=pr(),f={pending:{label:c("orders.pending"),variant:"secondary",icon:qh},reserved:{label:c("orders.reserved"),variant:"outline",icon:txe},completed:{label:c("orders.completed"),variant:"default",icon:Wo},cancelled:{label:c("orders.cancelled"),variant:"destructive",icon:B_},expired:{label:c("orders.expired"),variant:"destructive",icon:B_}},[r,x]=K.useState(!1),[S,C]=K.useState(!1),[I,N]=K.useState(null),[D,V]=K.useState(null);K.useEffect(()=>{!e&&!i&&n("/")},[e,i,n]);const{data:B=[],isLoading:W}=Xn({queryKey:["/api/my-orders/buyer"],enabled:i&&!e}),{data:$=[],isLoading:G}=Xn({queryKey:["/api/my-orders/seller"],enabled:i&&!e}),te=$n({mutationFn:async({orderId:Pe,status:De})=>xn("PATCH",`/api/orders/${Pe}/status`,{status:De}),onSuccess:(Pe,De)=>{Qi.invalidateQueries({queryKey:["/api/my-orders/buyer"]}),Qi.invalidateQueries({queryKey:["/api/my-orders/seller"]}),o({title:c("orders.orderUpdated"),description:De.status==="completed"?c("orders.orderConfirmed"):c("orders.orderCancelled")}),x(!1),C(!1),N(null),V(null)},onError:Pe=>{o({title:c("orders.updateFailed"),description:Pe.message||c("orders.updateError"),variant:"destructive"})}}),ce=Pe=>{N(Pe),V("confirm"),x(!0)},_e=Pe=>{N(Pe),V("cancel"),C(!0)},Te=()=>{I&&te.mutate({orderId:I,status:"completed"})},we=()=>{I&&te.mutate({orderId:I,status:"cancelled"})},Ne=Pe=>Pe?Pe.firstName&&Pe.lastName?`${Pe.firstName} ${Pe.lastName}`:Pe.firstName||Pe.lastName||c("orders.unknown"):c("orders.unknown"),pe=(Pe,De)=>{var Vt,Fe,lt;const Je=f[Pe.status]||f.pending,dt=Je.icon,At=De==="buyer"&&(Pe.status==="pending"||Pe.status==="reserved"),qt=Pe.status==="pending"||Pe.status==="reserved",kt=De==="seller"&&(Pe.status==="pending"||Pe.status==="reserved");return d.jsxs(Ti,{"data-testid":`card-order-${Pe.id}`,children:[d.jsx(In,{children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx(kn,{className:"line-clamp-2",children:((Vt=Pe.listing)==null?void 0:Vt.title)||c("orders.listing")}),d.jsxs("p",{className:"text-sm text-secondary-foreground mt-1",children:[c(De==="buyer"?"orders.seller":"orders.buyer"),": ",Ne(De==="buyer"?Pe.seller:Pe.buyer)]})]}),((lt=(Fe=Pe.listing)==null?void 0:Fe.images)==null?void 0:lt[0])&&d.jsx("div",{className:"w-20 h-20 rounded overflow-hidden flex-shrink-0",children:d.jsx("img",{src:Pe.listing.images[0],alt:Pe.listing.title,className:"w-full h-full object-cover","data-testid":`img-order-${Pe.id}`})})]})}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(dt,{className:"w-4 h-4"}),d.jsx(En,{variant:Je.variant,"data-testid":`badge-status-${Pe.id}`,children:Je.label})]}),d.jsxs("div",{className:"space-y-1",children:[Pe.amountEuros&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-secondary-foreground",children:"Euros: "}),d.jsxs("span",{className:"font-semibold",children:["â¬",Pe.amountEuros]})]}),Pe.amountCredits&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-secondary-foreground",children:"Credits: "}),d.jsxs("span",{className:"font-semibold",children:[Pe.amountCredits," CEI"]})]})]}),d.jsxs("div",{className:"text-xs text-secondary-foreground space-y-1",children:[d.jsxs("div",{children:[c("orders.orderDate"),": ",rc(new Date(Pe.createdAt),"PPP")]}),Pe.completedAt&&d.jsxs("div",{children:[c("orders.completed"),": ",rc(new Date(Pe.completedAt),"PPP")]}
3911),Pe.expiresAt&&Pe.status!=="completed"&&Pe.status!=="cancelled"&&d.jsxs("div",{className:"text-destructive",children:[c("orders.expiresOn"),": ",rc(new Date(Pe.expiresAt),"PPP")]})]}),Pe.buyerNotes&&d.jsxs("div",{className:"text-sm",children:[d.jsxs("span",{className:"text-secondary-foreground",children:[c("orders.buyerNotes"),": "]}),d.jsx("span",{children:Pe.buyerNotes})]}),kt&&d.jsx("div",{className:"bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-md p-3 text-sm",children:d.jsxs("p",{className:"text-amber-800 dark:text-amber-200",children:[d.jsx(qh,{className:"w-4 h-4 inline mr-2"}),c("orders.waitingBuyerConfirmation","In attesa che l'acquirente confermi la ricezione. I crediti ti verranno trasferiti dopo la conferma.")]})}),d.jsxs("div",{className:"flex flex-wrap gap-2 pt-2",children:[(Pe.status==="pending"||Pe.status==="reserved")&&d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>n(`/messages/${De==="buyer"?Pe.sellerId:Pe.buyerId}`),"data-testid":`button-contact-${Pe.id}`,children:[d.jsx(Cb,{className:"w-4 h-4 mr-2"}),c("orders.contactCounterpart","Contatta")]}),At&&d.jsxs(tt,{size:"sm",onClick:()=>ce(Pe.id),disabled:te.isPending,"data-testid":`button-confirm-${Pe.id}`,children:[d.jsx(Cd,{className:"w-4 h-4 mr-2"}),c("orders.confirmReceipt","Conferma Ricezione")]}),qt&&d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>_e(Pe.id),disabled:te.isPending,"data-testid":`button-cancel-${Pe.id}`,children:[d.jsx(Fa,{className:"w-4 h-4 mr-2"}),c("orders.cancelOrder")]})]})]})]},Pe.id)};return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsxs("div",{className:"mb-8",children:[d.jsxs(tt,{variant:"ghost",size:"sm",onClick:()=>n("/dashboard"),className:"mb-4","data-testid":"button-back-dashboard",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),c("common.backToDashboard","Torna alla Dashboard")]}),d.jsx("h1",{className:"text-3xl font-bold",children:c("orders.title")}),d.jsx("p",{className:"text-secondary-foreground mt-1",children:c("orders.manageYourOrders","Gestisci i tuoi ordini e le tue vendite")})]}),(e||W||G)&&d.jsx("div",{className:"flex items-center justify-center py-12",children:d.jsx("div",{className:"text-center",children:d.jsx("div",{className:"text-lg text-secondary-foreground",children:c("messages.loadingOrders")})})}),!e&&!W&&!G&&d.jsxs(qM,{defaultValue:"buyer",className:"w-full",children:[d.jsxs(RE,{className:"grid w-full max-w-md grid-cols-2","data-testid":"tabs-orders",children:[d.jsxs(za,{value:"buyer","data-testid":"tab-buyer",children:[c("orders.purchases")," (",B.length,")"]}),d.jsxs(za,{value:"seller","data-testid":"tab-seller",children:[c("orders.sales")," (",$.length,")"]})]}),d.jsx(La,{value:"buyer",className:"mt-6",children:B.length===0?d.jsx(Ti,{className:"p-12",children:d.jsxs("div",{className:"text-center",children:[d.jsx(M8,{className:"w-12 h-12 mx-auto text-secondary-foreground mb-4"}),d.jsx("h2",{className:"text-2xl font-semibold mb-2",children:c("orders.noPurchases")}),d.jsx("p",{className:"text-secondary-foreground mb-6",children:c("orders.noPurchasesDesc")}),d.jsx(tt,{onClick:()=>n("/"),"data-testid":"button-browse-marketplace",children:c("marketplace.browseMarketplace")})]})}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:B.map(Pe=>pe(Pe,"buyer"))})}),d.jsx(La,{value:"seller",className:"mt-6",children:$.length===0?d.jsx(Ti,{className:"p-12",children:d.jsxs("div",{className:"text-center",children:[d.jsx(M8,{className:"w-12 h-12 mx-auto text-secondary-foreground mb-4"}),d.jsx("h2",{className:"text-2xl font-semibold mb-2",children:c("orders.noSales")}),d.jsx("p",{className:"text-secondary-foreground mb-6",children:c("orders.noSalesDesc")}),d.jsx(tt,{onClick:()=>n("/my-listings"),"data-testid":"button-my-listings",children:c("myListings.title")})]})}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:$.map(Pe=>pe(Pe,"seller"))})})]})]}),d.jsx(q_,{open:r,onOpenChange:x,children:d.jsxs(gg,{children:[d.jsxs(yg,{children:[d.jsx(vg,{children:c("orders.confirmTitle")}),d.jsx(xg,{children:c("orders.confirmDesc")})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-confirm-dialog",children:c("common.cancel")}),d.jsx(H_,{onClick:Te,"data-testid":"button-confirm-confirm-dialog",children:c("orders.confirmOrder")})]})]})}),d.jsx(q_,{open:S,onOpenChange:C,children:d.jsxs(gg,{children:[d.jsxs(yg,{children:[d.jsx(vg,{children:c("orders.cancelTitle")}),d.jsx(xg,{children:c("orders.cancelDesc")})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-cancel-dialog",children:c("common.cancel")}),d.jsx(H_,{onClick:we,"data-testid":"button-confirm-cancel-dialog",children:c("orders.cancelOrder")})]})]})})]})}function $7(){var Vt;const{t}=pr();dv();const[,e]=$o(),[,i]=uE("/messages/:userId"),{toast:n}=ks(),[o,c]=K.useState(null),[f,r]=K.useState(""),[x,S]=K.useState(!1),[C,I]=K.useState(""),[N,D]=K.useState(!1),[V,B]=K.useState(!1);K.useEffect(()=>{i!=null&&i.userId&&c(i.userId)},[i==null?void 0:i.userId]);const W=["ð","ð","â¤ï¸","ð","ð","ð","ð","â¨","ð¢","ð®","ð¤","ð","ð¥","ðª","ð","ð","ð","ð¯","â
","â","ð","ð ","ð¼","ð","ð¦","ð","ð","â","ð","ðº","ð±","ð¶"],$=Fe=>{r(lt=>lt+Fe),S(!1)},{data:G,isLoading:te}=Xn({queryKey:["/api/auth/user"]});K.useEffect(()=>{!te&&!G&&e("/api/login")},[G,te,e]);const{data:ce=[],isLoading:_e}=Xn({queryKey:["/api/messages"],enabled:!!G,refetchInterval:5e3}),{data:Te=[],isLoading:we}=Xn({queryKey:["/api/users/search",C],queryFn:async()=>
3911{if(C.length<2)return[];const Fe=await fetch(`/api/users/search?q=${encodeURIComponent(C)}`,{credentials:"include"});return Fe.ok?Fe.json():[]},enabled:!!G&&C.length>=2}),{data:Ne=[]}=Xn({queryKey:["/api/admin/broadcast-history"],enabled:!!(G!=null&&G.isAdmin)}),pe=ce.reduce((Fe,lt)=>{if(!G||lt.fromUserId===G.id&<.content.startsWith("Benvenuto/a nella Comunità Economica Indipendente!")||lt.fromUserId===G.id&<.allowsReply===!1)return Fe;const Ge=lt.fromUserId===G.id?lt.toUserId:lt.fromUserId,Rt=lt.fromUserId===G.id?lt.toUser:lt.fromUser,Ot=Fe.find(Ci=>Ci.otherUser.id===Ge);if(!Ot)Fe.push({otherUser:Rt||{id:Ge,firstName:null,lastName:null,profileImageUrl:null},lastMessage:lt,unreadCount:lt.toUserId===G.id&&!lt.isRead?1:0});else{const Ci=lt.createdAt?new Date(lt.createdAt):new Date(0),Hi=Ot.lastMessage.createdAt?new Date(Ot.lastMessage.createdAt):new Date(0);Ci>Hi&&(Ot.lastMessage=lt),lt.toUserId===G.id&&!lt.isRead&&Ot.unreadCount++}return Fe},[]);pe.sort((Fe,lt)=>{const pt=Fe.lastMessage.createdAt?new Date(Fe.lastMessage.createdAt).getTime():0;return(lt.lastMessage.createdAt?new Date(lt.lastMessage.createdAt).getTime():0)-pt}),K.useEffect(()=>{const lt=new URLSearchParams(window.location.search).get("userId");if(lt&&G&&!o){const pt=pe.find(Ge=>Ge.otherUser.id===lt);c(lt),window.history.replaceState({},"","/messages")}},[G,pe,o]);const{data:Pe=[]}
3911=Xn({queryKey:["/api/messages/conversation",o],enabled:!!o&&!!G,refetchInterval:3e3}),De=$n({mutationFn:async Fe=>xn("PATCH",`/api/messages/mark-read/${Fe}`,{}),onMutate:Fe=>{const lt=pt=>pt==null?void 0:pt.map(Ge=>Ge.toUserId===(G==null?void 0:G.id)&&Ge.fromUserId===Fe?{...Ge,isRead:!0}:Ge);Qi.setQueryData(["/api/messages"],lt),Qi.setQueryData(["/api/messages/conversation",Fe],lt)},onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/messages"]})}});K.useEffect(()=>{if(!o||!G||De.isPending)return;Pe.some(lt=>lt.fromUserId===o&<.toUserId===G.id&&!lt.isRead)&&De.mutate(o)},[Pe,o,G,De.isPending]);const Je=$n({mutationFn:async Fe=>xn("POST","/api/messages",Fe),onSuccess:()=>{r(""),Qi.invalidateQueries({queryKey:["/api/messages"]}),Qi.invalidateQueries({queryKey:["/api/messages/conversation",o]})},onError:()=>{n({variant:"destructive",title:t("messages.error"),description:t("messages.sendError")})}}),dt=Fe=>{c(Fe),B(!1),De.mutate(Fe),I(""),D(!1)},At=Fe=>{c(Fe.id),B(!1),De.mutate(Fe.id),I(""),D(!1)},qt=Fe=>{Fe.preventDefault(),!(!f.trim()||!o)&&Je.mutate({toUserId:o,content:f.trim(),listingId:null})};if(K.useEffect(()=>{const Fe=document.querySelector('[data-testid="messages-scroll-area"]');Fe&&(Fe.scrollTop=Fe.scrollHeight)},[Pe]),te||_e)return d.jsx("div",{className:"container max-w-6xl mx-auto p-6",children:d.jsx("div",{className:"text-center py-12",children:t("messages.loadingMessages")})});if(!G)return null;const kt=pe.find(Fe=>Fe.otherUser.id===o);return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsx("div",{className:"container mx-auto px-4 py-4",children:d.jsx("div",{className:"flex items-center justify-between",children:d.jsx(tt,{variant:"ghost",asChild:!0,"data-testid":"button-back-dashboard",children:d.jsxs(yr,{href:"/dashboard",children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("common.backToDashboard")]})})})})}),d.jsxs("div",{className:"container max-w-6xl mx-auto p-6",children:[d.jsx("h1",{className:"text-3xl font-bold mb-6",children:t("dashboard.messages")}),d.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[d.jsxs(Ti,{className:"md:col-span-1 p-4",children:[d.jsx("h2",{className:"font-semibold mb-4",children:t("messages.conversations","Conversations")}),d.jsxs("div",{className:"relative mb-4",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),d.jsx(an,{type:"text",placeholder:t("messages.searchUsers","Search users..."),value:C,onChange:Fe=>{I(Fe.target.value),D(Fe.target.value.length>=2)},onFocus:()=>C.length>=2&&D(!0),className:"pl-9 pr-9","data-testid":"input-search-users"}),C&&d.jsx(tt,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6",onClick:()=>{I(""),D(!1)},"data-testid":"button-clear-search",children:d.jsx(Fa,{className:"h-3 w-3"})})]}),N&&C.length>=2&&d.jsx("div",{className:"mb-4 border rounded-lg overflow-hidden",children:we?d.jsx("div",{className:"p-3 text-center text-sm text-muted-foreground",children:t("messages.searching","Searching...")}):Te.length===0?d.jsx("div",{className:"p-3 text-center text-sm text-muted-foreground",children:t("messages.noUsersFound","No users found")}):d.jsx("div",{className:"divide-y",children:Te.map(Fe=>d.jsxs("button",{onClick:()=>At(Fe),className:"w-full text-left p-3 hover-elevate active-elevate-2 transition-colors flex items-center gap-3","data-testid":`search-result-${Fe.id}`,children:[d.jsxs(Nc,{className:"h-8 w-8",children:[d.jsx(Rd,{src:Fe.profileImageUrl||void 0}),d.jsx(Mc,{children:d.jsx(ju,{className:"h-4 w-4"})})]}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"font-medium text-sm truncate",children:Fe.firstName&&Fe.lastName?`${Fe.firstName} ${Fe.lastName}`:Fe.email||t("messages.userFallback")}),Fe.email&&Fe.firstName&&d.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Fe.email})]})]},Fe.id))})}),pe.length===0&&!Ne.length&&!N?d.jsxs("div",{className:"text-center py-8 text-muted-foreground","data-testid":"empty-conversations",children:[d.jsx("p",{children:t("messages.noConversations","No conversations yet")}),d.jsx("p",{className:"text-sm mt-2",children:t("messages.startChatting","Search for a user above to start chatting!")})]}):!N&&d.jsx(yT,{className:"h-[400px]",children:d.jsxs("div",{className:"space-y-2",children:[(G==null?void 0:G.isAdmin)&&Ne.length>0&&d.jsx("button",{onClick:()=>{B(!0),c(null)},"data-testid":"conversation-broadcast-history",className:`w-full text-left p-3 rounded-lg hover-elevate active-elevate-2 transition-colors ${V?"bg-accent":""}`,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(Nc,{className:"h-10 w-10",children:d.jsx(Mc,{className:"bg-primary/10",children:d.jsx(N8,{className:"h-5 w-5 text-primary"})})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("p",{className:"font-medium text-sm",children:t("messages.broadcastHistory","Storico Broadcast")}),d.jsx(En,{variant:"secondary",children:Ne.length})]}),d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-1",children:(Vt=Ne[0])==null?void 0:Vt.content})]})]})}),pe.map(Fe=>d.jsx("button",{onClick:()=>dt(Fe.otherUser.id),"data-testid":`conversation-${Fe.otherUser.id}`,className:`w-full text-left p-3 rounded-lg hover-elevate active-elevate-2 transition-colors ${o===Fe.otherUser.id?"bg-accent":""}`,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsxs(Nc,{className:"h-10 w-10",children:[d.jsx(Rd,{src:Fe.otherUser.profileImageUrl||void 0}),d.jsx(Mc,{children:d.jsx(ju,{className:"h-5 w-5"})})]}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsx("p",{className:"font-medium text-sm truncate",children:Fe.otherUser.firstName&&Fe.otherUser.lastName?`${Fe.otherUser.firstName} ${Fe.otherUser.lastName}`:t("messages.userFallback")}),Fe.unreadCount>0&&d.jsx(En,{variant:"default",className:"h-5 min-w-5 px-1.5","data-testid":`unread-badge-${Fe.otherUser.id}`,children:Fe.unreadCount})]}),d.jsx("p",{className:"text-xs text-muted-foreground truncate mt-1",children:Fe.lastMessage.content}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Fe.lastMessage.createdAt?ck(new Date(Fe.lastMessage.createdAt),{addSuffix:!0}):"Unknown time"})]})]})},Fe.otherUser.id))]})})]}),d.jsx(Ti,{className:"md:col-span-2 flex flex-col",children:V?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"border-b p-4 flex items-center gap-3",children:[d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>B(!1),"data-testid":"button-back-broadcast",className:"md:hidden",children:d.jsx(Ao,{className:"h-5 w-5"})}),d.jsx(Nc,{className:"h-10 w-10",children:d.jsx(Mc,{className:"bg-primary/10",children:d.jsx(N8,{className:"h-5 w-5 text-primary"})})}),d.jsxs("div",{children:[d.jsx("p",{className:"font-semibold","data-testid":"broadcast-history-title",children:t("messages.broadcastHistory","Storico Broadcast")}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ne.length," ",Ne.length===1?t("messages.messageSent","messaggio inviato"):t("messages.messagesSent","messaggi inviati")]})]})]}),d.jsx(yT,{className:"flex-1 p-4 h-[400px]","data-testid":"broadcast-scroll-area",children:d.jsx("div",{className:"space-y-4",children:Ne.map((Fe,lt)=>d.jsx("div",{className:"flex justify-end","data-testid":`broadcast-entry-${lt}`,children:d.jsxs("div",{className:"max-w-[70%] text-right",children:[d.jsxs("div",{className:"inline-block max-w-full p-3 rounded-lg bg-primary text-primary-foreground text-left",children:[d.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Fe.content}),Fe.imageUrl&&d.jsx("img",{src:Fe.imageUrl,alt:"Immagine allegata",className:"mt-2 w-full max-w-xs rounded-md object-contain border border-white/20","data-testid":`img-broadcast-${lt}`})]}),d.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Fe.sentAt?ck(new Date(Fe.sentAt),{addSuffix:!0}):""," · ",t("messages.sentTo","inviato a")," ",Fe.recipientCount," ",t("messages.recipients","destinatari")]})]})},lt))})})]}):o?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"border-b p-4 flex items-center gap-3",children:[d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>c(null),"data-testid":"button-back",className:"md:hidden",children:d.jsx(Ao,{className:"h-5 w-5"})}),d.jsxs(Nc,{className:"h-10 w-10",children:[d.jsx(Rd,{src:(kt==null?void 0:kt.otherUser.profileImageUrl)||void 0}),d.jsx(Mc,{children:d.jsx(ju,{className:"h-5 w-5"})})]}),d.jsx("div",{children:d.jsx("p",{className:"font-semibold","data-testid":"conversation-username",children:kt!=null&&kt.otherUser.firstName&&(kt!=null&&kt.otherUser.lastName)?`${kt.otherUser.firstName} ${kt.otherUser.lastName}`:t("messages.userFallback")})})]}),d.jsx(yT,{className:"flex-1 p-4 h-[400px]","data-testid":"messages-scroll-area",children:d.jsx("div",{className:"space-y-4",children:Pe.map(Fe=>{const lt=Fe.fromUserId===(G==null?void 0:G.id);return d.jsx("div",{className:`flex ${lt?"justify-end":"justify-start"}`,"data-testid":`message-${Fe.id}`,children:d.jsxs("div",{className:`max-w-[70%] ${lt?"text-right":"text-left"}`,children:[d.jsxs("div",{className:`inline-block max-w-full p-3 rounded-lg text-left ${lt?"bg-primary text-primary-foreground":"bg-muted"}`,children:[Fe.allowsReply===!1&&d.jsx(En,{variant:"outline",className:"mb-2",children:t("admin.broadcastTitle","Messaggio Broadcast")}),d.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:Fe.content}),Fe.imageUrl&&d.jsx("img",{src:Fe.imageUrl,alt:"Immagine allegata",className:"mt-2 w-full max-w-xs rounded-md object-contain border border-black/10","data-testid":`img-message-${Fe.id}`})]}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Fe.createdAt?ck(new Date(Fe.createdAt),{addSuffix:!0}):"Unknown time"})]})},Fe.id)})})}),d.jsxs("form",{onSubmit:qt,className:"border-t p-4",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"flex-1 relative",children:[d.jsx(Uc,{value:f,onChange:Fe=>
3911r(Fe.target.value),placeholder:t("messages.typeMessage"),className:"resize-none min-h-[60px] pr-10","data-testid":"input-message",onKeyDown:Fe=>{Fe.key==="Enter"&&!Fe.shiftKey&&(Fe.preventDefault(),qt(Fe))}}),d.jsxs(cF,{open:x,onOpenChange:S,children:[d.jsx(uF,{asChild:!0,children:d.jsx(tt,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1 h-8 w-8","data-testid":"button-emoji",children:d.jsx(fxe,{className:"h-4 w-4 text-muted-foreground"})})}),d.jsx(nN,{className:"w-64 p-2",align:"end",children:d.jsx("div",{className:"grid grid-cols-8 gap-1",children:W.map(Fe=>d.jsx("button",{type:"button",onClick:()=>$(Fe),className:"text-xl p-1 rounded hover-elevate active-elevate-2 transition-colors","data-testid":`emoji-${Fe}`,children:Fe},Fe))})})]})]}),d.jsx(tt,{type:"submit",size:"icon",disabled:!f.trim()||Je.isPending,"data-testid":"button-send",children:d.jsx(JT,{className:"h-4 w-4"})})]}),d.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Press Enter to send, Shift+Enter for new line"})]})]}):d.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground p-12","data-testid":"no-conversation-selected",children:d.jsx("div",{className:"text-center",children:d.jsx("p",{className:"text-lg",children:"Select a conversation to start chatting"})})})})]})]})]})}function Rc({className:t,...e}){return d.jsx("div",{className:nn("animate-pulse rounded-md bg-muted",t),...e})}function zVe({balance:t,walletName:e,isLoading:i,onEditName:n}){const{t:o}=pr();return d.jsxs(Ti,{children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:e||o("wallet.balance")}),d.jsxs("div",{className:"flex items-center gap-1",children:[n&&d.jsx(tt,{size:"icon",variant:"ghost",onClick:n,"data-testid":"button-edit-wallet-name",className:"h-6 w-6",children:d.jsx(lxe,{className:"w-3 h-3"})}),d.jsx(eM,{className:"w-4 h-4 text-muted-foreground"})]})]}),d.jsx(Ji,{children:i?d.jsx(Rc,{className:"h-10 w-32"}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"text-4xl font-bold tabular-nums","data-testid":"text-wallet-balance",children:parseFloat(t||"0").toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o("wallet.credits")})]})})]})}function Cce({open:t,onOpenChange:e,userId:i,isAdmin:n=!1}){const{t:o}=pr(),{data:c,isLoading:f,error:r}=Xn({queryKey:i?[`/api/users/${i}`]:[],enabled:!!i&&t,retry:!1}),x=n&&c&&"email"in c?c:null;K.useEffect(()=>{!t&&i&&Qi.removeQueries({queryKey:[`/api/users/${i}`]})},[t,i]);const S=(C,I)=>{const N=(C==null?void 0:C.charAt(0))||"",D=(I==null?void 0:I.charAt(0))||"";return(N+D).toUpperCase()||"?"};return d.jsx(ll,{open:t,onOpenChange:e,children:d.jsxs(Va,{"data-testid":"dialog-user-profile",className:"sm:max-w-md",children:[d.jsx(cl,{children:d.jsx($a,{children:o("profile.userProfile")})}),f?d.jsx("div",{className:"space-y-4",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(Rc,{className:"w-16 h-16 rounded-full"}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Rc,{className:"h-5 w-32"}),d.jsx(Rc,{className:"h-4 w-24"})]})]})}):r?d.jsx("div",{className:"text-center py-6",children:d.jsx("p",{className:"text-muted-foreground",children:o("profile.userNotFound")})}):c?d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsxs(Nc,{className:"w-16 h-16","data-testid":"avatar-user",children:[d.jsx(Rd,{src:c.profileImageUrl||void 0}),d.jsx(Mc,{className:"text-lg",children:S(c.firstName,c.lastName)})]}),d.jsx("div",{className:"flex-1",children:d.jsxs("h3",{className:"text-xl font-semibold","data-testid":"text-user-name",children:[c.firstName," ",c.lastName]})})]}),c.profession&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-profession",children:[d.jsx(W3,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.profession")}),d.jsx("p",{className:"font-medium","data-testid":"text-profession",children:c.profession})]})]}),c.website&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-website",children:[d.jsx(XN,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.website")}),d.jsx("a",{href:c.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all","data-testid":"link-website",children:c.website})]})]}),x&&d.jsxs(d.Fragment,{children:[x.email&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-email",children:[d.jsx(Z3,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.email")}),d.jsx("p",{className:"font-medium break-all","data-testid":"text-email",children:x.email})]})]}),x.phone&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-phone",children:[d.jsx(cxe,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.phone")}),d.jsx("p",{className:"font-medium","data-testid":"text-phone",children:x.phone})]})]}),(x.address||x.city)&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-address",children:[d.jsx(fo,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.address")}),d.jsxs("p",{className:"font-medium","data-testid":"text-address",children:[x.address,x.address&&x.city&&", ",x.city]})]})]}),x.dateOfBirth&&d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-dob",children:[d.jsx(Yb,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.dateOfBirth")}),d.jsx("p",{className:"font-medium","data-testid":"text-dob",children:rc(new Date(x.dateOfBirth),"PPP")})]})]}),d.jsxs("div",{className:"flex items-start gap-3","data-testid":"section-admin-status",children:[d.jsx(i1,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:o("profile.adminStatus")}),d.jsx(En,{variant:x.isAdmin?"default":"secondary","data-testid":"badge-admin-status",children:x.isAdmin?o("profile.isAdmin"):o("profile.notAdmin")})]})]})]}),!n&&!c.profession&&!c.website&&d.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:o("profile.noAdditionalInfo")})]}):d.jsx("div",{className:"text-center py-6",children:d.jsx("p",{className:"text-muted-foreground",children:o("profile.userNotFound")})})]})})}function Ece({transactions:t,currentUserId:e,isLoading:i,isAdmin:n,onFilterChange:o}){const{t:c}=pr(),[f,r]=K.useState(!1),[x,S]=K.useState({}),[C,I]=K.useState(!1),[N,D]=K.useState(null),V=G=>{G&&(D(G),I(!0))},B=(G,te)=>{const ce={...x,[G]:te||void 0};te||delete ce[G],S(ce),o==null||o(ce)},W=()=>{S({}),o==null||o({})},$=Object.keys(x).filter(G=>x[G]).length;return i?d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:c("transaction.title")})}),d.jsx(Ji,{className:"space-y-4",children:[1,2,3].map(G=>d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(Rc,{className:"h-10 w-10 rounded-md"}),d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsx(Rc,{className:"h-4 w-32"}),d.jsx(Rc,{className:"h-3 w-48"})]}),d.jsx(Rc,{className:"h-6 w-20"})]},G))})]}):t.length===0?d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:c("transaction.title")})}),d.jsx(Ji,{children:d.jsxs("div",{className:"text-center py-12",children:[d.jsx("div",{className:"w-16 h-16 rounded-full bg-muted mx-auto mb-4 flex items-center justify-center",children:d.jsx(eM,{className:"w-8 h-8 text-muted-foreground"})}),d.jsx("h3",{className:"text-lg font-semibold mb-2",children:c("transaction.noTransactions")}),d.jsx("p",{className:"text-sm text-muted-foreground",children:c("transaction.noTransactionsDesc")})]})})]}):d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[d.jsx(kn,{children:c("transaction.title")}),d.jsxs("div",{className:"flex items-center gap-2",children:[$>0&&d.jsx(tt,{variant:"outline",size:"sm",onClick:W,"data-testid":"button-clear-filters",children:c("transaction.clearAll")}),d.jsxs(tt,{variant:f?"default":"outline",size:"sm",onClick:()=>r(!f),"data-testid":"button-toggle-filters",children:[d.jsx(exe,{className:"w-4 h-4 mr-2"}),c("transaction.filters")]})]})]}),$>0&&d.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.type&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterType"),": ",x.type,d.jsx(Fa,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("type","")})]}),x.searchQuery&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterSearch"),": ",x.searchQuery,d.jsx(F
3911a,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("searchQuery","")})]}),x.startDate&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterFrom"),": ",x.startDate,d.jsx(Fa,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("startDate","")})]}),x.endDate&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterTo"),": ",x.endDate,d.jsx(Fa,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("endDate","")})]}),x.minAmount&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterMin"),": ",x.minAmount,d.jsx(Fa,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("minAmount","")})]}),x.maxAmount&&d.jsxs(En,{variant:"secondary",className:"gap-1",children:[c("transaction.filterMax"),": ",x.maxAmount,d.jsx(Fa,{className:"w-3 h-3 cursor-pointer hover-elevate",onClick:()=>B("maxAmount","")})]})]})]}),f&&d.jsx("div",{className:"mt-4 p-4 bg-muted/50 rounded-md space-y-4",children:d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.filterSearch")}),d.jsx(an,{placeholder:c("transaction.searchPlaceholder"),value:x.searchQuery||"",onChange:G=>B("searchQuery",G.target.value),"data-testid":"input-search-filter"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.filterType")}),d.jsxs(Jy,{value:x.type||"all",onValueChange:G=>B("type",G==="all"?"":G),children:[d.jsx(Vm,{"data-testid":"select-type-filter",children:d.jsx(e_,{placeholder:c("transaction.allTypes")})}),d.jsxs($m,{children:[d.jsx(ja,{value:"all",children:c("transaction.allTypes")}),d.jsx(ja,{value:"transfer",children:c("transaction.typeTransfer")}),d.jsx(ja,{value:"admin_credit",children:c("transaction.typeAdminCredit")})]})]})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.startDate")}),d.jsx(an,{type:"date",value:x.startDate||"",onChange:G=>B("startDate",G.target.value),"data-testid":"input-start-date-filter"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.endDate")}),d.jsx(an,{type:"date",value:x.endDate||"",onChange:G=>B("endDate",G.target.value),"data-testid":"input-end-date-filter"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.minAmount")}),d.jsx(an,{type:"number",placeholder:"0.00",step:"0.01",value:x.minAmount||"",onChange:G=>B("minAmount",G.target.value),"data-testid":"input-min-amount-filter"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:c("transaction.maxAmount")}),d.jsx(an,{type:"number",placeholder:"0.00",step:"0.01",value:x.maxAmount||"",onChange:G=>B("maxAmount",G.target.value),"data-testid":"input-max-amount-filter"})]})]})})]}),d.jsx(Ji,{children:d.jsx("div",{className:"space-y-4",children:t.map(G=>{var De;const te=G.fromUserId===e,ce=G.toUserId===e,_e=G.type==="admin_credit";let Te=d.jsx(of,{className:"w-4 h-4"}),we="bg-green-500/10 text-green-600 dark:text-green-400",Ne="text-green-600 dark:text-green-400",pe=G.description||c("transaction.noDescription"),Pe=null;if(te&&G.toUser){Te=d.jsx(Uve,{className:"w-4 h-4"}),we="bg-orange-500/10 text-orange-600 dark:text-orange-400",Ne="text-orange-600 dark:text-orange-400";const Je=G.toUser.email||G.toUser.firstName||c("transaction.unknown");pe=`${c("transaction.transferTo")} `,Pe={id:G.toUser.id,name:Je}}else if(ce&&!_e&&G.fromUser){Te=d.jsx(Ove,{className:"w-4 h-4"});const Je=G.fromUser.email||G.fromUser.firstName||c("transaction.unknown");pe=`${c("transaction.transferFrom")} `,Pe={id:G.fromUser.id,name:Je}}return _e&&(pe=G.description||c("transaction.creditsAddedByAdmin"),Pe=null),d.jsxs("div",{className:"flex items-center gap-4 py-3 border-b last:border-0","data-testid":`transaction-${G.id}`,children:[d.jsx("div",{className:`w-10 h-10 rounded-md flex items-center justify-center ${we}`,children:Te}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("p",{className:"text-sm font-medium truncate",children:Pe?d.jsxs(d.Fragment,{children:[pe,d.jsx("button",{onClick:()=>V(Pe.id),className:"text-primary hover:underline font-semibold","data-testid":`link-user-${Pe.id}`,children:Pe.name})]}):pe}),G.type==="transfer"&&Pe&&((De=G.description)==null?void 0:De.trim())&&d.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words","data-testid":`transaction-description-${G.id}`,children:G.description}),d.jsx("p",{className:"text-xs text-muted-foreground",children:G.createdAt&&ck(new Date(G.createdAt),{addSuffix:!0})}),n&&d.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[G.fromUserId&&G.fromUser&&d.jsxs(d.Fragment,{children:[c("transaction.from"),":"," ",d.jsx("button",{onClick:()=>V(G.fromUser.id),className:"text-primary hover:underline","data-testid":`link-admin-from-${G.fromUser.id}`,children:G.fromUser.email||c("transaction.unknown")})]}),G.toUserId&&G.toUser&&d.jsxs(d.Fragment,{children:[" â ",c("transaction.to"),":"," ",d.jsx("button",{onClick:()=>V(G.toUser.id),className:"text-primary hover:underline","data-testid":`link-admin-to-${G.toUser.id}`,children:G.toUser.email||c("transaction.unknown")})]})]})]}),d.jsxs("div",{className:"text-right",children:[d.jsxs("div",{className:`text-base font-semibold tabular-nums ${Ne}
3911`,children:[te?"-":"+",parseFloat(G.amount||"0").toLocaleString("en-US",{minimumFractionDigits:2})]}),d.jsx(En,{variant:"secondary",className:"text-xs mt-1",children:G.type==="admin_credit"?c("transaction.badgeAdmin"):c("transaction.badgeTransfer")})]})]},G.id)})})}),d.jsx(Cce,{open:C,onOpenChange:I,userId:N,isAdmin:n})]})}const gi=Symbol.for("drizzle:entityKind");function ca(t,e){if(!t||typeof t!="object")return!1;if(t instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,gi))throw new Error(`Class "${e.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let i=Object.getPrototypeOf(t).constructor;if(i)for(;i;){if(gi in i&&i[gi]===e[gi])return!0;i=Object.getPrototypeOf(i)}return!1}var mW;mW=gi;class $b{constructor(e,i){je(this,"name");je(this,"keyAsName");je(this,"primary");je(this,"notNull");je(this,"default");je(this,"defaultFn");je(this,"onUpdateFn");je(this,"hasDefault");je(this,"isUnique");je(this,"uniqueName");je(this,"uniqueType");je(this,"dataType");je(this,"columnType");
3911je(this,"enumValues");je(this,"generated");je(this,"generatedIdentity");je(this,"config");this.table=e,this.config=i,this.name=i.name,this.keyAsName=i.keyAsName,this.notNull=i.notNull,this.default=i.default,this.defaultFn=i.defaultFn,this.onUpdateFn=i.onUpdateFn,this.hasDefault=i.hasDefault,this.primary=i.primaryKey,this.isUnique=i.isUnique,this.uniqueName=i.uniqueName,this.uniqueType=i.uniqueType,this.dataType=i.dataType,this.columnType=i.columnType,this.generated=i.generated,this.generatedIdentity=i.generatedIdentity}mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}je($b,mW,"Column");var gW;gW=gi;class Ace{constructor(e,i,n){je(this,"config");je(this,"$default",this.$defaultFn);je(this,"$onUpdate",this.$onUpdateFn);this.config={name:e,keyAsName:e==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:i,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){this.config.name===""&&(this.config.name=e)}}je(Ace,gW,"ColumnBuilder");const j0=Symbol.for("drizzle:Name");var yW;yW=gi;class Ice{constructor(e,i){je(this,"reference");je(this,"_onUpdate","no action");je(this,"_onDelete","no action");this.reference=()=>{const{name:n,columns:o,foreignColumns:c}=e();return{name:n,columns:o,foreignTable:c[0].table,foreignColumns:c}},i&&(this._onUpdate=i.onUpdate,this._onDelete=i.onDelete)}onUpdate(e){return this._onUpdate=e===void 0?"no action":e,this}onDelete(e){return this._onDelete=e===void 0?"no action":e,this}build(e){return new kce(e,this)}}je(Ice,yW,"PgForeignKeyBuilder");var _W;_W=gi;class kce{constructor(e,i){je(this,"reference");je(this,"onUpdate");je(this,"onDelete");this.table=e,this.reference=i.reference,this.onUpdate=i._onUpdate,this.onDelete=i._onDelete}getName(){const{name:e,columns:i,foreignColumns:n}=this.reference(),o=i.map(r=>r.name),c=n.map(r=>r.name),f=[this.table[j0],...o,n[0].table[j0],...c];return e??`${f.join("_")}_fk`}}je(kce,_W,"PgForeignKey");function LVe(t,...e){return t(...e)}function OVe(t,e){return`${t[j0]}_${e.join("_")}_unique`}function q7(t,e,i){for(let n=e;n<t.length;n++){const o=t[n];if(o==="\\"){n++;continue}if(o==='"')return[t.slice(e,n).replace(/\\/g,""),n+1];if(!i&&(o===","||o==="}"))return[t.slice(e,n).replace(/\\/g,""),n]}return[t.slice(e).replace(/\\/g,""),t.length]}function Pce(t,e=0){const i=[];let n=e,o=!1;for(;n<t.length;){const c=t[n];if(c===","){(o||n===e)&&i.push(""),o=!0,n++;continue}if(o=!1,c==="\\"){n+=2;continue}if(c==='"'){const[x,S]=q7(t,n+1,!0);i.push(x),n=S;continue}if(c==="}")return[i,n+1];if(c==="{"){const[x,S]=Pce(t,n+1);i.push(x),n=S;continue}const[f,r]=q7(t,n,!1);i.push(f),n=r}return[i,n]}function FVe(t){const[e]=Pce(t,1);return e}function Nce(t){return`{${t.map(e=>Array.isArray(e)?Nce(e):typeof e=="string"?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${e}`).join(",")}}`}var vW,xW;class vs extends(xW=Ace,vW=gi,xW){constructor(){super(...arguments);je(this,"foreignKeyConfigs",[])}array(i){return new Dce(this.config.name,this,i)}references(i,n={}){return this.foreignKeyConfigs.push({ref:i,actions:n}),this}unique(i,n){return this.config.isUnique=!0,this.config.uniqueName=i,this.config.uniqueType=n==null?void 0:n.nulls,this}generatedAlwaysAs(i){return this.config.generated={as:i,type:"always",mode:"stored"},this}buildForeignKeys(i,n){return this.foreignKeyConfigs.map(({ref:o,actions:c})=>LVe((f,r)=>{const x=new Ice(()=>{const S=f();return{columns:[i],foreignColumns:[S]}});return r.onUpdate&&x.onUpdate(r.onUpdate),r.onDelete&&x.onDelete(r.onDelete),x.build(n)},o,c))}buildExtraConfigColumn(i){return new Mce(i,this.config)}}je(vs,vW,"PgColumnBuilder");var bW,wW;class Pr extends(wW=$b,bW=gi,wW){constructor(e,i){i.uniqueName||(i.uniqueName=OVe(e,[i.name])),super(e,i),this.table=e}}je(Pr,bW,"PgColumn");var SW,TW;class Mce extends(TW=Pr,SW=gi,TW){constructor(){super(...arguments);je(this,"indexConfig",{order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass});je(this,"defaultConfig",{order:"asc",nulls:"last",opClass:void 0})}
3911getSQLType(){return this.getSQLType()}asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(i){return this.indexConfig.opClass=i,this}}je(Mce,SW,"ExtraConfigColumn");var CW;CW=gi;class uk{constructor(e,i,n,o){je(this,"name");je(this,"keyAsName");je(this,"type");je(this,"indexConfig");this.name=e,this.keyAsName=i,this.type=n,this.indexConfig=o}}je(uk,CW,"IndexedColumn");var EW,AW;class Dce extends(AW=vs,EW=gi,AW){constructor(e,i,n){super(e,"array","PgArray"),this.config.baseBuilder=i,this.config.size=n}build(e){const i=this.config.baseBuilder.build(e);return new FF(e,this.config,i)}}je(Dce,EW,"PgArrayBuilder");var IW,kW;const IN=class IN extends(kW=Pr,IW=gi,kW){constructor(i,n,o,c){super(i,n);je(this,"size");this.baseColumn=o,this.range=c,this.size=n.size}getSQLType(){return`${this.baseColumn.getSQLType()}[${typeof this.size=="number"?this.size:""}]`}mapFromDriverValue(i){return typeof i=="string"&&(i=FVe(i)),i.map(n=>this.baseColumn.mapFromDriverValue(n))}mapToDriverValue(i,n=!1){const o=i.map(c=>c===null?null:ca(this.baseColumn,IN)?this.baseColumn.mapToDriverValue(c,!0):this.baseColumn.mapToDriverValue(c));return n?o:Nce(o)}};je(IN,IW,"PgArray");let FF=IN;const H7=Symbol.for("drizzle:isPgEnum");function BVe(t){return!!t&&typeof t=="function"&&H7 in t&&t[H7]===!0}var PW;PW=gi;class XB{constructor(e,i,n,o=!1){this._={brand:"Subquery",sql:e,selectedFields:i,alias:n,isWith:o}}}je(XB,PW,"Subquery");const UVe={startActiveSpan(t,e){return e()}},z0=Symbol.for("drizzle:ViewBaseConfig"),Bz=Symbol.for("drizzle:Schema"),G7=Symbol.for("drizzle:Columns"),W7=Symbol.for("drizzle:ExtraConfigColumns"),Uz=Symbol.for("drizzle:OriginalName"),Vz=Symbol.for("drizzle:BaseName"),dN=Symbol.for("drizzle:IsAlias"),K7=Symbol.for("drizzle:ExtraConfigBuilder"),Rce=Symbol.for("drizzle:IsDrizzleTable");var NW,MW,DW,RW,jW,zW,LW,OW,FW,BW;BW=gi,FW=j0,OW=Uz,LW=Bz,zW=G7,jW=W7,RW=Vz,DW=dN,MW=Rce,NW=K7;class ic{constructor(e,i,n){je(this,FW);je(this,OW);je(this,LW);je(this,zW);je(this,jW);je(this,RW);je(this,DW,!1);je(this,MW,!0);je(this,NW);this[j0]=this[Uz]=e,this[Bz]=i,this[Vz]=n}}je(ic,BW,"Table"),je(ic,"Symbol",{Name:j0,Schema:Bz,OriginalName:Uz,Columns:G7,ExtraConfigColumns:W7,BaseName:Vz,IsAlias:dN,ExtraConfigBuilder:K7});function jce(t){return typeof t=="object"&&t!==null&&Rce in t}function VVe(t){return t!=null&&typeof t.getSQL=="function"}function $Ve(t){var i;const e={sql:"",params:[]};for(const n of t)e.sql+=n.sql,e.params.push(...n.params),(i=n.typings)!=null&&i.length&&(e.typings||(e.typings=[]),e.typings.push(...n.typings));return e}var UW;UW=gi;class Au{constructor(e){je(this,"value");this.value=Array.isArray(e)?e:[e]}getSQL(){return new Vo([this])}}je(Au,UW,"StringChunk");var VW;VW=gi;const Zy=class Zy{constructor(e){je(this,"decoder",zce);je(this,"shouldInlineParams",!1);this.queryChunks=e}append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return UVe.startActiveSpan("drizzle.buildSQL",i=>{const n=this.buildQueryFromSourceParams(this.queryChunks,e);return i==null||i.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,i){const n=Object.assign({}
3911,i,{inlineParams:i.inlineParams||this.shouldInlineParams,paramStartIndex:i.paramStartIndex||{value:0}}),{casing:o,escapeName:c,escapeParam:f,prepareTyping:r,inlineParams:x,paramStartIndex:S}=n;return $Ve(e.map(C=>{var I;if(ca(C,Au))return{sql:C.value.join(""),params:[]};if(ca(C,hN))return{sql:c(C.value),params:[]};if(C===void 0)return{sql:"",params:[]};if(Array.isArray(C)){const N=[new Au("(")];for(const[D,V]of C.entries())N.push(V),D<C.length-1&&N.push(new Au(", "));return N.push(new Au(")")),this.buildQueryFromSourceParams(N,n)}if(ca(C,Zy))return this.buildQueryFromSourceParams(C.queryChunks,{...n,inlineParams:x||C.shouldInlineParams});if(ca(C,ic)){const N=C[ic.Symbol.Schema],D=C[ic.Symbol.Name];return{sql:N===void 0||C[dN]?c(D):c(N)+"."+c(D),params:[]}}if(ca(C,$b)){const N=o.getColumnCasing(C);if(i.invokeSource==="indexes")return{sql:c(N),params:[]};const D=C.table[ic.Symbol.Schema];return{sql:C.table[dN]||D===void 0?c(C.table[ic.Symbol.Name])+"."+c(N):c(D)+"."+c(C.table[ic.Symbol.Name])+"."+c(N),params:[]}}if(ca(C,Fce)){const N=C[z0].schema,D=C[z0].name;return{sql:N===void 0||C[z0].isAlias?c(D):c(N)+"."+c(D),params:[]}}if(ca(C,YB)){if(ca(C.value,pN))return{sql:f(S.value++,C),params:[C],typings:["none"]};const N=C.value===null?null:C.encoder.mapToDriverValue(C.value);if(ca(N,Zy))return this.buildQueryFromSourceParams([N],n);if(x)return{sql:this.mapInlineParam(N,n),params:[]};let D=["none"];return r&&(D=[r(C.encoder)]),{sql:f(S.value++,N),params:[N],typings:D}}return ca(C,pN)?{sql:f(S.value++,C),params:[C],typings:["none"]}:ca(C,Zy.Aliased)&&C.fieldAlias!==void 0?{sql:c(C.fieldAlias),params:[]}:ca(C,XB)?C._.isWith?{sql:c(C._.alias),params:[]}:this.buildQueryFromSourceParams([new Au("("),C._.sql,new Au(") "),new hN(C._.alias)],n):BVe(C)?C.schema?{sql:c(C.schema)+"."+c(C.enumName),params:[]}:{sql:c(C.enumName),params:[]}:VVe(C)?(I=C.shouldOmitSQLParens)!=null&&I.call(C)?this.buildQueryFromSourceParams([C.getSQL()],n):this.buildQueryFromSourceParams([new Au("("),C.getSQL(),new Au(")")],n):x?{sql:this.mapInlineParam(C,n),params:[]}:{sql:f(S.value++,C),params:[C],typings:["none"]}}))}mapInlineParam(e,{escapeString:i}){if(e===null)return"null";if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="string")return i(e);if(typeof e=="object"){const n=e.toString();return i(n==="[object Object]"?JSON.stringify(e):n)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return e===void 0?this:new Zy.Aliased(this,e)}mapWith(e){return this.decoder=typeof e=="function"?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}};je(Zy,VW,"SQL");let Vo=Zy;var $W;$W=gi;class hN{constructor(e){je(this,"brand");this.value=e}getSQL(){return new Vo([this])}}je(hN,$W,"Name");const zce={mapFromDriverValue:t=>t},Lce={mapToDriverValue:t=>t};({...zce,...Lce});var qW;qW=gi;class YB{constructor(e,i=Lce){je(this,"brand");this.value=e,this.encoder=i}getSQL(){return new Vo([this])}}je(YB,qW,"Param");function Ca(t,...e){const i=[];(e.length>0||t.length>0&&t[0]!=="")&&i.push(new Au(t[0]));for(const[n,o]of e.entries())i.push(o,new Au(t[n+1]));return new Vo(i)}(t=>{function e(){return new Vo([])}t.empty=e;function i(x){return new Vo(x)}t.fromList=i;function n(x){return new Vo([new Au(x)])}t.raw=n;function o(x,S){const C=[];for(const[I,N]of x.entries())I>0&&S!==void 0&&C.push(S),C.push(N);return new Vo(C)}t.join=o;function c(x){return new hN(x)}t.identifier=c;function f(x){return new pN(x)}t.placeholder=f;function r(x,S){return new YB(x,S)}t.param=r})(Ca||(Ca={}));(t=>{var i;i=gi;const n=class n{constructor(c,f){je(this,"isSelectionField",!1);this.sql=c,this.fieldAlias=f}getSQL(){return this.sql}clone(){return new n(this.sql,this.fieldAlias)}};je(n,i,"SQL.Aliased");let e=n;t.Aliased=e})(Vo||(Vo={}));var HW;HW=gi;class pN{constructor(e){this.name=e}getSQL(){return new Vo([this])}}je(pN,HW,"Placeholder");const Oce=Symbol.for("drizzle:IsDrizzleView");var GW,WW,KW;KW=gi,WW=z0,GW=Oce;class Fce{constructor({name:e,schema:i,selectedFields:n,query:o}){je(this,WW);je(this,GW,!0);
3911this[z0]={name:e,originalName:e,schema:i,selectedFields:n,query:o,isExisting:!o,isAlias:!1}}getSQL(){return new Vo([this])}}je(Fce,KW,"View");function qVe(t){return typeof t=="object"&&t!==null&&Oce in t}$b.prototype.getSQL=function(){return new Vo([this])};ic.prototype.getSQL=function(){return new Vo([this])};XB.prototype.getSQL=function(){return new Vo([this])};function HVe(t){return t[ic.Symbol.Columns]}function GVe(t){return t[z0].selectedFields}function Za(t,e){return{name:typeof t=="string"&&t.length>0?t:"",config:typeof t=="object"?t:e}}var ZW,XW;class zE extends(XW=vs,ZW=gi,XW){generatedAlwaysAsIdentity(e){if(e){const{name:i,...n}=e;this.config.generatedIdentity={type:"always",sequenceName:i,sequenceOptions:n}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){const{name:i,...n}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:i,sequenceOptions:n}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}je(zE,ZW,"PgIntColumnBaseBuilder");var YW,QW;class Bce extends(QW=zE,YW=gi,QW){constructor(e){super(e,"number","PgBigInt53")}build(e){return new Uce(e,this.config)}}je(Bce,YW,"PgBigInt53Builder");var JW,e9;class Uce extends(e9=Pr,JW=gi,e9){getSQLType(){return"bigint"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}je(Uce,JW,"PgBigInt53");var t9,i9;class Vce extends(i9=zE,t9=gi,i9){constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new $ce(e,this.config)}}je(Vce,t9,"PgBigInt64Builder");var n9,r9;class $ce extends(r9=Pr,n9=gi,r9){getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}je($ce,n9,"PgBigInt64");function WVe(t,e){const{name:i,config:n}=Za(t,e);return n.mode==="number"?new Bce(i):new Vce(i)}var s9,o9;class qce extends(o9=vs,s9=gi,o9){constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new Hce(e,this.config)}}je(qce,s9,"PgBigSerial53Builder");var a9,l9;class Hce extends(l9=Pr,a9=gi,l9){getSQLType(){return"bigserial"}mapFromDriverValue(e){return typeof e=="number"?e:Number(e)}}je(Hce,a9,"PgBigSerial53");var c9,u9;class Gce extends(u9=vs,c9=gi,u9){constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new Wce(e,this.config)}}je(Gce,c9,"PgBigSerial64Builder");var d9,h9;class Wce extends(h9=Pr,d9=gi,h9){getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}je(Wce,d9,"PgBigSerial64");function KVe(t,e){const{name:i,config:n}=Za(t,e);return n.mode==="number"?new qce(i):new Gce(i)}var p9,f9;class Kce extends(f9=vs,p9=gi,f9){constructor(e){super(e,"boolean","PgBoolean")}build(e){return new Zce(e,this.config)}}je(Kce,p9,"PgBooleanBuilder");var m9,g9;class Zce extends(g9=Pr,m9=gi,g9){getSQLType(){return"boolean"}}je(Zce,m9,"PgBoolean");function Sa(t){return new Kce(t??"")}var y9,_9;class Xce extends(_9=vs,y9=gi,_9){constructor(e,i){super(e,"string","PgChar"),this.config.length=i.length,this.config.enumValues=i.enum}build(e){return new Yce(e,this.config)}}je(Xce,y9,"PgCharBuilder");var v9,x9;class Yce extends(x9=Pr,v9=gi,x9){constructor(){super(...arguments);je(this,"length",this.config.length);je(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"char":`char(${this.length})`}}je(Yce,v9,"PgChar");function ZVe(t,e={}){const{name:i,config:n}=Za(t,e);return new Xce(i,n)}var b9,w9;class Qce extends(w9=vs,b9=gi,w9){constructor(e){super(e,"string","PgCidr")}build(e){return new Jce(e,this.config)}}je(Qce,b9,"PgCidrBuilder");var S9,T9;class Jce extends(T9=Pr,S9=gi,T9){getSQLType(){return"cidr"}}je(Jce,S9,"PgCidr");function XVe(t){return new Qce(t??"")}var C9,E9;class eue extends(E9=vs,C9=gi,E9){constructor(e,i,n){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=i,this.config.customTypeParams=n}build(e){return new tue(e,this.config)}}je(eue,C9,"PgCustomColumnBuilder");var A9,I9;class tue extends(I9=Pr,A9=gi,I9){constructor(i,n){super(i,n);je(this,"sqlName");je(this,"mapTo");je(this,"mapFrom");this.sqlName=n.customTypeParams.dataType(n.fieldConfig),this.mapTo=n.customTypeParams.toDriver,this.mapFrom=n.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(i){return typeof this.mapFrom=="function"?this.mapFrom(i):i}mapToDriverValue(i){return typeof this.mapTo=="function"?this.mapTo(i):i}}je(tue,A9,"PgCustomColumn");function YVe(t){return(e,i)=>{const{name:n,config:o}=Za(e,i);return new eue(n,o,t)}}var k9,P9;class c1 extends(P9=vs,k9=gi,P9){defaultNow(){return this.default(Ca`now()`)}}je(c1,k9,"PgDateColumnBaseBuilder");var N9,M9;class iue extends(M9=c1,N9=gi,M9){constructor(e){super(e,"date","PgDate")}build(e){return new nue(e,this.config)}}je(iue,N9,"PgDateBuilder");var D9,R9;class nue extends(R9=Pr,D9=gi,R9){getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}je(nue,D9,"PgDate");var j9,z9;class rue extends(z9=c1,j9=gi,z9){constructor(e){super(e,"string","PgDateString")}build(e){return new sue(e,this.config)}}je(rue,j9,"PgDateStringBuilder");var L9,O9;class sue extends(O9=Pr,L9=gi,O9){getSQLType(){return"date"}}je(sue,L9,"PgDateString");function QVe(t,e){const{name:i,config:n}=Za(t,e);return(n==null?void 0:n.mode)==="date"?new iue(i):new rue(i)}var F9,B9;class oue extends(B9=vs,F9=gi,B9){constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new aue(e,this.config)}}je(oue,F9,"PgDoublePrecisionBuilder");var U9,V9;class aue extends(V9=Pr,U9=gi,V9){getSQLType(){return"double precision"}mapFromDriverValue(e){return typeof e=="string"?Number.parseFloat(e):e}}je(aue,U9,"PgDoublePrecision");function JVe(t){return new oue(t??"")}var $9,q9;class lue extends(q9=vs,$9=gi,q9){constructor(e){super(e,"string","PgInet")}build(e){return new cue(e,this.config)}}je(lue,$9,"PgInetBuilder");var H9,G9;class cue extends(G9=Pr,H9=gi,G9){getSQLType(){return"inet"}}je(cue,H9,"PgInet");function e6e(t){return new lue(t??"")}var W9,K9;class uue extends(K9=zE,W9=gi,K9){constructor(e){super(e,"number","PgInteger")}build(e){return new due(e,this.config)}}je(uue,W9,"PgIntegerBuilder");var Z9,X9;class due extends(X9=Pr,Z9=gi,X9){getSQLType(){return"integer"}mapFromDriverValue(e){return typeof e=="string"?Number.parseInt(e):e}}je(due,Z9,"PgInteger");function Vd(t){return new uue(t??"")}var Y9,Q9;class hue extends(Q9=vs,Y9=gi,Q9){constructor(e,i){super(e,"string","PgInterval"),this.config.intervalConfig=i}build(e){return new pue(e,this.config)}}je(hue,Y9,"PgIntervalBuilder");var J9,eK;class pue extends(eK=Pr,J9=gi,eK){constructor(){super(...arguments);je(this,"fields",this.config.intervalConfig.fields);je(this,"precision",this.config.intervalConfig.precision)}getSQLType(){const i=this.fields?` ${this.fields}`:"",n=this.precision?`(${this.precision})`:"";return`interval${i}${n}`}}je(pue,J9,"PgInterval");function t6e(t,e={}){const{name:i,config:n}=Za(t,e);return new hue(i,n)}var tK,iK;class fue extends(iK=vs,tK=gi,iK){constructor(e){super(e,"json","PgJson")}build(e){return new mue(e,this.config)}}je(fue,tK,"PgJsonBuilder");var nK,rK;class mue extends(rK=Pr,nK=gi,rK){constructor(e,i){super(e,i)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}je(mue,nK,"PgJson");function i6e(t){return new fue(t??"")}var sK,oK;class gue extends(oK=vs,sK=gi,oK){constructor(e){super(e,"json","PgJsonb")}build(e){return new yue(e,this.config)}}je(gue,sK,"PgJsonbBuilder");var aK,lK;class yue extends(lK=Pr,aK=gi,lK){constructor(e,i){super(e,i)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e}}je(yue,aK,"PgJsonb");function QB(t){return new gue(t??"")}var cK,uK;class _ue extends(uK=vs,cK=gi,uK){constructor(e){super(e,"array","PgLine")}build(e){return new vue(e,this.config)}}
3911je(_ue,cK,"PgLineBuilder");var dK,hK;class vue extends(hK=Pr,dK=gi,hK){getSQLType(){return"line"}mapFromDriverValue(e){const[i,n,o]=e.slice(1,-1).split(",");return[Number.parseFloat(i),Number.parseFloat(n),Number.parseFloat(o)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}je(vue,dK,"PgLine");var pK,fK;class xue extends(fK=vs,pK=gi,fK){constructor(e){super(e,"json","PgLineABC")}build(e){return new bue(e,this.config)}}je(xue,pK,"PgLineABCBuilder");var mK,gK;class bue extends(gK=Pr,mK=gi,gK){getSQLType(){return"line"}mapFromDriverValue(e){const[i,n,o]=e.slice(1,-1).split(",");return{a:Number.parseFloat(i),b:Number.parseFloat(n),c:Number.parseFloat(o)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}je(bue,mK,"PgLineABC");function n6e(t,e){const{name:i,config:n}=Za(t,e);return!(n!=null&&n.mode)||n.mode==="tuple"?new _ue(i):new xue(i)}var yK,_K;class wue extends(_K=vs,yK=gi,_K){constructor(e){super(e,"string","PgMacaddr")}build(e){return new Sue(e,this.config)}}je(wue,yK,"PgMacaddrBuilder");var vK,xK;class Sue extends(xK=Pr,vK=gi,xK){getSQLType(){return"macaddr"}}je(Sue,vK,"PgMacaddr");function r6e(t){return new wue(t??"")}var bK,wK;class Tue extends(wK=vs,bK=gi,wK){constructor(e){super(e,"string","PgMacaddr8")}build(e){return new Cue(e,this.config)}}je(Tue,bK,"PgMacaddr8Builder");var SK,TK;class Cue extends(TK=Pr,SK=gi,TK){getSQLType(){return"macaddr8"}}je(Cue,SK,"PgMacaddr8");function s6e(t){return new Tue(t??"")}var CK,EK;class Eue extends(EK=vs,CK=gi,EK){constructor(e,i,n){super(e,"string","PgNumeric"),this.config.precision=i,this.config.scale=n}build(e){return new Aue(e,this.config)}}je(Eue,CK,"PgNumericBuilder");var AK,IK;class Aue extends(IK=Pr,AK=gi,IK){constructor(i,n){super(i,n);je(this,"precision");je(this,"scale");this.precision=n.precision,this.scale=n.scale}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}je(Aue,AK,"PgNumeric");function Iue(t,e){const{name:i,config:n}=Za(t,e);return new Eue(i,n==null?void 0:n.precision,n==null?void 0:n.scale)}const pa=Iue;var kK,PK;class kue extends(PK=vs,kK=gi,PK){constructor(e){super(e,"array","PgPointTuple")}build(e){return new Pue(e,this.config)}}je(kue,kK,"PgPointTupleBuilder");var NK,MK;class Pue extends(MK=Pr,NK=gi,MK){getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[i,n]=e.slice(1,-1).split(",");return[Number.parseFloat(i),Number.parseFloat(n)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}je(Pue,NK,"PgPointTuple");var DK,RK;class Nue extends(RK=vs,DK=gi,RK){constructor(e){super(e,"json","PgPointObject")}build(e){return new Mue(e,this.config)}}je(Nue,DK,"PgPointObjectBuilder");var jK,zK;class Mue extends(zK=Pr,jK=gi,zK){getSQLType(){return"point"}mapFromDriverValue(e){if(typeof e=="string"){const[i,n]=e.slice(1,-1).split(",");return{x:Number.parseFloat(i),y:Number.parseFloat(n)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}je(Mue,jK,"PgPointObject");function o6e(t,e){const{name:i,config:n}=Za(t,e);return!(n!=null&&n.mode)||n.mode==="tuple"?new kue(i):new Nue(i)}function a6e(t){const e=[];for(let i=0;i<t.length;i+=2)e.push(Number.parseInt(t.slice(i,i+2),16));return new Uint8Array(e)}function Z7(t,e){const i=new ArrayBuffer(8),n=new DataView(i);for(let o=0;o<8;o++)n.setUint8(o,t[e+o]);return n.getFloat64(0,!0)}function Due(t){const e=a6e(t);let i=0;const n=e[i];i+=1;const o=new DataView(e.buffer),c=o.getUint32(i,n===1);if(i+=4,c&536870912&&(o.getUint32(i,n===1),i+=4),(c&65535)===1){const f=Z7(e,i);i+=8;const r=Z7(e,i);return i+=8,[f,r]}throw new Error("Unsupported geometry type")}var LK,OK;class Rue extends(OK=vs,LK=gi,OK){constructor(e){super(e,"array","PgGeometry")}build(e){return new jue(e,this.config)}}je(Rue,LK,"PgGeometryBuilder");var FK,BK;class jue extends(BK=Pr,FK=gi,BK){getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return Due(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}je(jue,FK,"PgGeometry");var UK,VK;class zue extends(VK=vs,UK=gi,VK){constructor(e){super(e,"json","PgGeometryObject")}build(e){return new Lue(e,this.config)}}je(zue,UK,"PgGeometryObjectBuilder");var $K,qK;class Lue extends(qK=Pr,$K=gi,qK){getSQLType(){return"geometry(point)"}mapFromDriverValue(e){const i=Due(e);return{x:i[0],y:i[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}je(Lue,$K,"PgGeometryObject");function l6e(t,e){const{name:i,config:n}=Za(t,e);return!(n!=null&&n.mode)||n.mode==="tuple"?new Rue(i):new zue(i)}var HK,GK;class Oue extends(GK=vs,HK=gi,GK){constructor(e,i){super(e,"number","PgReal"),this.config.length=i}build(e){return new Fue(e,this.config)}}je(Oue,HK,"PgRealBuilder");var WK,KK;class Fue extends(KK=Pr,WK=gi,KK){constructor(i,n){super(i,n);je(this,"mapFromDriverValue",i=>typeof i=="string"?Number.parseFloat(i):i)}getSQLType(){return"real"}}je(Fue,WK,"PgReal");function c6e(t){return new Oue(t??"")}var ZK,XK;class Bue extends(XK=vs,ZK=gi,XK){constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new Uue(e,this.config)}}
3911je(Bue,ZK,"PgSerialBuilder");var YK,QK;class Uue extends(QK=Pr,YK=gi,QK){getSQLType(){return"serial"}}je(Uue,YK,"PgSerial");function mf(t){return new Bue(t??"")}var JK,eZ;class Vue extends(eZ=zE,JK=gi,eZ){constructor(e){super(e,"number","PgSmallInt")}build(e){return new $ue(e,this.config)}}je(Vue,JK,"PgSmallIntBuilder");var tZ,iZ;class $ue extends(iZ=Pr,tZ=gi,iZ){constructor(){super(...arguments);je(this,"mapFromDriverValue",i=>typeof i=="string"?Number(i):i)}getSQLType(){return"smallint"}}je($ue,tZ,"PgSmallInt");function u6e(t){return new Vue(t??"")}var nZ,rZ;class que extends(rZ=vs,nZ=gi,rZ){constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new Hue(e,this.config)}}je(que,nZ,"PgSmallSerialBuilder");var sZ,oZ;class Hue extends(oZ=Pr,sZ=gi,oZ){getSQLType(){return"smallserial"}}je(Hue,sZ,"PgSmallSerial");function d6e(t){return new que(t??"")}var aZ,lZ;class Gue extends(lZ=vs,aZ=gi,lZ){constructor(e,i){super(e,"string","PgText"),this.config.enumValues=i.enum}build(e){return new Wue(e,this.config)}}je(Gue,aZ,"PgTextBuilder");var cZ,uZ;class Wue extends(uZ=Pr,cZ=gi,uZ){constructor(){super(...arguments);je(this,"enumValues",this.config.enumValues)}getSQLType(){return"text"}}je(Wue,cZ,"PgText");function Io(t,e={}){const{name:i,config:n}=Za(t,e);return new Gue(i,n)}var dZ,hZ;class Kue extends(hZ=c1,dZ=gi,hZ){constructor(e,i,n){super(e,"string","PgTime"),this.withTimezone=i,this.precision=n,this.config.withTimezone=i,this.config.precision=n}build(e){return new Zue(e,this.config)}}je(Kue,dZ,"PgTimeBuilder");var pZ,fZ;class Zue extends(fZ=Pr,pZ=gi,fZ){constructor(i,n){super(i,n);je(this,"withTimezone");je(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}je(Zue,pZ,"PgTime");function h6e(t,e={}){const{name:i,config:n}=Za(t,e);return new Kue(i,n.withTimezone??!1,n.precision)}var mZ,gZ;class Xue extends(gZ=c1,mZ=gi,gZ){constructor(e,i,n){super(e,"date","PgTimestamp"),this.config.withTimezone=i,this.config.precision=n}build(e){return new Yue(e,this.config)}}je(Xue,mZ,"PgTimestampBuilder");var yZ,_Z;class Yue extends(_Z=Pr,yZ=gi,_Z){constructor(i,n){super(i,n);je(this,"withTimezone");je(this,"precision");je(this,"mapFromDriverValue",i=>new Date(this.withTimezone?i:i+"+0000"));je(this,"mapToDriverValue",i=>i.toISOString());this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}}je(Yue,yZ,"PgTimestamp");var vZ,xZ;class Que extends(xZ=c1,vZ=gi,xZ){constructor(e,i,n){super(e,"string","PgTimestampString"),this.config.withTimezone=i,this.config.precision=n}build(e){return new Jue(e,this.config)}}je(Que,vZ,"PgTimestampStringBuilder");var bZ,wZ;class Jue extends(wZ=Pr,bZ=gi,wZ){constructor(i,n){super(i,n);je(this,"withTimezone");je(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}je(Jue,bZ,"PgTimestampString");function rr(t,e={}){const{name:i,config:n}=Za(t,e);return(n==null?void 0:n.mode)==="string"?new Que(i,n.withTimezone??!1,n.precision):new Xue(i,(n==null?void 0:n.withTimezone)??!1,n==null?void 0:n.precision)}var SZ,TZ;class ede extends(TZ=vs,SZ=gi,TZ){constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(Ca`gen_random_uuid()`)}build(e){return new tde(e,this.config)}}je(ede,SZ,"PgUUIDBuilder");var CZ,EZ;class tde extends(EZ=Pr,CZ=gi,EZ){getSQLType(){return"uuid"}}je(tde,CZ,"PgUUID");function p6e(t){return new ede(t??"")}var AZ,IZ;class ide extends(IZ=vs,AZ=gi,IZ){constructor(e,i){super(e,"string","PgVarchar"),this.config.length=i.length,this.config.enumValues=i.enum}build(e){return new nde(e,this.config)}}je(ide,AZ,"PgVarcharBuilder");var kZ,PZ;class nde extends(PZ=Pr,kZ=gi,PZ){constructor(){super(...arguments);je(this,"length",this.config.length);je(this,"enumValues",this.config.enumValues)}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}}je(nde,kZ,"PgVarchar");function _i(t,e={}){const{name:i,config:n}=Za(t,e);return new ide(i,n)}var NZ,MZ;class rde extends(MZ=vs,NZ=gi,MZ){constructor(e,i){super(e,"string","PgBinaryVector"),this.config.dimensions=i.dimensions}build(e){return new sde(e,this.config)}}je(rde,NZ,"PgBinaryVectorBuilder");var DZ,RZ;class sde extends(RZ=Pr,DZ=gi,RZ){constructor(){super(...arguments);je(this,"dimensions",this.config.dimensions)}getSQLType(){return`bit(${this.dimensions})`}}
3911je(sde,DZ,"PgBinaryVector");function f6e(t,e){const{name:i,config:n}=Za(t,e);return new rde(i,n)}var jZ,zZ;class ode extends(zZ=vs,jZ=gi,zZ){constructor(e,i){super(e,"array","PgHalfVector"),this.config.dimensions=i.dimensions}build(e){return new ade(e,this.config)}}je(ode,jZ,"PgHalfVectorBuilder");var LZ,OZ;class ade extends(OZ=Pr,LZ=gi,OZ){constructor(){super(...arguments);je(this,"dimensions",this.config.dimensions)}getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){return i.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}}je(ade,LZ,"PgHalfVector");function m6e(t,e){const{name:i,config:n}=Za(t,e);return new ode(i,n)}var FZ,BZ;class lde extends(BZ=vs,FZ=gi,BZ){constructor(e,i){super(e,"string","PgSparseVector"),this.config.dimensions=i.dimensions}build(e){return new cde(e,this.config)}}je(lde,FZ,"PgSparseVectorBuilder");var UZ,VZ;class cde extends(VZ=Pr,UZ=gi,VZ){constructor(){super(...arguments);je(this,"dimensions",this.config.dimensions)}getSQLType(){return`sparsevec(${this.dimensions})`}}je(cde,UZ,"PgSparseVector");function g6e(t,e){const{name:i,config:n}=Za(t,e);return new lde(i,n)}var $Z,qZ;class ude extends(qZ=vs,$Z=gi,qZ){constructor(e,i){super(e,"array","PgVector"),this.config.dimensions=i.dimensions}build(e){return new dde(e,this.config)}}je(ude,$Z,"PgVectorBuilder");var HZ,GZ;class dde extends(GZ=Pr,HZ=gi,GZ){constructor(){super(...arguments);je(this,"dimensions",this.config.dimensions)}getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(i){return JSON.stringify(i)}mapFromDriverValue(i){return i.slice(1,-1).split(",").map(n=>Number.parseFloat(n))}}je(dde,HZ,"PgVector");function y6e(t,e){const{name:i,config:n}=Za(t,e);return new ude(i,n)}function _6e(){return{bigint:WVe,bigserial:KVe,boolean:Sa,char:ZVe,cidr:XVe,customType:YVe,date:QVe,doublePrecision:JVe,inet:e6e,integer:Vd,interval:t6e,json:i6e,jsonb:QB,line:n6e,macaddr:r6e,macaddr8:s6e,numeric:Iue,point:o6e,geometry:l6e,real:c6e,serial:mf,smallint:u6e,smallserial:d6e,text:Io,time:h6e,timestamp:rr,uuid:p6e,varchar:_i,bit:f6e,halfvec:m6e,sparsevec:g6e,vector:y6e}}const BF=Symbol.for("drizzle:PgInlineForeignKeys"),X7=Symbol.for("drizzle:EnableRLS");var WZ,KZ,ZZ,XZ,YZ;class DT extends(YZ=ic,XZ=gi,ZZ=BF,KZ=X7,WZ=ic.Symbol.ExtraConfigBuilder,YZ){constructor(){super(...arguments);je(this,ZZ,[]);je(this,KZ,!1);je(this,WZ)}}je(DT,XZ,"PgTable"),je(DT,"Symbol",Object.assign({},ic.Symbol,{InlineForeignKeys:BF,EnableRLS:X7}));function v6e(t,e,i,n,o=t){const c=new DT(t,n,o),f=typeof e=="function"?e(_6e()):e,r=Object.fromEntries(Object.entries(f).map(([C,I])=>{const N=I;N.setName(C);const D=N.build(c);return c[BF].push(...N.buildForeignKeys(D,c)),[C,D]})),x=Object.fromEntries(Object.entries(f).map(([C,I])=>{const N=I;N.setName(C);const D=N.buildExtraConfigColumn(c);return[C,D]})),S=Object.assign(c,r);return S[ic.Symbol.Columns]=r,S[ic.Symbol.ExtraConfigColumns]=x,i&&(S[DT.Symbol.ExtraConfigBuilder]=i),Object.assign(S,{enableRLS:()=>(S[DT.Symbol.EnableRLS]=!0,S)})}const No=(t,e,i)=>v6e(t,e,i,void 0);var QZ;QZ=gi;class hde{constructor(e,i){je(this,"brand");this.name=e,this.value=i}build(e){return new pde(e,this)}}je(hde,QZ,"PgCheckBuilder");var JZ;JZ=gi;class pde{constructor(e,i){je(this,"name");je(this,"value");this.table=e,this.name=i.name,this.value=i.value}}je(pde,JZ,"PgCheck");function x6e(t,e){return new hde(t,e)}var eX;eX=gi;class JB{constructor(e,i){this.unique=e,this.name=i}on(...e){return new dk(e.map(i=>{if(ca(i,Vo))return i;i=i;const n=new uk(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=JSON.parse(JSON.stringify(i.defaultConfig)),n}),this.unique,!1,this.name)}onOnly(...e){return new dk(e.map(i=>{if(ca(i,Vo))return i;i=i;const n=new uk(i.name,!!i.keyAsName,i.columnType,i.indexConfig);return i.indexConfig=i.defaultConfig,n}),this.unique,!0,this.name)}using(e,...i){return new dk(i.map(n=>{if(ca(n,Vo))return n;n=n;const o=new uk(n.name,!!n.keyAsName,n.columnType,n.indexConfig);return n.indexConfig=JSON.parse(JSON.stringify(n.defaultConfig)),o}),this.unique,!0,this.name,e)}}je(JB,eX,"PgIndexBuilderOn");var tX;tX=gi;class dk{constructor(e,i,n,o,c="btree"){je(this,"config");this.config={name:o,columns:e,unique:i,only:n,method:c}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new fde(this.config,e)}}je(dk,tX,"PgIndexBuilder");var iX;iX=gi;class fde{constructor(e,i){je(this,"config");this.config={...e,table:i}}}je(fde,iX,"PgIndex");function hs(t){return new JB(!1,t)}function LE(t){return new JB(!0,t)}const wo={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-0x800000000000,INT48_MAX:0x7fffffffffff,INT48_UNSIGNED_MAX:0xffffffffffff,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};function Ko(t,e){return e.includes(t.columnType)}function b6e(t){return"enumValues"in t&&Array.isArray(t.enumValues)&&t.enumValues.length>0}const w6e=Xt.union([Xt.string(),Xt.number(),Xt.boolean(),Xt.null()]),S6e=Xt.union([w6e,Xt.record(Xt.any()),Xt.array(Xt.any())]),T6e=Xt.custom(t=>t instanceof Buffer);function mde(t,e){const i=(e==null?void 0:e.zodInstance)??Xt,n=(e==null?void 0:e.coerce)??{};let o;return b6e(t)&&(o=t.enumValues.length?i.enum(t.enumValues):i.string()),o||(Ko(t,["PgGeometry","PgPointTuple"])?o=i.tuple([i.number(),i.number()]):Ko(t,["PgGeometryObject","PgPointObject"])?o=i.object({x:i.number(),y:i.number()}):Ko(t,["PgHalfVector","PgVector"])?(o=i.array(i.number()),o=t.dimensions?o.length(t.dimensions):o):Ko(t,["PgLine"])?o=i.tuple([i.number(),i.number(),i.number()]):Ko(t,["PgLineABC"])?o=i.object({a:i.number(),b:i.number(),c:i.number()}):Ko(t,["PgArray"])?(o=i.array(mde(t.baseColumn,i)),o=t.size?o.length(t.size):o):t.dataType==="array"?o=i.array(i.any()):t.dataType==="number"?o=C6e(t,
3911i,n):t.dataType==="bigint"?o=E6e(t,i,n):t.dataType==="boolean"?o=n===!0||n.boolean?i.coerce.boolean():i.boolean():t.dataType==="date"?o=n===!0||n.date?i.coerce.date():i.date():t.dataType==="string"?o=A6e(t,i,n):t.dataType==="json"?o=S6e:t.dataType==="custom"?o=i.any():t.dataType==="buffer"&&(o=T6e)),o||(o=i.any()),o}function C6e(t,e,i){let n=t.getSQLType().includes("unsigned"),o,c,f=!1;Ko(t,["MySqlTinyInt","SingleStoreTinyInt"])?(o=n?0:wo.INT8_MIN,c=n?wo.INT8_UNSIGNED_MAX:wo.INT8_MAX,f=!0):Ko(t,["PgSmallInt","PgSmallSerial","MySqlSmallInt","SingleStoreSmallInt"])?(o=n?0:wo.INT16_MIN,c=n?wo.INT16_UNSIGNED_MAX:wo.INT16_MAX,f=!0):Ko(t,["PgReal","MySqlFloat","MySqlMediumInt","SingleStoreMediumInt","SingleStoreFloat"])?(o=n?0:wo.INT24_MIN,c=n?wo.INT24_UNSIGNED_MAX:wo.INT24_MAX,f=Ko(t,["MySqlMediumInt","SingleStoreMediumInt"])):Ko(t,["PgInteger","PgSerial","MySqlInt","SingleStoreInt"])?(o=n?0:wo.INT32_MIN,c=n?wo.INT32_UNSIGNED_MAX:wo.INT32_MAX,f=!0):Ko(t,["PgDoublePrecision","MySqlReal","MySqlDouble","SingleStoreReal","SingleStoreDouble","SQLiteReal"])?(o=n?0:wo.INT48_MIN,c=n?wo.INT48_UNSIGNED_MAX:wo.INT48_MAX):Ko(t,["PgBigInt53","PgBigSerial53","MySqlBigInt53","MySqlSerial","SingleStoreBigInt53","SingleStoreSerial","SQLiteInteger"])?(n=n||Ko(t,["MySqlSerial","SingleStoreSerial"]),o=n?0:Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER,f=!0):Ko(t,["MySqlYear","SingleStoreYear"])?(o=1901,c=2155,f=!0):(o=Number.MIN_SAFE_INTEGER,c=Number.MAX_SAFE_INTEGER);let r=i===!0||i!=null&&i.number?e.coerce.number():e.number();return r=r.min(o).max(c),f?r.int():r}function E6e(t,e,i){const n=t.getSQLType().includes("unsigned"),o=n?0n:wo.INT64_MIN,c=n?wo.INT64_UNSIGNED_MAX:wo.INT64_MAX;return(i===!0||i!=null&&i.bigint?e.coerce.bigint():e.bigint()).min(o).max(c)}function A6e(t,e,i){if(Ko(t,["PgUUID"]))return e.string().uuid();let n,o,c=!1;Ko(t,["PgVarchar","SQLiteText"])?n=t.length:Ko(t,["MySqlVarChar","SingleStoreVarChar"])?n=t.length??wo.INT16_UNSIGNED_MAX:Ko(t,["MySqlText","SingleStoreText"])&&(t.textType==="longtext"?n=wo.INT32_UNSIGNED_MAX:t.textType==="mediumtext"?n=wo.INT24_UNSIGNED_MAX:t.textType==="text"?n=wo.INT16_UNSIGNED_MAX:n=wo.INT8_UNSIGNED_MAX),Ko(t,["PgChar","MySqlChar","SingleStoreChar"])&&(n=t.length,c=!0),Ko(t,["PgBinaryVector"])&&(o=/^[01]+$/,n=t.dimensions);let f=i===!0||i!=null&&i.string?e.coerce.string():e.string();return f=o?f.regex(o):f,n&&c?f.length(n):n?f.max(n):f}function gde(t){return jce(t)?HVe(t):GVe(t)}function yde(t,e,i,n){const o={};for(const[c,f]of Object.entries(t)){if(!ca(f,$b)&&!ca(f,Vo)&&!ca(f,Vo.Aliased)&&typeof f=="object"){const I=jce(f)||qVe(f)?gde(f):f;o[c]=yde(I,e[c]??{},i,n);continue}const r=e[c];if(r!==void 0&&typeof r!="function"){o[c]=r;continue}const x=ca(f,$b)?f:void 0,S=x?mde(x,n):Xt.any(),C=typeof r=="function"?r(S):S;i.never(x)||(o[c]=C,x&&(i.nullable(x)&&(o[c]=o[c].nullable()),i.optional(x)&&(o[c]=o[c].optional())))}return Xt.object(o)}const I6e={never:t=>{var e,i;return((e=t==null?void 0:t.generated)==null?void 0:e.type)==="always"||((i=t==null?void 0:t.generatedIdentity)==null?void 0:i.type)==="always"},optional:t=>!t.notNull||t.notNull&&t.hasDefault,nullable:t=>!t.notNull},gf=(t,e)=>{const i=gde(t);return yde(i,e??{},I6e)};No("sessions",{sid:_i("sid").primaryKey(),sess:QB("sess").notNull(),expire:rr("expire").notNull()},t=>[hs("IDX_session_expire").on(t.expire)]);const Xs=No("users",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),email:_i("email").unique(),firstName:_i("first_name"),lastName:_i("last_name"),profileImageUrl:_i("profile_image_url"),storeCoverImageUrl:_i("store_cover_image_url"),memberNumber:Vd("member_number").unique(),isAdmin:Sa("is_admin").default(!1).notNull(),isProfessional:Sa("is_professional").default(!1).notNull(),professionalActivatedAt:rr("professional_activated_at"),professionalExpiryNotified:Sa("professional_expiry_notified").default(!1).notNull(),professionalExpiredNotified:Sa("professional_expired_notified").default(!1).notNull(),referralCode:_i("referral_code",{length:10}).unique(),referredBy:_i("referred_by").references(()=>Xs.id,{onDelete:"set null"}),referralCount:Vd("referral_count").default(0).notNull(),phone:_i("phone",{length:50}),address:Io("address"),city:_i("city",{length:100}),street:_i("street",{length:200}),streetNumber:_i("street_number",{length:20}),locality:_i("locality",{length:100}
3911),municipality:_i("municipality",{length:100}),province:_i("province",{length:10}),postalCode:_i("postal_code",{length:20}),country:_i("country",{length:100}),latitude:pa("latitude",{precision:10,scale:7}),longitude:pa("longitude",{precision:10,scale:7}),dateOfBirth:rr("date_of_birth"),codiceFiscale:_i("codice_fiscale",{length:16}),profession:_i("profession",{length:200}),bio:Io("bio"),website:_i("website",{length:255}),profileCompleted:Sa("profile_completed").default(!1).notNull(),privacyAcceptedAt:rr("privacy_accepted_at"),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()});No("wallets",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),userId:_i("user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}).unique(),name:_i("name",{length:100}),balance:pa("balance",{precision:10,scale:2}).default("0").notNull(),signupBonusApplied:Sa("signup_bonus_applied").default(!1).notNull(),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()});const _de=No("transactions",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),type:_i("type",{length:50}).notNull(),amount:pa("amount",{precision:10,scale:2}).notNull(),fromUserId:_i("from_user_id").references(()=>Xs.id,{onDelete:"set null"}),toUserId:_i("to_user_id").references(()=>Xs.id,{onDelete:"set null"}),createdById:_i("created_by_id").references(()=>Xs.id,{onDelete:"set null"}),description:Io("description"),createdAt:rr("created_at").defaultNow()},t=>[LE("unique_signup_bonus_per_user").on(t.type,t.toUserId).where(Ca`${t.type} = 'signup_bonus'`)]);No("admin_audit_logs",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),actorId:_i("actor_id").references(()=>Xs.id,{onDelete:"cascade"}),targetId:_i("target_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),action:_i("action",{length:50}).notNull(),reason:Io("reason"),createdAt:rr("created_at").defaultNow()});No("app_settings",{id:_i("id").primaryKey().default("default"),signupBonus:pa("signup_bonus",{precision:10,scale:2}).default("100").notNull(),referralBonusReferrer:pa("referral_bonus_referrer",{precision:10,scale:2}).default("20.00").notNull(),referralBonusReferee:pa("referral_bonus_referee",{precision:10,scale:2}).default("10.00").notNull(),professionalUpgradePrice:pa("professional_upgrade_price",{precision:10,scale:2}).default("50.00").notNull(),volunteerServiceReward:pa("volunteer_service_reward",{precision:10,scale:2}).default("50.00").notNull(),platformWalletUserId:_i("platform_wallet_user_id").references(()=>Xs.id,{onDelete:"set null"}),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow(),updatedById:_i("updated_by_id").references(()=>Xs.id,{onDelete:"set null"})});gf(_de).omit({id:!0,createdAt:!0});const k6e=Xt.object({toUserId:Xt.string().min(1,"Recipient is required"),amount:Xt.string().refine(t=>{const e=parseFloat(t);return!isNaN(e)&&e>0},"Amount must be greater than 0"),description:Xt.string().optional()}),P6e=Xt.object({userId:Xt.string().min(1,"User is required"),amount:Xt.string().refine(t=>{const e=parseFloat(t);return!isNaN(e)&&e>0},"Amount must be greater than 0"),description:Xt.string().optional()}),N6e=Xt.object({name:Xt.string().min(1,"Wallet name is required").max(100,"Wallet name must be less than 100 characters")});Xt.object({userId:Xt.string().min(1,"User ID is required"),isAdmin:Xt.boolean(),reason:Xt.string().optional()});const M6e=Xt.object({firstName:Xt.string().min(1,"First name is required").max(100,"First name is too long"),lastName:Xt.string().min(1,"Last name is required").max(100,"Last name is too long"),phone:Xt.string().min(1,"Phone is required").max(50,"Phone is too long"),address:Xt.string().min(1,"Address is required"),city:Xt.string().min(1,"City is required").max(100,"City is too long"),dateOfBirth:Xt.string().refine(t=>{const e=new Date(t);return!isNaN(e.getTime())&&e<new Date},"Date of birth must be a valid date in the past"),codiceFiscale:Xt.string().min(16,"Il Codice Fiscale deve essere di 16 caratteri").max(16,"Il Codice Fiscale deve essere di 16 caratteri").regex(/^[A-Z0-9]{16}$/,"Il Codice Fiscale deve contenere solo lettere maiuscole e numeri").transform(t=>t.toUpperCase()),profession:Xt.string().min(1,"Profession is required").max(200,"Profession is too long"),bio:Xt.string().max(1e3,"Bio is too long").optional(),website:Xt.union([Xt.literal(""),Xt.string().url("Please enter a valid URL")])}),D6e=Xt.object({signupBonus:Xt.string().refine(t=>{const e=parseFloat(t);return!isNaN(e)&&e>=0},"Signup bonus must be a non-negative number")});
3911Xt.object({professionalUpgradePrice:Xt.string().refine(t=>{const e=parseFloat(t);return!isNaN(e)&&e>0},"Professional upgrade price must be greater than 0")});const R6e=Xt.object({amount:Xt.string().refine(t=>{const e=parseFloat(t);return!isNaN(e)&&e>0},"Amount must be greater than 0"),description:Xt.string().min(1,"Description is required")}),j6e=Xt.object({content:Xt.string().min(1,"Message content is required"),imageUrl:Xt.string().optional()}),z6e=No("categories",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),name:_i("name",{length:100}).notNull(),description:Io("description"),icon:_i("icon",{length:50}),priceOptional:Sa("price_optional").default(!1),createdAt:rr("created_at").defaultNow()}),HM=No("listings",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),userId:_i("user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),categoryId:_i("category_id").references(()=>z6e.id,{onDelete:"set null"}),title:_i("title",{length:200}).notNull(),description:Io("description").notNull(),serviceType:_i("service_type",{length:50}).notNull().default("standard"),isRecurring:Sa("is_recurring").default(!1),maxVolunteers:Vd("max_volunteers").default(1),priceEuros:pa("price_euros",{precision:10,scale:2}),priceCredits:pa("price_credits",{precision:10,scale:2}),address:Io("address"),city:_i("city",{length:100}),country:_i("country",{length:100}),latitude:pa("latitude",{precision:10,scale:7}),longitude:pa("longitude",{precision:10,scale:7}),images:Io("images").array(),videoUrl:_i("video_url",{length:500}),isActive:Sa("is_active").default(!0).notNull(),requiresContact:Sa("requires_contact").default(!1).notNull(),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()},t=>[hs("idx_listings_user_id").on(t.userId),hs("idx_listings_category_id").on(t.categoryId),hs("idx_listings_city").on(t.city),hs("idx_listings_service_type").on(t.serviceType)]),vde=No("orders",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),listingId:_i("listing_id").notNull().references(()=>HM.id,{onDelete:"cascade"}),buyerId:_i("buyer_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),sellerId:_i("seller_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),amountEuros:pa("amount_euros",{precision:10,scale:2}),amountCredits:pa("amount_credits",{precision:10,scale:2}),status:_i("status",{length:50}).notNull().default("pending"),buyerNotes:Io("buyer_notes"),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow(),completedAt:rr("completed_at"),expiresAt:rr("expires_at")},t=>[hs("idx_orders_buyer_id").on(t.buyerId),hs("idx_orders_seller_id").on(t.sellerId),hs("idx_orders_listing_id").on(t.listingId),hs("idx_orders_status").on(t.status)]);No("credit_reservations",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),orderId:_i("order_id").notNull().references(()=>vde.id,{onDelete:"cascade"}).unique(),userId:_i("user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),amount:pa("amount",{precision:10,scale:2}).notNull(),status:_i("status",{length:50}).notNull().default("reserved"),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()},t=>[hs("idx_reservations_user_id").on(t.userId),hs("idx_reservations_status").on(t.status)]);const L6e=No("messages",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),fromUserId:_i("from_user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),toUserId:_i("to_user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),listingId:_i("listing_id").references(()=>HM.id,{onDelete:"set null"}),content:Io("content").notNull(),imageUrl:Io("image_url"),isRead:Sa("is_read").default(!1).notNull(),allowsReply:Sa("allows_reply").default(!0).notNull(),createdAt:rr("created_at").defaultNow()},t=>[hs("idx_messages_from_user").on(t.fromUserId),hs("idx_messages_to_user").on(t.toUserId),hs("idx_messages_listing").on(t.listingId)]);No("community_messages",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),authorUserId:_i("author_user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),content:Io("content"),imageUrl:Io("image_url"),createdAt:rr("created_at").notNull().defaultNow(),deletedAt:rr("deleted_at"),deletedByUserId:_
3911i("deleted_by_user_id").references(()=>Xs.id,{onDelete:"set null"})},t=>[hs("idx_community_messages_created_at").on(t.createdAt),hs("idx_community_messages_created_cursor").on(t.createdAt,t.id),hs("idx_community_messages_author").on(t.authorUserId),hs("idx_community_messages_deleted_at").on(t.deletedAt),x6e("community_messages_content_or_image",Ca`(${t.content} IS NOT NULL AND length(btrim(${t.content})) > 0) OR ${t.imageUrl} IS NOT NULL`)]);No("stripe_payments",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),userId:_i("user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),stripePaymentId:_i("stripe_payment_id",{length:255}).notNull().unique(),type:_i("type",{length:50}).notNull(),amount:pa("amount",{precision:10,scale:2}).notNull(),currency:_i("currency",{length:3}).notNull().default("EUR"),status:_i("status",{length:50}).notNull(),metadata:QB("metadata"),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()},t=>[hs("idx_stripe_payments_user_id").on(t.userId),hs("idx_stripe_payments_type").on(t.type),hs("idx_stripe_payments_status").on(t.status)]);const O6e=No("volunteer_assignments",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),listingId:_i("listing_id").notNull().references(()=>HM.id,{onDelete:"cascade"}),volunteerId:_i("volunteer_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),requesterId:_i("requester_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),status:_i("status",{length:50}).notNull().default("applied"),volunteerNotes:Io("volunteer_notes"),requesterNotes:Io("requester_notes"),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow(),acceptedAt:rr("accepted_at"),completedAt:rr("completed_at"),confirmedAt:rr("confirmed_at")},t=>[hs("idx_volunteer_assignments_listing").on(t.listingId),hs("idx_volunteer_assignments_volunteer").on(t.volunteerId),hs("idx_volunteer_assignments_requester").on(t.requesterId),hs("idx_volunteer_assignments_status").on(t.status),LE("unique_volunteer_per_listing").on(t.listingId,t.volunteerId)]);No("platform_payouts",{id:_i("id").primaryKey().default(Ca`gen_random_uuid()`),assignmentId:_i("assignment_id").notNull().references(()=>O6e.id,{onDelete:"cascade"}).unique(),volunteerId:_i("volunteer_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),amount:pa("amount",{precision:10,scale:2}).notNull(),transactionId:_i("transaction_id").references(()=>_de.id,{onDelete:"set null"}).unique(),status:_i("status",{length:50}).notNull().default("pending"),createdAt:rr("created_at").defaultNow(),paidAt:rr("paid_at")},t=>[hs("idx_platform_payouts_volunteer").on(t.volunteerId),hs("idx_platform_payouts_status").on(t.status),LE("unique_payout_per_assignment").on(t.assignmentId)]);const F6e=No("videos",{id:mf("id").primaryKey(),title:_i("title",{length:255}).notNull(),description:Io("description"),category:_i("category",{length:50}).notNull().default("tutorial"),storagePath:_i("storage_path",{length:500}).notNull(),thumbnailPath:_i("thumbnail_path",{length:500}),durationSeconds:Vd("duration_seconds"),isPublished:Sa("is_published").notNull().default(!1),isFeatured:Sa("is_featured").notNull().default(!1),featuredOrder:Vd("featured_order").default(0),uploadedById:_i("uploaded_by_id").references(()=>Xs.id,{onDelete:"set null"}),publishedAt:rr("published_at"),createdAt:rr("created_at").notNull().defaultNow(),updatedAt:rr("updated_at").notNull().defaultNow()},t=>[hs("idx_videos_category").on(t.category),hs("idx_videos_published").on(t.isPublished),hs("idx_videos_featured").on(t.isFeatured)]),B6e=No("vouchers",{id:mf("id").primaryKey(),code:_i("code",{length:50}).notNull().unique(),name:_i("name",{length:255}).notNull(),bonusType:_i("bonus_type",{length:20}).notNull().default("fixed"),bonusAmount:_i("bonus_amount",{length:50}),bonusMultiplier:_i("bonus_multiplier",{length:50}),targetAudience:_i("target_audience",{length:20}).notNull().default("all"),maxRedemptions:Vd("max_redemptions").default(0),startDate:rr("start_date"),endDate:rr("end_date"),isActive:Sa("is_active").notNull().default(!0),createdById:_i("created_by_id"),createdAt:rr("created_at").notNull().defaultNow()},t=>[hs("idx_vouchers_code").on(t.code),hs("idx_vouchers_active").on(t.isActive)]);No("voucher_redemptions",{id:mf("id").primaryKey(),voucherId:Vd("voucher_id").notNull(),userId:_i("user_id",{length:255}).notNull(),bonusAmount:_i("bonus_amount",{length:50}).notNull(),redeemedAt:rr("redeemed_at").notNull().defaultNow()},t=>[hs("idx_voucher_redemptions_voucher").on(t.voucherId),hs("idx_voucher_redemptions_user").on(t.userId)]);gf(HM,{title:Xt.string().min(5,"Title must be at least 5 characters").max(200),description:Xt.string().min(20,"Description must be at least 20 characters"),serviceType:Xt.enum(["standard","product_service","volunteer_request"]).optional(),isRecurring:Xt.boolean().optional(),maxVolunteers:Xt.number().int().min(1).max(10).optional(),priceEuros:Xt.string().optional(),priceCredits:Xt.string().optional(),address:Xt.string().optional(),city:Xt.string().optional(),country:Xt.string().optional(),images:Xt.array(Xt.string()).optional(),videoUrl:Xt.string().optional()}).omit({id:!0,userId:!0,createdAt:!0,updatedAt:!0,isActive:!0});gf(vde).omit({id:!0,buyerId:!0,sellerId:!0,amountEuros:!0,amountCredits:!0,status:!0,createdAt:!0,updatedAt:!0,completedAt:!0,expiresAt:!0});gf(L6e,{content:Xt.string().min(1,"Message cannot be empty").max(5e3,"Message too long")}).omit({id:!0,fromUserId:!0,createdAt:!0,isRead:!0,allowsReply:!0});Xt.object({content:Xt.string().max(1e3,"Message cannot exceed 1000 characters").optional().nullable(),imageUrl:Xt.string().min(1).max(2e3).optional().nullable()}).superRefine((t,e)=>{var i;!((i=t.content)!=null&&i.trim())&&!t.imageUrl&&e.addIssue({code:Xt.ZodIssueCode.custom,path:["content"],message:"Message must contain text or an image"})});Xt.object({volunteerNotes:Xt.string().optional()});Xt.object({requesterNotes:Xt.string().optional()});
3911gf(B6e,{code:Xt.string().min(3,"Code must be at least 3 characters").max(50).transform(t=>t.toUpperCase()),name:Xt.string().min(1,"Name is required").max(255),bonusType:Xt.enum(["multiplier","fixed"]).default("fixed"),bonusAmount:Xt.string().nullable().optional(),bonusMultiplier:Xt.string().nullable().optional(),targetAudience:Xt.enum(["new_users","existing_users","all"]).default("all"),startDate:Xt.string().or(Xt.date()).nullable().optional(),endDate:Xt.string().or(Xt.date()).nullable().optional(),maxRedemptions:Xt.number().int().nullable().optional(),isActive:Xt.boolean().default(!0)}).omit({id:!0,createdById:!0,createdAt:!0});Xt.object({code:Xt.string().min(1,"Voucher code is required").transform(t=>t.toUpperCase().trim())});const U6e=gf(F6e,{title:Xt.string().min(3,"Title must be at least 3 characters").max(255),description:Xt.string().optional(),category:Xt.enum(["news","divulgazione","tutorial"]).default("tutorial"),storagePath:Xt.string().min(1,"Storage path is required"),thumbnailPath:Xt.string().optional(),durationSeconds:Xt.number().int().min(1).optional(),isPublished:Xt.boolean().default(!1),isFeatured:Xt.boolean().default(!1),featuredOrder:Xt.number().int().default(0)}).omit({id:!0,uploadedById:!0,createdAt:!0,updatedAt:!0,publishedAt:!0});U6e.partial();const V6e=No("platform_documents",{id:mf("id").primaryKey(),title:_i("title",{length:255}).notNull(),description:Io("description"),documentType:_i("document_type",{length:50}).notNull(),storagePath:Io("storage_path").notNull(),fileName:_i("file_name",{length:255}).notNull(),fileSize:Vd("file_size"),mimeType:_i("mime_type",{length:100}),sortOrder:Vd("sort_order").default(0).notNull(),isPublished:Sa("is_published").default(!0).notNull(),uploadedById:_i("uploaded_by_id").references(()=>Xs.id,{onDelete:"set null"}),createdAt:rr("created_at").defaultNow(),updatedAt:rr("updated_at").defaultNow()}),$6e=gf(V6e,{title:Xt.string().min(1,"Title is required").max(255),description:Xt.string().optional(),documentType:Xt.enum(["privacy","ethics","regulations","other"]).default("other"),storagePath:Xt.string().min(1,"Storage path is required"),fileName:Xt.string().min(1,"File name is required"),fileSize:Xt.number().int().optional(),mimeType:Xt.string().optional(),sortOrder:Xt.number().int().default(0),isPublished:Xt.boolean().default(!0)}).omit({id:!0,uploadedById:!0,createdAt:!0,updatedAt:!0});$6e.partial();No("recommendations",{id:mf("id").primaryKey(),fromUserId:_i("from_user_id",{length:255}).notNull().references(()=>Xs.id,{onDelete:"cascade"}),toUserId:_i("to_user_id",{length:255}).notNull().references(()=>Xs.id,{onDelete:"cascade"}),createdAt:rr("created_at").defaultNow()},t=>({uniqueRecommendation:LE("unique_recommendation_idx").on(t.fromUserId,t.toUserId)}));const q6e=No("map_points",{id:mf("id").primaryKey(),name:_i("name",{length:255}).notNull(),address:Io("address"),phone:_i("phone",{length:50}),city:_i("city",{length:100}),latitude:pa("latitude",{precision:10,scale:7}).notNull(),longitude:pa("longitude",{precision:10,scale:7}).notNull(),logoUrl:Io("logo_url"),isVisible:Sa("is_visible").default(!0).notNull(),createdAt:rr("created_at").defaultNow()}),H6e=gf(q6e,{name:Xt.string().min(1,"Name is required").max(255),address:Xt.string().optional().nullable(),phone:Xt.string().optional().nullable(),city:Xt.string().optional().nullable(),latitude:Xt.string().min(1,"Latitude is required"),longitude:Xt.string().min(1,"Longitude is required"),logoUrl:Xt.string().optional().nullable(),isVisible:Xt.boolean().default(!0)}).omit({id:!0,createdAt:!0});H6e.partial();const xde=No("events",{id:mf("id").primaryKey(),title:_i("title",{length:200}).notNull(),description:Io("description").notNull(),posterUrl:Io("poster_url"),eventDate:rr("event_date").notNull(),location:_i("location",{length:255}).notNull(),isPublished:Sa("is_published").default(!0).notNull(),createdById:_i("created_by_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),publishedAt:rr("published_at").defaultNow().notNull(),createdAt:rr("created_at").defaultNow().notNull(),updatedAt:rr("updated_at").defaultNow().notNull()});No("event_reads",{id:mf("id").primaryKey(),eventId:Vd("event_id").notNull().references(()=>
3911xde.id,{onDelete:"cascade"}),userId:_i("user_id").notNull().references(()=>Xs.id,{onDelete:"cascade"}),readAt:rr("read_at").defaultNow().notNull()},t=>[LE("event_reads_event_user_unique").on(t.eventId,t.userId),hs("event_reads_user_idx").on(t.userId)]);const G6e=gf(xde,{title:Xt.string().trim().min(1,"Il titolo è obbligatorio").max(200),description:Xt.string().trim().min(1,"La descrizione è obbligatoria").max(2e3),posterUrl:Xt.string().optional().nullable(),eventDate:Xt.coerce.date(),location:Xt.string().trim().min(1,"Il luogo è obbligatorio").max(255),isPublished:Xt.boolean().default(!0)}).omit({id:!0,createdById:!0,publishedAt:!0,createdAt:!0,updatedAt:!0});G6e.partial();function OE(t){return/^401: .*Unauthorized/.test(t.message)}function W6e({currentUserId:t,onSuccess:e}){const{t:i}=pr(),{toast:n}=ks(),[o,c]=K.useState(""),[f,r]=K.useState(!1),[x,S]=K.useState(""),{data:C=[],isLoading:I}=Xn({queryKey:["/api/users"]}),N=zg({resolver:Lg(k6e),defaultValues:{toUserId:"",amount:"",description:""}}),D=$n({mutationFn:async $=>{await xn("POST","/api/wallets/transfer",$)},onSuccess:()=>{n({title:i("messages.transferSuccess"),description:i("messages.transferSuccessDesc")}),N.reset(),c(""),Qi.invalidateQueries({queryKey:["/api/wallets/my-wallet"]}),Qi.invalidateQueries({queryKey:["/api/transactions/my-history"]}),e==null||e()},onError:$=>{if(OE($)){n({title:i("messages.unauthorized"),description:i("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}n({title:i("messages.transferError"),description:$.message||i("messages.transferErrorDesc"),variant:"destructive"})}}),V=C.filter($=>$.id!==t).sort(($,G)=>{const te=($.lastName||"").toLowerCase(),ce=(G.lastName||"").toLowerCase();if(te!==ce)return te.localeCompare(ce);const _e=($.firstName||"").toLowerCase(),Te=(G.firstName||"").toLowerCase();return _e.localeCompare(Te)}),B=$=>{const G=`${$.firstName||""} ${$.lastName||""}`.trim();return G&&$.email?`${G} (${$.email})`:$.email||G||$.id},W=()=>{if(!o)return i("dashboard.selectUser");const $=V.find(G=>G.id===o);return $?B($):i("dashboard.selectUser")};return d.jsxs(d.Fragment,{children:[d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:i("dashboard.transferCredits")})}),d.jsx(Ji,{children:d.jsx($g,{...N,children:d.jsxs("form",{onSubmit:N.handleSubmit($=>D.mutate($)),className:"space-y-4",children:[d.jsx(ns,{control:N.control,name:"toUserId",render:({field:$})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:i("dashboard.recipient")}),d.jsx(Qr,{children:d.jsxs(tt,{type:"button",variant:"outline",className:"w-full justify-between",onClick:()=>r(!0),disabled:I,"data-testid":"select-recipient",children:[d.jsx("span",{className:o?"":"text-muted-foreground",children:W()}),d.jsx(Qb,{className:"w-4 h-4 ml-2 opacity-50"})]})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:N.control,name:"amount",render:({field:$})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:i("dashboard.amount")}),d.jsx(Qr,{children:d.jsx(an,{type:"number",step:"0.01",min:"0",placeholder:i("dashboard.amountPlaceholder"),...$,"data-testid":"input-amount"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:N.control,name:"description",render:({field:$})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:i("dashboard.descriptionOptional")}),d.jsx(Qr,{children:d.jsx(Uc,{placeholder:i("dashboard.descriptionPlaceholder"),...$,"data-testid":"input-description"})}),d.jsx(Is,{})]})}),d.jsx(tt,{type:"submit",className:"w-full",disabled:D.isPending||V.length===0,"data-testid":"button-transfer",children:D.isPending?i("dashboard.transferring"):d.jsxs(d.Fragment,{children:[d.jsx(JT,{className:"w-4 h-4 mr-2"}),i("dashboard.transferSubmit")]})})]})})})]}),d.jsx(ll,{open:f,onOpenChange:$=>{r($),$||S("")},children:d.jsxs(Va,{className:"max-w-md",children:[d.jsx(cl,{children:d.jsx($a,{children:i("dashboard.selectUser")})}),d.jsxs("div",{className:"relative mb-2",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:i("admin.searchUsers","Cerca utente per nome o email..."),value:x,onChange:$=>S($.target.value),className:"pl-10","data-testid":"input-search-transfer-user"})]}),d.jsxs("div",{className:"max-h-[60vh] overflow-y-auto",children:[V.filter($=>{if(!x.trim())return!0;const G=x.toLowerCase().trim(),te=`${$.firstName||""} ${$.lastName||""}`.toLowerCase(),ce=($.email||"").toLowerCase();return te.includes(G)||ce.includes(G)}).map($=>d.jsx(tt,{variant:"ghost",className:"w-full justify-start mb-1 hover-elevate active-elevate-2",onClick:()=>{N.setValue("toUserId",$.id),c($.id),r(!1),S("")},"data-testid":`user-option-${$.id}`,children:B($)},$.id)),V.filter($=>{if(!x.trim())return!0;const G=x.toLowerCase().trim(),te=`${$.firstName||""} ${$.lastName||""}`.toLowerCase(),ce=($.email||"").toLowerCase();return te.includes(G)||ce.includes(G)}).length===0&&d.jsx("p",{className:"text-center text-muted-foreground py-4",children:x?i("admin.noSearchResults","Nessun utente trovato"):i("dashboard.noOtherUsers")})]})]})})]})}function K6e({open:t,onOpenChange:e,currentName:i}){const{t:n}=pr(),{toast:o}=ks(),c=zg({resolver:Lg(N6e),defaultValues:{name:""}});K.useEffect(()=>{t&&c.reset({name:i||""})},[t,i,c]);const f=$n({mutationFn:async S=>
3911{await xn("PATCH","/api/wallets/my-wallet",S)},onSuccess:()=>{o({title:n("messages.walletUpdateSuccess"),description:n("messages.walletUpdateSuccessDesc")}),Qi.invalidateQueries({queryKey:["/api/wallets/my-wallet"]}),e(!1)},onError:S=>{OE(S)?(o({title:n("messages.unauthorized"),description:n("messages.unauthorizedLogin"),variant:"destructive"}),window.location.href="/api/login"):o({title:n("messages.walletUpdateError"),description:S.message||n("messages.walletUpdateErrorDesc"),variant:"destructive"})}}),r=S=>{S||c.reset({name:i||""}),e(S)},x=S=>{f.mutate(S)};return d.jsx(ll,{open:t,onOpenChange:r,children:d.jsxs(Va,{"data-testid":"dialog-edit-wallet",children:[d.jsxs(cl,{children:[d.jsx($a,{children:n("admin.editWalletName")}),d.jsx(Oc,{children:n("dashboard.walletNameDescription")})]}),d.jsx($g,{...c,children:d.jsxs("form",{onSubmit:c.handleSubmit(x),className:"space-y-4",children:[d.jsx(ns,{control:c.control,name:"name",render:({field:S})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:n("dashboard.walletName")}),d.jsx(Qr,{children:d.jsx(an,{...S,placeholder:n("dashboard.walletNamePlaceholder"),"data-testid":"input-wallet-name"})}),d.jsx(Is,{})]})}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(tt,{type:"button",variant:"outline",onClick:()=>r(!1),disabled:f.isPending,"data-testid":"button-cancel",children:n("common.cancel")}),d.jsx(tt,{type:"submit",disabled:f.isPending,"data-testid":"button-save-wallet-name",children:f.isPending?n("dashboard.saving"):n("common.save")})]})]})})]})})}function Z6e({onSuccess:t}){const{t:e}=pr(),{toast:i}=ks(),[n,o]=K.useState(""),[c,f]=K.useState(null),r=$n({mutationFn:async C=>await(await xn("POST","/api/vouchers/redeem",{code:C.toUpperCase().trim()})).json(),onSuccess:C=>{if(C.success)f({success:!0,message:e("voucher.redeemSuccess",{amount:C.bonusAmount}),bonusAmount:C.bonusAmount}),o(""),Qi.invalidateQueries({queryKey:["/api/wallets/my-wallet"]}),Qi.invalidateQueries({queryKey:["/api/transactions/my-history"]}),i({title:e("voucher.congratulations"),description:e("voucher.redeemSuccess",{amount:C.bonusAmount})}),t==null||t();else{const I=x(C.error);f({success:!1,message:I}),i({title:e("messages.error"),description:I,variant:"destructive"})}},onError:C=>{let I="unknown_error";try{C.message&&(I=JSON.parse(C.message).error||"unknown_error")}catch{I="unknown_error"}const N=x(I);f({success:!1,message:N}),i({title:e("messages.error"),description:N,variant:"destructive"})}}),x=C=>{switch(C){case"voucher_not_found":return e("voucher.errors.notFound");case"voucher_inactive":return e("voucher.errors.inactive");case"voucher_not_started":return e("voucher.errors.notStarted");case"voucher_expired":return e("voucher.errors.expired");case"voucher_new_users_only":return e("voucher.errors.newUsersOnly");case"voucher_existing_users_only":return e("voucher.errors.existingUsersOnly");case"voucher_max_redemptions_reached":return e("voucher.errors.maxRedemptionsReached");case"voucher_already_redeemed":return e("voucher.errors.alreadyRedeemed");default:return e("voucher.errors.generic")}},S=C=>{C.preventDefault(),n.trim()&&(f(null),r.mutate(n))};return d.jsxs(Ti,{"data-testid":"card-redeem-voucher",children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(t1,{className:"w-5 h-5"}),e("voucher.redeemTitle")]}),d.jsx(da,{children:e("voucher.redeemDescription")})]}),d.jsx(Ji,{children:d.jsxs("form",{onSubmit:S,className:"space-y-4",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(an,{value:n,onChange:C=>{o(C.target.value.toUpperCase()),f(null)},placeholder:e("voucher.enterCode"),className:"font-mono uppercase",disabled:r.isPending,"data-testid":"input-voucher-code"}),d.jsx(tt,{type:"submit",disabled:r.isPending||!n.trim(),"data-testid":"button-redeem-voucher",children:r.isPending?d.jsx(lv,{className:"w-4 h-4 animate-spin"}):e("voucher.redeem")})]}),c&&d.jsxs("div",{className:`flex items-start gap-2 p-3 rounded-lg ${c.success?"bg-green-50 dark:bg-green-950 text-green-700 dark:text-green-300":"bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300"}`,"data-testid":c.success?"text-voucher-success":"text-voucher-error",children:[c.success?d.jsx(Wo,{className:"w-5 h-5 mt-0.5 flex-shrink-0"}):d.jsx(Jb,{className:"w-5 h-5 mt-0.5 flex-shrink-0"}),d.jsx("span",{className:"text-sm",children:c.message})]})]})})]})}const X6e=new Date("2026-08-30T23:59:59");function Y6e({user:t}){const{t:e}=pr(),[,i]=$o(),n=K.useRef(null),o=I=>String(I).padStart(5,"0"),c=K.useCallback((I,N)=>{const D=I.getContext("2d");if(!D)return;const V=N?1050:525,B=N?600:300,W=N?2:1;I.width=V,I.height=B,D.save(),D.scale(W,W);const $=525,G=300,te=D.createLinearGradient(0,0,$,G);te.addColorStop(0,"#1a365d"),te.addColorStop(.5,"#2a4a7f"),te.addColorStop(1,"#1a365d"),D.fillStyle=te;const ce=16;D.beginPath(),D.moveTo(ce,0),D.lineTo($-ce,0),D.quadraticCurveTo($,0,$,ce),D.lineTo($,G-ce),D.quadraticCurveTo($,G,$-ce,G),D.lineTo(ce,G),D.quadraticCurveTo(0,G,0,G-ce),D.lineTo(0,ce),D.quadraticCurveTo(0,0,ce,0),D.closePath(),D.fill(),D.strokeStyle="rgba(212, 175, 55, 0.6)",D.lineWidth=2,D.beginPath(),D.moveTo(ce+8,8),D.lineTo($-ce-8,8),D.quadraticCurveTo($-8,8,$-8,ce+8),D.lineTo($-8,G-ce-8),D.quadraticCurveTo($-8,G-8,$-ce-8,G-8),D.lineTo(ce+8,G-8),D.quadraticCurveTo(8,G-8,8,G-ce-8),D.lineTo(8,ce+8),D.quadraticCurveTo(8,8,ce+8,8),D.closePath(),D.stroke(),D.fillStyle="#d4af37",D.font="bold 11px Inter, sans-serif",D.textAlign="left",D.fillText("COMUNITÃ ECONOMICA INDIPENDENT
3911E",80,45),D.fillStyle="rgba(255, 255, 255, 0.9)",D.font="20px Inter, sans-serif",D.fillText(e("memberCard.title","TESSERA ASSOCIATO"),80,72),D.fillStyle="rgba(255, 255, 255, 0.5)",D.font="10px Inter, sans-serif",D.fillText(`N. ${o(t.memberNumber||0)}`,80,90),D.fillStyle="rgba(255, 255, 255, 0.95)",D.font="bold 22px Inter, sans-serif",D.fillText(`${t.firstName||""} ${t.lastName||""}`,30,145),D.fillStyle="rgba(255, 255, 255, 0.6)",D.font="12px Inter, sans-serif";const _e=t.dateOfBirth?new Date(t.dateOfBirth).toLocaleDateString("it-IT"):"-";D.fillText(e("memberCard.birthDate","Data di nascita"),30,178),D.fillStyle="rgba(255, 255, 255, 0.9)",D.font="14px Inter, sans-serif",D.fillText(_e,30,196),D.fillStyle="rgba(255, 255, 255, 0.6)",D.font="12px Inter, sans-serif",D.fillText(e("memberCard.city","Città "),200,178),D.fillStyle="rgba(255, 255, 255, 0.9)",D.font="14px Inter, sans-serif",D.fillText(t.city||t.municipality||"-",200,196),D.fillStyle="rgba(255, 255, 255, 0.6)",D.font="12px Inter, sans-serif",D.fillText(e("memberCard.memberSince","Socio dal"),380,178),D.fillStyle="rgba(255, 255, 255, 0.9)",D.font="14px Inter, sans-serif";const Te=t.createdAt?new Date(t.createdAt).toLocaleDateString("it-IT"):"-";D.fillText(Te,380,196),D.fillStyle="#d4af37",D.font="bold 28px Inter, sans-serif",D.textAlign="right",D.fillText(o(t.memberNumber||0),$-30,265),D.fillStyle="rgba(255, 255, 255, 0.4)",D.font="10px Inter, sans-serif",D.textAlign="center",D.fillText("lacei.it",$/2,G-15),D.restore()},[t,e]),f=K.useCallback(()=>{const I=document.createElement("canvas"),N=new Image;N.crossOrigin="anonymous",N.onload=()=>{c(I,!0);const D=I.getContext("2d");D&&D.drawImage(N,50,56,96,96);const V=document.createElement("a");V.download=`tessera_CEI_${o(t.memberNumber||0)}.png`,V.href=I.toDataURL("image/png"),V.click()},N.onerror=()=>{c(I,!0);const D=document.createElement("a");D.download=`tessera_CEI_${o(t.memberNumber||0)}.png`,D.href=I.toDataURL("image/png"),D.click()},N.src=cf},[c,t.memberNumber]),r=K.useCallback(I=>{if(!I)return;n.current=I;const N=new Image;N.crossOrigin="anonymous",N.onload=()=>{c(I,!1);const D=I.getContext("2d");D&&D.drawImage(N,25,28,48,48)},N.onerror=()=>{c(I,!1)},N.src=cf},[c]),S=new Date<=X6e,C=t.memberNumber&&!t.codiceFiscale;return C&&!S||!t.memberNumber?null:d.jsxs(Ti,{"data-testid":"card-membership",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2",children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Xve,{className:"h-5 w-5"}),e("memberCard.sectionTitle","Tessera Associato CEI")]}),!C&&d.jsxs(tt,{variant:"outline",size:"sm",onClick:f,"data-testid":"button-download-membership-card",children:[d.jsx(ZN,{className:"h-4 w-4 mr-2"}),e("memberCard.download","Scarica")]})]}),d.jsxs(Ji,{className:"space-y-4",children:[C&&d.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-amber-400/60 bg-amber-50 dark:bg-amber-950/30 p-4","data-testid":"banner-cf-required",children:[d.jsx(gxe,{className:"h-5 w-5 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("p",{className:"text-sm font-semibold text-amber-800 dark:text-amber-300",children:e("memberCard.cfRequiredTitle","Conferma la tua tessera entro il 30 agosto 2026")}),d.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:e("memberCard.cfRequiredDesc","La legge italiana richiede il Codice Fiscale per il libro soci. Inseriscilo nel tuo profilo per scaricare la tessera. Dopo il 30 agosto, le tessere senza CF non saranno più valide.")}),d.jsx(tt,{size:"sm",onClick:()=>i("/profile"),"data-testid":"button-add-cf-from-card",children:e("memberCard.addCF","Inserisci Codice Fiscale")})]})]}),d.jsx("div",{className:"flex justify-center",children:d.jsx("canvas",{ref:r,width:525,height:300,className:"rounded-lg max-w-full h-auto",style:{maxWidth:"350px",opacity:C?.4:1},"data-testid":"canvas-membership-card"})}),d.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:[e("memberCard.number","Tessera n.")," ",o(t.memberNumber)]})]})]})}function Q6e(){const{t}=pr(),{user:e,isLoading:i,isAuthenticated:n,isAdmin:o}=Ka();dv();const{toast:c}=ks();$o();const[f,r]=K.useState(!1),[x,S]=K.useState({}),{unreadCount:C}=Sne(),{data:I,isLoading:N}
3911=Xn({queryKey:["/api/wallets/my-wallet"],enabled:!!e}),D=new URLSearchParams;Object.entries(x).forEach(([$,G])=>{G&&D.set($,G)});const V=D.toString(),{data:B=[],isLoading:W}=Xn({queryKey:["/api/transactions/my-history",V],queryFn:async()=>{const $=`/api/transactions/my-history${V?`?${V}`:""}`,G=await fetch($,{credentials:"include"});if(!G.ok)throw new Error(t("messages.fetchError"));return G.json()},enabled:!!e});return K.useEffect(()=>{!i&&!n&&(c({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500))},[n,i,c,t]),i?d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-12 h-12 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("common.loading")})]})}):d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-4 flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-12 h-12"}),d.jsx("span",{className:"text-xl font-bold",children:"Wallet Manager"})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsxs("div",{className:"text-right hidden sm:block",children:[d.jsx("p",{className:"text-sm font-medium",children:e==null?void 0:e.email}),d.jsx("p",{className:"text-xs text-muted-foreground",children:e!=null&&e.firstName&&(e!=null&&e.lastName)?`${e.firstName} ${e.lastName}`:t("user.defaultName")})]}),d.jsx(TE,{}),d.jsx(tt,{variant:"ghost",size:"icon",asChild:!0,"data-testid":"button-messages",className:"relative",children:d.jsxs(yr,{href:"/messages",children:[d.jsx(sf,{className:"w-4 h-4"}),C>0&&d.jsx(En,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 min-w-5 px-1 flex items-center justify-center text-xs","data-testid":"badge-unread-count",children:C})]})}),d.jsx(tt,{variant:"ghost",size:"icon",asChild:!0,"data-testid":"button-profile",children:d.jsx(yr,{href:"/profile",children:d.jsx(ju,{className:"w-4 h-4"})})}),o&&d.jsx(tt,{variant:"default",asChild:!0,"data-testid":"button-admin",children:d.jsxs(yr,{href:"/admin",children:[d.jsx(i1,{className:"w-4 h-4 mr-2"}),"Admin"]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-logout",children:d.jsxs("a",{href:"/api/logout",children:[d.jsx(CJ,{className:"w-4 h-4 mr-2"}),t("common.signOut")]})})]})]})}),d.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",children:[d.jsxs("div",{className:"mb-8 flex items-start justify-between gap-4 flex-wrap",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold mb-2",children:t("dashboard.title")}),d.jsx("p",{className:"text-muted-foreground",children:t("dashboard.subtitle")})]}),d.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e!=null&&e.isProfessional||e!=null&&e.isAdmin?d.jsxs(En,{variant:"default",className:"gap-1","data-testid":"badge-professional",children:[d.jsx(rO,{className:"w-3 h-3"}),"Professional"]}):d.jsx(J6e,{userName:e!=null&&e.firstName&&(e!=null&&e.lastName)?`${e.firstName} ${e.lastName}`:(e==null?void 0:e.email)||""}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-my-listings",children:d.jsxs(yr,{href:"/my-listings",children:[d.jsx(TJ,{className:"w-4 h-4 mr-2"}),t("dashboard.myListings")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-my-orders",children:d.jsxs(yr,{href:"/orders",children:[d.jsx(hxe,{className:"w-4 h-4 mr-2"}),t("dashboard.myOrders","I Miei Ordini")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-volunteer-requests",children:d.jsxs(yr,{href:"/volunteer/my-requests",children:[d.jsx(pT,{className:"w-4 h-4 mr-2"}),t("volunteer.myRequests","Le Mie Richieste")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-messages-quick",className:"relative",children:d.jsxs(yr,{href:"/messages",children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("dashboard.messages"),C>0&&d.jsx(En,{variant:"destructive",className:"ml-1 h-5 min-w-5 px-1.5","data-testid":"badge-messages-count",children:C})]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-referral",children:d.jsxs(yr,{href:"/referral",children:[d.jsx(t1,{className:"w-4 h-4 mr-2"}),t("referral.title")]})}),d.jsx(tt,{variant:"default",asChild:!0,"data-testid":"button-create-listing",children:d.jsxs(yr,{href:"/listings/new",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("dashboard.createListing")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-marketplace",children:d.jsxs(yr,{href:"/",children:[d.jsx(PJ,{className:"w-4 h-4 mr-2"}),t("dashboard.goToMarketplace")]})})]})]}),d.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[d.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[d.jsx(zVe,{balance:(I==null?void 0:I.balance)||"0",walletName:I==null?void 0:I.name,isLoading:N,onEditName:()=>r(!0)}),d.jsx(Ece,{transactions:B,currentUserId:e==null?void 0:e.id,isLoading:W,isAdmin:o,onFilterChange:S})]}),d.jsxs("div",{className:"space-y-6",children:[d.jsx(W6e,{currentUserId:(e==null?void 0:e.id)||""}),d.jsx(Z6e,{}),e&&d.jsx(Y6e,{user:e})]})]})]}),d.jsx(K6e,{open:f,onOpenChange:r,currentName:I==null?void 0:I.name})]})}function J6e({userName:t}){const{t:e}=pr(),{toast:i}=ks(),n="IT69V0760113700001079832869",o=`Attivazione Profilo Professionale per l'account CEI ${t}`,c=(f,r)=>{navigator.clipboard.writeText(f).then(()=>{i({title:e("common.copied","Copiato!"),description:`${r} ${e("common.copiedToClipboard","copiato negli appunti")}`})})};return d.jsxs(ll,{children:[d.jsx(vie,{asChild:!0,children:d.jsxs(tt,{variant:"outline","data-testid":"button-upgrade-professional",children:[d.jsx(rO,{className:"w-4 h-4 mr-2"}),e("marketplace.upgradeTitle","Passa a Professionale")]})}),d.jsxs(Va,{className:"max-w-md max-h-[90vh] overflow-y-auto","data-testid":"dialog-professional-upgrade",children:[d.jsxs(cl,{children:[d.jsxs($a,{className:"flex items-center gap-2 text-base sm:text-lg",children:[d.jsx(rO,{className:"w-4 h-4 sm:w-5 sm:h-5 text-primary shrink-0"}),e("marketplace.upgradeTitle","Passa a Professionale")]}),d.jsx(Oc,{className:"text-xs sm:text-sm",children:e("marketplace.upgradeBankDesc","Effettua un bonifico di â¬50 per attivare il tuo profilo professionale per un anno.")})]}),d.jsxs("div",{className:"space-y-3 sm:space-y-5 py-2 sm:py-4",children:[d.jsxs("div",{className:"text-center p-3 sm:p-5 rounded-lg bg-primary/10",children:[d.jsx("div",{className:"text-3xl sm:text-4xl font-bold text-primary",children:"â¬50"}),d.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e("marketplace.upgradePerYear","all'anno")})]}),d.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankName","Banca")}),d.jsx("p",{className:"text-sm font-semibold","data-testid":"text-bank-name",children:"BancoPosta"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankRecipient","Intestatario")}),d.jsx("p",{className:"text-xs sm:text-sm font-semibold","data-testid":"text-bank-recipient",children:"Associazione Comunità Economica Indipendente"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"IBAN"}),d.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[d.jsx("code",{className:"text-xs sm:text-sm font-mono bg-muted px-2 py-1 rounded flex-1 break-all leading-relaxed","data-testid":"text-iban",children:n}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>c(n,"IBAN"),"data-testid":"button-copy-iban",children:d.jsx(QT,{className:"w-4 h-4"})})]})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:e("marketplace.bankCausale","Causale")}),d.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[d.jsx("p",{className:"text-xs sm:text-sm font-semibold bg-muted px-2 py-1 rounded flex-1 break-words leading-relaxed","data-testid":"text-causale",children:o}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>c(o,e("marketplace.bankCausale","Causale")),"data-testid":"button-copy-causale",children:d.jsx(QT,{className:"w-4 h-4"})})]})]})]}),d.jsx("p",{className:"text-xs text-muted-foreground text-center",children:e("marketplace.bankUpgradeNote","All'arrivo del bonifico sarà attivato l'upgrade richiesto.")})]})]})]})}function e$e({user:t}){var n,o,c;const{t:e}=pr(),i=t.firstName&&t.lastName?`${t.firstName[0]}${t.lastName[0]}`.toUpperCase():((o=(n=t.email)==null?void 0:n[0])==null?void 0:o.toUpperCase())||"U";return d.jsx(Ti,{className:"hover-elevate",children:d.jsx(Ji,{className:"p-6",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsxs(Nc,{className:"w-12 h-12",children:[d.jsx(Rd,{src:t.profileImageUrl||void 0,alt:t.email||e("user.user"),style:{objectFit:"cover"}}),d.jsx(Mc,{children:i})]}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("h3",{className:"font-semibold truncate","data-testid":`text-user-name-${t.id}`,children:t.firstName&&t.lastName?`${t.firstName} ${t.lastName}`:t.email||e("user.unknownUser")}),t.isAdmin&&d.jsx(En,{variant:"secondary",className:"text-xs",children:e("user.admin")})]}),t.email&&d.jsx("p",{className:"text-sm text-muted-foreground truncate mb-3",children:t.email}),d.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[d.jsx(eM,{className:"w-4 h-4 text-muted-foreground"}),d.jsx("span",{className:"font-semibold tabular-nums","data-testid":`text-balance-${t.id}`,children:(c=t.wallet)!=null&&c.balance?parseFloat(t.wallet.balance).toLocaleStr
3911ing("en-US",{minimumFractionDigits:2}):"0.00"}),d.jsx("span",{className:"text-muted-foreground",children:e("user.credits")})]})]})]})})})}function t$e(){const{t}=pr(),{toast:e}=ks(),[i,n]=K.useState(""),[o,c]=K.useState(!1),[f,r]=K.useState(""),{data:x=[],isLoading:S}=Xn({queryKey:["/api/admin/users"]}),C=zg({resolver:Lg(P6e),defaultValues:{userId:"",amount:"",description:""}}),I=$n({mutationFn:async D=>{await xn("POST","/api/admin/wallets/add-credits",D)},onSuccess:()=>{e({title:t("messages.creditSuccess"),description:t("messages.creditSuccessDesc")}),C.reset(),n(""),Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.invalidateQueries({queryKey:["/api/admin/transactions"]}),Qi.invalidateQueries({queryKey:["/api/wallets/my-wallet"]})},onError:D=>{if(OE(D)){e({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}e({title:t("messages.creditError"),description:D.message||t("messages.creditErrorDesc"),variant:"destructive"})}});x.find(D=>D.id===i);const N=()=>{if(!i)return t("admin.selectUser");const D=x.find(B=>B.id===i);if(!D)return t("admin.selectUser");const V=D.email||`${D.firstName} ${D.lastName}`.trim()||D.id;return D.isAdmin?`${V} (${t("admin.admin")})`:V};return d.jsxs(d.Fragment,{children:[d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:t("admin.addCredits")})}),d.jsx(Ji,{children:d.jsx($g,{...C,children:d.jsxs("form",{onSubmit:C.handleSubmit(D=>I.mutate(D)),className:"space-y-4",children:[d.jsx(ns,{control:C.control,name:"userId",render:({field:D})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("admin.user")}),d.jsx(Qr,{children:d.jsxs(tt,{type:"button",variant:"outline",className:"w-full justify-between",onClick:()=>c(!0),disabled:S,"data-testid":"select-user",children:[d.jsx("span",{className:i?"":"text-muted-foreground",children:N()}),d.jsx(Qb,{className:"w-4 h-4 ml-2 opacity-50"})]})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:C.control,name:"amount",render:({field:D})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("admin.amount")}),d.jsx(Qr,{children:d.jsx(an,{type:"number",step:"0.01",min:"0",placeholder:t("admin.amountPlaceholder"),...D,"data-testid":"input-credit-amount"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:C.control,name:"description",render:({field:D})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("admin.reasonOptional")}),d.jsx(Qr,{children:d.jsx(Uc,{placeholder:t("admin.reasonPlaceholder"),...D,"data-testid":"input-credit-description"})}),d.jsx(Is,{})]})}),d.jsx(tt,{type:"submit",className:"w-full",disabled:I.isPending||x.length===0,"data-testid":"button-add-credits",children:I.isPending?t("admin.addingCredits"):d.jsxs(d.Fragment,{children:[d.jsx(Wve,{className:"w-4 h-4 mr-2"}),t("admin.addCreditsSubmit")]})})]})})})]}),d.jsx(ll,{open:o,onOpenChange:D=>{c(D),D||r("")},children:d.jsxs(Va,{className:"max-w-md",children:[d.jsx(cl,{children:d.jsx($a,{children:t("admin.selectUser")})}),d.jsxs("div",{className:"relative mb-2",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:t("admin.searchUsers","Cerca utente per nome o email..."),value:f,onChange:D=>r(D.target.value),className:"pl-10","data-testid":"input-search-credit-user"})]}),d.jsxs("div",{className:"max-h-[60vh] overflow-y-auto",children:[x.filter(D=>{if(!f.trim())return!0;const V=f.toLowerCase().trim(),B=`${D.firstName||""} ${D.lastName||""}`.toLowerCase(),W=(D.email||"").toLowerCase();return B.includes(V)||W.includes(V)}).map(D=>d.jsxs(tt,{variant:"ghost",className:"w-full justify-start mb-1 hover-elevate active-elevate-2",onClick:()=>{C.setValue("userId",D.id),n(D.id),c(!1),r("")},"data-testid":`user-option-${D.id}`,children:[D.firstName&&D.lastName?`${D.firstName} ${D.lastName} (${D.email})`:D.email||D.id,D.isAdmin&&` (${t("admin.admin")})`]},D.id)),x.filter(D=>{if(!f.trim())return!0;const V=f.toLowerCase().trim(),B=`${D.firstName||""} ${D.lastName||""}`.toLowerCase(),W=(D.email||"").toLowerCase();return B.includes(V)||W.includes(V)}).length===0&&d.jsx("p",{className:"text-center text-muted-foreground py-4",children:f?t("admin.noSearchResults","Nessun utente trovato"):t("admin.noUsersAvailable")})]})]})})]})}function i$e(){const{t}=pr(),{toast:e}=ks(),{data:i,isLoading:n}=Xn({queryKey:["/api/admin/settings"]}),o=zg({resolver:Lg(D6e),values:{signupBonus:(i==null?void 0:i.signupBonus)||"100"}}),c=$n({mutationFn:async f=>await(await xn("PATCH","/api/admin/settings/signup-bonus",f)).json(),onSuccess:f=>{Qi.invalidateQueries({queryKey:["/api/admin/settings"]}),e({title:t("admin.signupBonusSuccess"),description:t("admin.signupBonusSuccessDesc",{amount:o.getValues("signupBonus")})}),o.reset({signupBonus:f.settings.signupBonus})},onError:f=>{e({title:t("admin.signupBonusError"),description:f.message,variant:"destructive"})}});return n?d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:t("admin.signupBonusTitle")})}),d.jsx(Ji,{children:d.jsx("div",{className:"h-32 bg-muted rounded-lg animate-pulse"})})]}):d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsx(kn,{children:t("admin.signupBonusTitle")}),d.jsx(da,{children:t("admin.signupBonusDesc")})]}),d.jsx(Ji,{children:d.jsx($g,{...o,children:d.jsxs("form",{onSubmit:o.handleSubmit(f=>c.mutate(f)),className:"space-y-4",children:[d.jsx(ns,{control:o.control,name:"signupBonus",render:({field:f})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("admin.signupBonusAmount")}),d.jsx(Qr,{children:d.jsx(an,{type:"number",step:"0.01",min:"0",placeholder:t("admin.signupBonusPlaceholder"),...f,"data-testid":"input-signup-bonus"})}),d.jsx(zp,{children:t("admin.currentBonus",{amount:i==null?void 0:i.signupBonus})}),d.jsx(Is,{})]})}),d.jsx(tt,{type:"submit",className:"w-full",disabled:c.isPending,"data-testid":"button-save-signup-bonus",children:c.isPending?t("admin.signupBonusSaving"):d.jsxs(d.Fragment,{children:[d.jsx(e1,{className:"w-4 h-4 mr-2"}),t("admin.signupBonusSave")]})})]})})})]})}function n$e(){const{t}=pr(),{toast:e}=ks(),i=zg({resolver:Lg(R6e),defaultValues:{amount:"",description:""}}),n=$n({mutationFn:async o=>await(await xn("POST","/api/admin/bulk-credit",o)).json(),onSuccess:o=>{e({title:t("admin.bulkCreditSuccess"),description:t("admin.bulkCreditSuccessDesc",{successCount:o.successCount,totalUsers:o.totalUsers,failCount:o.failCount})}),i.reset(),Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.invalidateQueries({queryKey:["/api/admin/transactions"]})},onError:o=>{if(OE(o)){e({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}e({title:t("admin.bulkCreditError"),description:o.message||t("admin.bulkCreditErrorDesc"),variant:"destructive"})}});return d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Bc,{className:"w-5 h-5"}),t("admin.bulkCreditTitle")]}),d.jsx(da,{children:t("admin.bulkCreditDesc")})]}),d.jsx(Ji,{children:d.jsx($g,{...i,children:d.jsxs("form",{onSubmit:i.handleSubmit(o=>n.mutate(o)),className:"space-y-4",children:[d.jsx(ns,{control:i.control,name:"amount",render:({field:o})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("transfer.amount")}),d.jsx(Qr,{children:d.jsx(an,{type:"number",step:"0.01",placeholder:"100.00",...o,"data-testid":"input-bulk-credit-amount"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:i.control,name:"description",render:({field:o})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("transfer.description")}),d.jsx(Qr,{children:d.jsx(Uc,{placeholder:t("admin.bulkCreditPlaceholder"),...o,"data-testid":"input-bulk-credit-description"})}),d.jsx(Is,{})]})}),d.jsx(tt,{type:"submit",className:"w-full",disabled:n.isPending,"data-testid":"button-bulk-credit-submit",children:n.isPending?t("admin.processing"):t("admin.bulkCreditButton")})]})})})]})}function r$e(){const{t}=pr(),{toast:e}=ks(),i=K.useRef(null),[n,o]=K.useState(null),[c,f]=K.useState(!1),r=zg({resolver:Lg(j6e),defaultValues:{content:"",imageUrl:""}}
3911);async function x(I){var D;const N=(D=I.target.files)==null?void 0:D[0];if(N){f(!0);try{const V=await fetch("/api/objects/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:N.name,contentType:N.type})});if(!V.ok)throw new Error("Upload init failed");const{uploadURL:B}=await V.json();await fetch(B,{method:"PUT",body:N,headers:{"Content-Type":N.type}});const W=await fetch("/api/admin/confirm-video-upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileURL:B.split("?")[0],folder:"broadcast"}),credentials:"include"});if(!W.ok)throw new Error("Confirm upload failed");const{url:$}=await W.json();r.setValue("imageUrl",$),o($)}catch(V){e({title:t("common.error","Errore"),description:V.message||"Impossibile caricare l'immagine",variant:"destructive"})}finally{f(!1),i.current&&(i.current.value="")}}}function S(){r.setValue("imageUrl",""),o(null)}const C=$n({mutationFn:async I=>await(await xn("POST","/api/admin/broadcast-message",I)).json(),onSuccess:I=>{e({title:t("admin.broadcastSuccess"),description:t("admin.broadcastSuccessDesc",{successCount:I.successCount,totalRecipients:I.totalRecipients,failCount:I.failCount})}),r.reset(),o(null),Qi.invalidateQueries({queryKey:["/api/messages"]})},onError:I=>{if(OE(I)){e({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}e({title:t("admin.broadcastError"),description:I.message||t("admin.broadcastErrorDesc"),variant:"destructive"})}});return d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(sf,{className:"w-5 h-5"}),t("admin.broadcastTitle")]}),d.jsx(da,{children:t("admin.broadcastDesc")})]}),d.jsx(Ji,{children:d.jsx($g,{...r,children:d.jsxs("form",{onSubmit:r.handleSubmit(I=>C.mutate(I)),className:"space-y-4",children:[d.jsx(ns,{control:r.control,name:"content",render:({field:I})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("admin.broadcastLabel")}),d.jsx(Qr,{children:d.jsx(Uc,{placeholder:t("admin.broadcastPlaceholder"),className:"min-h-[120px]",...I,"data-testid":"input-broadcast-message-content"})}),d.jsx(Is,{})]})}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("p",{className:"text-sm font-medium",children:t("admin.broadcastImage","Immagine allegata (opzionale)")}),n?d.jsxs("div",{className:"relative inline-block",children:[d.jsx("img",{src:n,alt:"Preview",className:"max-h-48 rounded-md border object-contain","data-testid":"img-broadcast-preview"}),d.jsx(tt,{type:"button",size:"icon",variant:"secondary",className:"absolute top-1 right-1 h-6 w-6",onClick:S,"data-testid":"button-remove-broadcast-image",children:d.jsx(Fa,{className:"w-3 h-3"})})]}):d.jsxs(tt,{type:"button",variant:"outline",size:"sm",disabled:c,onClick:()=>{var I;return(I=i.current)==null?void 0:I.click()},"data-testid":"button-add-broadcast-image",children:[d.jsx(K3,{className:"w-4 h-4 mr-2"}),c?t("common.uploading","Caricamento..."):t("admin.addImage","Aggiungi immagine")]}),d.jsx("input",{ref:i,type:"file",accept:"image/*",className:"hidden",onChange:x,"data-testid":"input-broadcast-image-file"})]}),d.jsx(tt,{type:"submit",className:"w-full",disabled:C.isPending||c,"data-testid":"button-broadcast-message-submit",children:C.isPending?t("admin.sending"):t("admin.broadcastButton")})]})})})]})}const $z={code:"",name:"",bonusType:"fixed",bonusValue:"50",targetAudience:"all",startDate:"",endDate:"",maxRedemptions:"",isActive:!0};function s$e(){const{t}=pr(),{toast:e}=ks(),[i,n]=K.useState(!1),[o,c]=K.useState(!1),[f,r]=K.useState(!1),[x,S]=K.useState(null),[C,I]=K.useState($z),[N,D]=K.useState(""),[V,B]=K.useState(null),{data:W=[],isLoading:$}=Xn({queryKey:["/api/admin/vouchers"]}),G=$n({mutationFn:async De=>{const Je=parseFloat(De.bonusValue);return await(await xn("POST","/api/admin/vouchers",{code:De.code,name:De.name,bonusType:De.bonusType,bonusAmount:De.bonusType==="fixed"?Je:null,bonusMultiplier:De.bonusType==="multiplier"?Je:null,targetAudience:De.targetAudience,startDate:De.startDate,endD
3911ate:De.endDate,maxRedemptions:De.maxRedemptions?parseInt(De.maxRedemptions):null,isActive:De.isActive})).json()},onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/vouchers"]}),e({title:t("messages.success"),description:t("voucher.admin.createSuccess")}),n(!1),I($z)},onError:De=>{e({title:t("messages.error"),description:De.message,variant:"destructive"})}}),te=$n({mutationFn:async({id:De,data:Je})=>{const dt=Je.bonusValue?parseFloat(Je.bonusValue):void 0;return await(await xn("PATCH",`/api/admin/vouchers/${De}`,{name:Je.name,bonusType:Je.bonusType,bonusAmount:Je.bonusType==="fixed"&&dt!==void 0?dt:null,bonusMultiplier:Je.bonusType==="multiplier"&&dt!==void 0?dt:null,targetAudience:Je.targetAudience,startDate:Je.startDate,endDate:Je.endDate,maxRedemptions:Je.maxRedemptions?parseInt(Je.maxRedemptions):null,isActive:Je.isActive})).json()},onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/vouchers"]}),e({title:t("messages.success"),description:t("voucher.admin.updateSuccess")}),c(!1),S(null)},onError:De=>{e({title:t("messages.error"),description:De.message,variant:"destructive"})}}),ce=$n({mutationFn:async De=>{await xn("DELETE",`/api/admin/vouchers/${De}`)},onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/vouchers"]}),e({title:t("messages.success"),description:t("voucher.admin.deleteSuccess")})},onError:De=>{e({title:t("messages.error"),description:De.message,variant:"destructive"})}}),_e=$n({mutationFn:async({message:De})=>await(await xn("POST","/api/admin/broadcast-message",{content:De,recipientType:"all"})).json(),onSuccess:De=>{e({title:t("messages.success"),description:t("voucher.admin.broadcastSuccess")}),r(!1),D(""),B(null)},onError:De=>{e({title:t("messages.error"),description:De.message,variant:"destructive"})}}),Te=()=>{const De=new Date,Je=new Date(De.getTime()+24*60*60*1e3);I({...$z,startDate:De.toISOString().slice(0,16),endDate:Je.toISOString().slice(0,16)}),n(!0)},we=De=>{var dt;S(De);const Je=De.bonusType==="fixed"?De.bonusAmount||"0":De.bonusMultiplier||"0";I({code:De.code,name:De.name||"",bonusType:De.bonusType,bonusValue:Je,targetAudience:De.targetAudience,startDate:De.startDate?new Date(De.startDate).toISOString().slice(0,16):"",endDate:De.endDate?new Date(De.endDate).toISOString().slice(0,16):"",maxRedemptions:((dt=De.maxRedemptions)==null?void 0:dt.toString())||"",isActive:De.isActive}),c(!0)},Ne=De=>{B(De);const Je=De.bonusType==="fixed"?De.bonusAmount||"0":De.bonusMultiplier||"1";D(`${t("voucher.broadcastTemplate",{code:De.code,bonus:De.bonusType==="fixed"?`${Je} CEI`:`${Je}x`})}`),r(!0)},pe=De=>{const Je=new Date;return De.isActive?De.startDate&&Je<new Date(De.startDate)?d.jsx(En,{variant:"outline",children:t("voucher.scheduled")}):De.endDate&&Je>new Date(De.endDate)?d.jsx(En,{variant:"destructive",children:t("voucher.expired")}):d.jsx(En,{variant:"default",children:t("voucher.active")}):d.jsx(En,{variant:"secondary",children:t("voucher.inactive")})},Pe=De=>{switch(De){case"new_users":return t("voucher.newUsersOnly");case"existing_users":return t("voucher.existingUsersOnly");default:return t("voucher.allUsers")}};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold",children:t("voucher.title")}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t("voucher.subtitle")})]}),d.jsxs(tt,{onClick:Te,"data-testid":"button-create-voucher",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("voucher.create")]})]}),$?d.jsx("div",{className:"grid gap-4",children:[1,2,3].map(De=>d.jsx("div",{className:"h-24 bg-card rounded-lg animate-pulse"},De))}):W.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(t1,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("voucher.noVouchers")}),d.jsxs(tt,{className:"mt-4",onClick:Te,children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("voucher.createFirst")]})]})}):d.jsx("div",{className:"grid gap-4",children:W.map(De=>d.jsx(Ti,{className:"hover-elevate","data-testid":`voucher-card-${De.id}`,children:d.jsx(Ji,{className:"p-4",children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("span",{className:"font-mono font-bold text-lg","data-testid":`voucher-code-${De.id}`,children:De.code}),pe(De),d.jsx(En,{variant:"outline",children:De.bonusType==="fixed"?`+${De.bonusAmount||"0"} CEI`:`${De.bonusMultiplier||"1"}x`}),d.jsxs(En,{variant:"secondary",children:[d.jsx(Bc,{className:"w-3 h-3 mr-1"}),Pe(De.targetAudience)]})]}),De.name&&d.jsx("p",{className:"text-sm text-muted-foreground",children:De.name}),d.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground flex-wrap",children:[d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx(Yb,{className:"w-3 h-3"}),De.startDate?rc(new Date(De.startDate),"dd/MM/yyyy HH:mm"):"-"," - ",De.endDate?rc(new Date(De.endDate),"dd/MM/yyyy HH:mm"):"-"]}),d.jsxs("span",{children:[t("voucher.redemptions"),": ",De.redemptionCount||0,De.maxRedemptions?` / ${De.maxRedemptions}`:""]}),d.jsxs("span",{children:[t("voucher.totalDistributed"),": ",(De.totalBonusDistributed||0).toFixed(0)," CEI"]})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(tt,{variant:"outline",size:"icon",onClick:()=>Ne(De),title:t("voucher.sendBroadcast"),"data-testid":`button-broadcast-${De.id}`,children:d.jsx(JT,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"outline",size:"icon",onClick:()=>we(De),"data-testid":`button-edit-${De.id}`,children:d.jsx(QN,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"outline",size:"icon",onClick:()=>ce.mutate(De.id),"data-testid":`button-delete-${De.id}`,children:d.jsx(Ld,{className:"w-4 h-4"})})]})]})})},De.id))}),d.jsx(ll,{open:i,onOpenChange:n,children:d.jsxs(Va,{className:"sm:max-w-[500px]",children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("voucher.create")}),d.jsx(Oc,{children:t("voucher.createDesc")})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"code",children:t("voucher.code")}
3911),d.jsx(an,{id:"code",value:C.code,onChange:De=>I({...C,code:De.target.value.toUpperCase()}),placeholder:"EVENTO2024","data-testid":"input-voucher-code"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"name",children:t("voucher.name")}),d.jsx(an,{id:"name",value:C.name,onChange:De=>I({...C,name:De.target.value}),placeholder:t("voucher.namePlaceholder"),"data-testid":"input-voucher-name"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t("voucher.bonusType")}),d.jsxs(Jy,{value:C.bonusType,onValueChange:De=>I({...C,bonusType:De}),children:[d.jsx(Vm,{"data-testid":"select-bonus-type",children:d.jsx(e_,{})}),d.jsxs($m,{children:[d.jsx(ja,{value:"fixed",children:t("voucher.fixed")}),d.jsx(ja,{value:"multiplier",children:t("voucher.multiplier")})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"bonusValue",children:t("voucher.bonusValue")}),d.jsx(an,{id:"bonusValue",type:"number",value:C.bonusValue,onChange:De=>I({...C,bonusValue:De.target.value}),placeholder:C.bonusType==="fixed"?"50":"2","data-testid":"input-bonus-value"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t("voucher.targetAudience")}),d.jsxs(Jy,{value:C.targetAudience,onValueChange:De=>I({...C,targetAudience:De}),children:[d.jsx(Vm,{"data-testid":"select-target-audience",children:d.jsx(e_,{})}),d.jsxs($m,{children:[d.jsx(ja,{value:"all",children:t("voucher.allUsers")}),d.jsx(ja,{value:"new_users",children:t("voucher.newUsersOnly")}),d.jsx(ja,{value:"existing_users",children:t("voucher.existingUsersOnly")})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"startDate",children:t("voucher.startsAt")}),d.jsx(an,{id:"startDate",type:"datetime-local",value:C.startDate,onChange:De=>I({...C,startDate:De.target.value}),"data-testid":"input-start-date"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"endDate",children:t("voucher.endsAt")}),d.jsx(an,{id:"endDate",type:"datetime-local",value:C.endDate,onChange:De=>I({...C,endDate:De.target.value}),"data-testid":"input-end-date"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"maxRedemptions",children:t("voucher.maxRedemptions")}),d.jsx(an,{id:"maxRedemptions",type:"number",value:C.maxRedemptions,onChange:De=>I({...C,maxRedemptions:De.target.value}),placeholder:t("voucher.unlimited"),"data-testid":"input-max-redemptions"})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Fn,{htmlFor:"isActive",children:t("voucher.isActive")}),d.jsx(ou,{id:"isActive",checked:C.isActive,onCheckedChange:De=>I({...C,isActive:De}),"data-testid":"switch-is-active"})]})]}),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>n(!1),children:t("common.cancel")}),d.jsx(tt,{onClick:()=>G.mutate(C),disabled:G.isPending||!C.code||!C.startDate||!C.endDate,"data-testid":"button-save-voucher",children:G.isPending?t("common.saving"):t("common.save")})]})]})}),d.jsx(ll,{open:o,onOpenChange:c,children:d.jsxs(Va,{className:"sm:max-w-[500px]",children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("voucher.edit")}),d.jsx(Oc,{children:t("voucher.editDesc")})]}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t("voucher.code")}),d.jsx(an,{value:C.code,disabled:!0,className:"bg-muted"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"edit-name",children:t("voucher.n
3911ame")}),d.jsx(an,{id:"edit-name",value:C.name,onChange:De=>I({...C,name:De.target.value})})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t("voucher.bonusType")}),d.jsxs(Jy,{value:C.bonusType,onValueChange:De=>I({...C,bonusType:De}),children:[d.jsx(Vm,{children:d.jsx(e_,{})}),d.jsxs($m,{children:[d.jsx(ja,{value:"fixed",children:t("voucher.fixed")}),d.jsx(ja,{value:"multiplier",children:t("voucher.multiplier")})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"edit-bonusValue",children:t("voucher.bonusValue")}),d.jsx(an,{id:"edit-bonusValue",type:"number",value:C.bonusValue,onChange:De=>I({...C,bonusValue:De.target.value})})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t("voucher.targetAudience")}),d.jsxs(Jy,{value:C.targetAudience,onValueChange:De=>I({...C,targetAudience:De}),children:[d.jsx(Vm,{children:d.jsx(e_,{})}),d.jsxs($m,{children:[d.jsx(ja,{value:"all",children:t("voucher.allUsers")}),d.jsx(ja,{value:"new_users",children:t("voucher.newUsersOnly")}),d.jsx(ja,{value:"existing_users",children:t("voucher.existingUsersOnly")})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"edit-startDate",children:t("voucher.startsAt")}),d.jsx(an,{id:"edit-startDate",type:"datetime-local",value:C.startDate,onChange:De=>I({...C,startDate:De.target.value})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"edit-endDate",children:t("voucher.endsAt")}),d.jsx(an,{id:"edit-endDate",type:"datetime-local",value:C.endDate,onChange:De=>I({...C,endDate:De.target.value})})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"edit-maxRedemptions",children:t("voucher.maxRedemptions")}),d.jsx(an,{id:"edit-maxRedemptions",type:"number",value:C.maxRedemptions,onChange:De=>I({...C,maxRedemptions:De.target.value}),placeholder:t("voucher.unlimited")})]}),d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx(Fn,{htmlFor:"edit-isActive",children:t("voucher.isActive")}),d.jsx(ou,{id:"edit-isActive",checked:C.isActive,onCheckedChange:De=>I({...C,isActive:De})})]})]}),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>c(!1),children:t("common.cancel")}),d.jsx(tt,{onClick:()=>x&&te.mutate({id:x.id,data:C}),disabled:te.isPending,children:te.isPending?t("common.saving"):t("common.save")})]})]})}),d.jsx(ll,{open:f,onOpenChange:r,children:d.jsxs(Va,{className:"sm:max-w-[500px]",children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("voucher.sendBroadcast")}),d.jsx(Oc,{children:t("voucher.broadcastDesc",{code:V==null?void 0:V.code})})]}),d.jsx("div",{className:"space-y-4",children:d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"broadcast-message",children:t("voucher.message")}),d.jsx(Uc,{id:"broadcast-message",value:N,onChange:De=>D(De.target.value),rows:6,"data-testid":"input-broadcast-message"})]})}),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>r(!1),children:t("common.cancel")}),d.jsxs(tt,{onClick:()=>_e.mutate({message:N}),disabled:_e.isPending||!N.trim(),"data-testid":"button-send-broadcast",children:[d.jsx(JT,{className:"w-4 h-4 mr-2"}),_e.isPending?t("common.sending"):t("voucher.send")]})]})]})})]})}const qz={title:"",description:"",category:"tutorial",storagePath:"",thumbnailPath:"",durationSeconds:"",isPublished:!1,isFeatured:!1,featuredOrder:"0"},o$e={news:"News",divulgazione:"Divulgazione",tutorial:"Tutorial","interviste-giraldi":"Interviste Prof. Giraldi","considerazioni-scientifiche":"Considerazioni Scientifiche"};function a$e({label:t,accept:e,maxSizeMB:i,value:n,onChange:o,folder:c,testId:f}){const{t:r}=pr(),[x,S]=K.useState(!1),[C,I]=K.useState(0),N=K.useRef(null),D=async V=>{var W;const B=(W=V.target.files)==null?void 0:W[0];if(B){if(B.size>i*1024*1024){alert(r("video.admin.fileTooLarge",{max:i}));return}S(!0),I(0);try{const $=await fetch("/api/admin/upload-video",{method:"POST",credentials:"include"});if(!$.ok)throw new Error("Failed to get upload URL");const{uploadURL:G}=await $.json(),te=new XMLHttpRequest;te.open("PUT",G),te.setRequestHeader("Content-Type",B.type||"application/octet-stream"),te.upload.onprogress=ce=>{ce.lengthComputable&&I(Math.round(ce.loaded/ce.total*100))},te.onload=async()=>
3911{if(te.status===200||te.status===201){const ce=await fetch("/api/admin/confirm-video-upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({fileURL:G,folder:c})});if(ce.ok){const{url:_e}=await ce.json();o(_e)}else console.error("Failed to confirm upload"),alert(r("video.admin.uploadFailed"))}else console.error("Upload failed:",te.status,te.responseText),alert(r("video.admin.uploadFailed"));S(!1),I(0)},te.onerror=()=>{console.error("Upload error"),alert(r("video.admin.uploadFailed")),S(!1),I(0)},te.send(B)}catch($){console.error("Upload error:",$),alert(r("video.admin.uploadFailed")),S(!1),I(0)}}};return d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{ref:N,type:"file",accept:e,onChange:D,className:"hidden","data-testid":`input-${f}`}),d.jsx(tt,{type:"button",variant:"outline",onClick:()=>{var V;return(V=N.current)==null?void 0:V.click()},disabled:x,"data-testid":`button-${f}`,children:x?d.jsxs(d.Fragment,{children:[d.jsx(lv,{className:"w-4 h-4 mr-2 animate-spin"}),C,"%"]}):d.jsxs(d.Fragment,{children:[d.jsx(JN,{className:"w-4 h-4 mr-2"}),r("video.admin.selectFile")]})}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["Max ",i,"MB"]})]}),x&&d.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:d.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${C}%`}})}),n&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Eb,{className:"w-4 h-4"}),d.jsx("span",{className:"truncate",children:n.split("/").pop()})]})]})}function l$e({label:t,accept:e,maxSizeMB:i,value:n,onChange:o,folder:c,testId:f}){const{t:r}=pr(),[x,S]=K.useState(!1),C=K.useRef(null),I=async N=>{var V;const D=(V=N.target.files)==null?void 0:V[0];if(D){if(D.size>i*1024*1024){alert(r("video.admin.fileTooLarge",{max:i}));return}S(!0);try{const B=await fetch("/api/admin/upload-video",{method:"POST",credentials:"include"});if(!B.ok)throw new Error("Failed to get upload URL");const{uploadURL:W}=await B.json();if(!(await fetch(W,{method:"PUT",headers:{"Content-Type":D.type||"application/octet-stream"},body:D})).ok)throw new Error("Failed to upload file");const G=await fetch("/api/admin/confirm-video-upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({fileURL:W,folder:c})});if(G.ok){const{url:te}=await G.json();o(te)}else console.error("Failed to confirm upload"),alert(r("video.admin.uploadFailed"))}catch(B){console.error("Upload error:",B),alert(r("video.admin.uploadFailed"))}finally{S(!1)}}};return d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:t}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{ref:C,type:"file",accept:e,onChange:I,className:"hidden","data-testid":`input-${f}`}),d.jsxs(tt,{type:"button",variant:"outline",onClick:()=>{var N;return(N=C.current)==null?void 0:N.click()},disabled:x,"data-testid":`button-${f}`,children:[x?d.jsx(lv,{className:"w-4 h-4 mr-2 animate-spin"}):d.jsx(JN,{className:"w-4 h-4 mr-2"}),r("video.admin.selectImage")]}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["Max ",i,"MB"]})]}),n&&d.jsx("div",{className:"mt-2",children:d.jsx("img",{src:n,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded"})})]})}function c$e(){const{t}=pr(),{toast:e}=ks(),[i,n]=K.useState(!1),[o,c]=K.useState(!1),[f,r]=K.useState(null),[x,S]=K.useState(qz),[C,I]=K.useState(!1),[N,D]=K.useState(null),{data:V=[],isLoading:B}=Xn({queryKey:["/api/admin/videos"]}),W=$n({mutationFn:async pe=>await(await xn("POST","/api/admin/videos",{title:pe.title,description:pe.description||null,category:pe.category,storagePath:pe.storagePath,thumbnailPath:pe.thumbnailPath||null,durationSeconds:pe.durationSeconds?parseInt(pe.durationSeconds):null,isPublished:pe.isPublished,isFeatured:pe.isFeatured,featuredOrder:parseInt(pe.featuredOrder)||0})).json(),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/videos"]}),e({title:t("messages.success"),description:t("video.admin.createSuccess")}),n(!1),S(qz)},onError:pe=>{e({title:t("messages.error"),description:pe.message,variant:"destructive"})}}),$=$n({mutationFn:async({id:pe,data:Pe})=>await(await xn("PATCH",`/api/admin/videos/${pe}
3911`,{title:Pe.title,description:Pe.description||null,category:Pe.category,storagePath:Pe.storagePath,thumbnailPath:Pe.thumbnailPath||null,durationSeconds:Pe.durationSeconds?parseInt(Pe.durationSeconds):null,isPublished:Pe.isPublished,isFeatured:Pe.isFeatured,featuredOrder:parseInt(Pe.featuredOrder||"0")||0})).json(),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/videos"]}),e({title:t("messages.success"),description:t("video.admin.updateSuccess")}),c(!1),r(null)},onError:pe=>{e({title:t("messages.error"),description:pe.message,variant:"destructive"})}}),G=$n({mutationFn:async pe=>{await xn("DELETE",`/api/admin/videos/${pe}`)},onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/videos"]}),e({title:t("messages.success"),description:t("video.admin.deleteSuccess")}),I(!1),D(null)},onError:pe=>{e({title:t("messages.error"),description:pe.message,variant:"destructive"})}}),te=$n({mutationFn:async pe=>await(await xn("POST",`/api/admin/videos/${pe}/toggle-featured`)).json(),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/videos"]})},onError:pe=>{e({title:t("messages.error"),description:pe.message,variant:"destructive"})}}),ce=$n({mutationFn:async pe=>await(await xn("POST",`/api/admin/videos/${pe}/toggle-published`)).json(),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/videos"]})},onError:pe=>{e({title:t("messages.error"),description:pe.message,variant:"destructive"})}}),_e=pe=>{var Pe,De;r(pe),S({title:pe.title,description:pe.description||"",category:pe.category,storagePath:pe.storagePath,thumbnailPath:pe.thumbnailPath||"",durationSeconds:((Pe=pe.durationSeconds)==null?void 0:Pe.toString())||"",isPublished:pe.isPublished,isFeatured:pe.isFeatured,featuredOrder:((De=pe.featuredOrder)==null?void 0:De.toString())||"0"}),c(!0)},Te=pe=>{D(pe),I(!0)},we=pe=>{if(!pe)return"--:--";const Pe=Math.floor(pe/60),De=pe%60;return`${Pe}:${De.toString().padStart(2,"0")}`},Ne=pe=>d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:`${pe}-title`,children:t("video.admin.titleField")}),d.jsx(an,{id:`${pe}-title`,value:x.title,onChange:Pe=>S(De=>({...De,title:Pe.target.value})),placeholder:t("video.admin.titlePlaceholder"),"data-testid":`input-${pe}-video-title`})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:`${pe}-category`,children:t("video.admin.category")}),d.jsxs("select",{id:`${pe}-category`,value:x.category,onChange:Pe=>S(De=>({...De,category:Pe.target.value})),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":`select-${pe}-video-category`,children:[d.jsx("option",{value:"news",children:"News"}),d.jsx("option",{value:"divulgazione",children:"Divulgazione"}),d.jsx("option",{value:"tutorial",children:"Tutorial"}),d.jsx("option",{value:"interviste-giraldi",children:"Interviste Prof. Giraldi"}),d.jsx("option",{value:"considerazioni-scientifiche",children:"Considerazioni Scientifiche"})]})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:`${pe}-description`,children:t("video.admin.descriptionField")}),d.jsx(Uc,{id:`${pe}-description`,value:x.description,onChange:Pe=>S(De=>({...De,description:Pe.target.value})),placeholder:t("video.admin.descriptionPlaceholder"),rows:3,"data-testid":`textarea-${pe}-video-description`})]}),d.jsx(a$e,{label:t("video.admin.videoFile"),accept:"video/mp4,video/webm,video/quicktime",maxSizeMB:400,value:x.storagePath,onChange:Pe=>S(De=>({...De,storagePath:Pe})),folder:"videos",testId:`${pe}-upload-video`}),d.jsx(l$e,{label:t("video.admin.thumbnail"),accept:"image/jpeg,image/png,image/webp",maxSizeMB:5,value:x.thumbnailPath,onChange:Pe=>S(De=>({...De,thumbnailPath:Pe})),folder:"thumbnails",testId:`${pe}-upload-thumbnail`}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:`${pe}-duration`,children:t("video.admin.duration")}),d.jsx(an,{id:`${pe}-duration`,type:"number",value:x.durationSeconds,onChange:Pe=>S(De=>({...De,durationSeconds:Pe.target.value})),placeholder:t("video.admin.durationPlaceholder"),"data-testid":`input-${pe}-video-duration`}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("video.admin.durationHint")})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:`${pe}-featuredOrder`,children:t("video.admin.featuredOrder")}),d.jsx(an,{id:`${pe}-featuredOrder`,type:"number",value:x.featuredOrder,onChange:Pe=>S(De=>({...De,featuredOrder:Pe.target.value})),placeholder:"0","data-testid":`input-${pe}-video-order`}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("video.admin.orderHint")})]})]}),d.jsxs("div",{className:"flex items-center gap-6 pt-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(ou,{id:`${pe}-isPublished`,checked:x.isPublished,onCheckedChange:Pe=>S(De=>({...De,isPublished:Pe})),"data-testid":`switch-${pe}-video-published`}),d.jsx(Fn,{htmlFor:`${pe}-isPublished`,children:t("video.admin.published")})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(ou,{id:`${pe}-isFeatured`,checked:x.isFeatured,onCheckedChange:Pe=>S(De=>({...De,isFeatured:Pe})),"data-testid":`switch-${pe}-video-featured`}),d.jsx(Fn,{htmlFor:`${pe}-isFeatured`,children:t("video.admin.featured")})]})]})]});return d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Eb,{className:"w-5 h-5"}),t("video.admin.title")]}),d.jsx(da,{children:t("video.admin.description")})]}),d.jsxs(tt,{onClick:()=>{S(qz),n(!0)},"data-testid":"button-create-video",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),t("video.admin.createVideo")]})]})}),d.jsx(Ji,{children:B?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(pe=>d.jsx("div",{className:"h-20 bg-muted rounded-lg animate-pulse"},pe))}):V.length===0?d.jsxs("div",{className:"text-center py-12",children:[d.jsx(Eb,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("video.admin.noVideos")})]}):d.jsx("div",{className:"space-y-4",children:V.map(pe=>d.jsxs("div",{className:"flex items-center gap-4 p-4 border rounded-lg hover-elevate","data-testid":`video-item-${pe.id}`,children:[d.jsx("div",{className:"w-24 h-16 bg-muted rounded overflow-hidden flex-shrink-0",children:pe.thumbnailPath?d.jsx("img",{src:pe.thumbnailPath,alt:pe.title,className:"w-full h-full object-cover"}):d.jsx("div",{className:"w-full h-full flex items-center justify-center",children:d.jsx(fT,{className:"w-8 h-8 text-muted-foreground"})})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("h3",{className:"font-medium truncate",children:pe.title}),d.jsx(En,{variant:"outline",children:o$e[pe.category]}),pe.isPublished?d.jsxs(En,{variant:"default",className:"gap-1",children:[d.jsx(Tb,{className:"w-3 h-3"}),t("video.admin.published")]}):d.jsxs(En,{variant:"secondary",className:"gap-1",children:[d.jsx(Ok,{className:"w-3 h-3"}),t("video.admin.draft")]}),pe.isFeatured&&d.jsxs(En,{variant:"default",className:"gap-1 bg-yellow-500",children:[d.jsx(Ru,{className:"w-3 h-3"}),t("video.admin.featured")]})]}),d.jsx("p",{className:"text-sm text-muted-foreground truncate mt-1",children:pe.description||t("video.admin.noDescription")}),d.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-1",children:[d.jsxs("span",{className:"flex items-center gap-1",children:[d.jsx(qh,{className:"w-3 h-3"}),we(pe.durationSeconds)]}),pe.createdAt&&d.jsx("span",{children:rc(new Date(pe.createdAt),"dd/MM/yyyy")})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>ce.mutate(pe.id),disabled:ce.isPending,title:pe.isPublished?t("video.admin.unpublish"):t("video.admin.publish"),"data-testid":`button-toggle-published-${pe.id}`,children:pe.isPublished?d.jsx(Ok,{className:"w-4 h-4"}):d.jsx(Tb,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>te.mutate(pe.id),disabled:te.isPending,title:pe.isFeatured?t("video.admin.unfeature"):t("video.admin.feature"),"data-testid":`button-toggle-featured-${pe.id}`,children:pe.isFeatured?d.jsx(mxe,{className:"w-4 h-4"}):d.jsx(Ru,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>_e(pe),"data-testid":`button-edit-video-${pe.id}`,children:d.jsx(QN,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>Te(pe),"data-testid":`button-delete-video-${pe.id}`,children:d.jsx(Ld,{className:"w-4 h-4 text-destructive"})})]})]},pe.id))})}),d.jsx(ll,{open:i,onOpenChange:n,children:d.jsxs(Va,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("video.admin.createVideo")}),d.jsx(Oc,{children:t("video.admin.createVideoDesc")})]}),Ne("create"),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>n(!1),children:t("common.cancel")}),d.jsx(tt,{onClick:()=>W.mutate(x),disabled:!x.title||!x.storagePath||W.isPending,"data-testid":"button-submit-create-video",children:W.isPending?t("common.loading"):t("video.admin.createVideo")})]})]})}),d.jsx(ll,{open:o,onOpenChange:c,children:d.jsxs(Va,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("video.admin.editVideo")}),d.jsx(Oc,{children:t("video.admin.editVideoDesc")})]}),Ne("edit"),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>c(!1),children:t("common.cancel")}),d.jsx(tt,{onClick:()=>f&&$.mutate({id:f.id,data:x}),disabled:!x.title||!x.storagePath||$.isPending,"data-testid":"button-submit-edit-video",children:$.isPending?t("common.loading"):t("common.save")})]})]})}),d.jsx(ll,{open:C,onOpenChange:I,children:d.jsxs(Va,{children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("video.admin.deleteVideo")}),d.jsx(Oc,{children:t("video.admin.deleteVideoConfirm",{title:N==null?void 0:N.title})})]}),d.jsxs(rg,{children:[d.jsx(tt,{variant:"outline",onClick:()=>I(!1),children:t("common.cancel")}),d.jsx(tt,{variant:"destructive",onClick:()=>N&&G.mutate(N.id),disabled:G.isPending,"data-testid":"button-confirm-delete-video",children:G.isPending?t("common.loading"):t("common.delete")})]})]})})]})}const PI={title:"",description:"",documentType:"other",storagePath:"",fileName:"",fileSize:0,mimeType:"",sortOrder:"0",isPublished:!0},u$e={privacy:"Privacy Policy",ethics:"Codice Etico",regulations:"Regolamenti",other:"Altro"},d$e={privacy:i1,ethics:yJ,regulations:kJ,other:Yp};function h$e({value:t,onChange:e}){pr();const[i,n]=K.useState(!1),[o,c]=K.useState(0),f=K.useRef(null),r=async x=>{var I;const S=(I=x.target.files)==null?void 0:I[0];if(!S)return;const C=50;if(S.size>C*1024*1024){alert(`File troppo grande. Massimo ${C}MB`);return}n(!0),c(0);try{const N=await fetch("/api/admin/upload-document",{method:"POST",credentials:"include"});if(!N.ok)throw new Error("Failed to get upload URL");const{uploadURL:D}=await N.json(),V=new XMLHttpRequest;V.open("PUT",D),V.setRequestHeader("Content-Type",S.type||"application/octet-stream"),V.upload.onprogress=B=>{B.lengthComputable&&c(Math.round(B.loaded/B.total*100))},V.onload=async()=>
3911{if(V.status===200||V.status===201){const B=await fetch("/api/admin/confirm-document-upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({fileURL:D})});if(B.ok){const{url:W}=await B.json();e(W,S.name,S.size,S.type)}else console.error("Failed to confirm upload"),alert("Upload fallito")}else console.error("Upload failed:",V.status,V.responseText),alert("Upload fallito");n(!1),c(0)},V.onerror=()=>{console.error("Upload error"),alert("Upload fallito"),n(!1),c(0)},V.send(S)}catch(N){console.error("Upload error:",N),alert("Upload fallito"),n(!1),c(0)}};return d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"File (PDF, immagine, ecc.)"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{ref:f,type:"file",accept:".pdf,.doc,.docx,.jpg,.jpeg,.png,.gif,.webp",onChange:r,className:"hidden","data-testid":"input-document-file"}),d.jsx(tt,{type:"button",variant:"outline",onClick:()=>{var x;return(x=f.current)==null?void 0:x.click()},disabled:i,"data-testid":"button-upload-document",children:i?d.jsxs(d.Fragment,{children:[d.jsx(lv,{className:"w-4 h-4 mr-2 animate-spin"}),o,"%"]}):d.jsxs(d.Fragment,{children:[d.jsx(JN,{className:"w-4 h-4 mr-2"}),"Carica File"]})}),t&&d.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline flex items-center gap-1",children:[d.jsx(XN,{className:"w-3 h-3"}),"Visualizza"]})]}),i&&d.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:d.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${o}%`}})})]})}function p$e(){pr();const{toast:t}=ks(),[e,i]=K.useState(!1),[n,o]=K.useState(null),[c,f]=K.useState(PI),{data:r=[],isLoading:x}=Xn({queryKey:["/api/admin/documents"]}),S=$n({mutationFn:async $=>await xn("POST","/api/admin/documents",{...$,sortOrder:parseInt($.sortOrder)||0}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/documents"]}),Qi.invalidateQueries({queryKey:["/api/documents"]}),i(!1),f(PI),t({title:"Documento creato con successo"})},onError:$=>{console.error("Document creation error:",$),t({title:"Errore nella creazione",description:($==null?void 0:$.message)||"Controlla i dati inseriti",variant:"destructive"})}}),C=$n({mutationFn:async({id:$,data:G})=>await xn("PATCH",`/api/admin/documents/${$}`,{...G,sortOrder:parseInt(G.sortOrder)||0}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/documents"]}),Qi.invalidateQueries({queryKey:["/api/documents"]}),i(!1),o(null),f(PI),t({title:"Documento aggiornato con successo"})},onError:()=>{t({title:"Errore nell'aggiornamento",variant:"destructive"})}}),I=$n({mutationFn:async $=>await xn("DELETE",`/api/admin/documents/${$}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/documents"]}),Qi.invalidateQueries({queryKey:["/api/documents"]}),t({title:"Documento eliminato"})},onError:()=>{t({title:"Errore nell'eliminazione",variant:"destructive"})}}),N=$n({mutationFn:async({id:$,isPublished:G})=>await xn("PATCH",`/api/admin/documents/${$}`,{isPublished:G}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/documents"]}),Qi.invalidateQueries({queryKey:["/api/documents"]})}}),D=()=>{o(null),f(PI),i(!0)},V=$=>{o($),f({title:$.title,description:$.description||"",documentType:$.documentType,storagePath:$.storagePath,fileName:$.fileName,fileSize:$.fileSize||0,mimeType:$.mimeType||"",sortOrder:String($.sortOrder),isPublished:$.isPublished}),i(!0)},B=$=>{if($.preventDefault(),console.log("[DocumentManagement] handleSubmit called with formData:",c),!c.title||!c.storagePath){console.log("[DocumentManagement] Validation failed - title:",c.title,"storagePath:",c.storagePath),t({title:"Compila titolo e carica un file",variant:"destructive"});return}console.log("[DocumentManagement] Submitting document..."),n?C.mutate({id:n.id,data:c}):S.mutate(c)},W=$=>($==null?void 0:$.startsWith("image/"))??!1;return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"Gestione Documenti"}),d.jsxs(tt,{onClick:D,"data-testid":"button-add-document",children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),"Nuovo Documento"]})]}),x?d.jsx("div",{className:"grid gap-4",children:[1,2,3].map($=>d.jsx("div",{className:"h-24 bg-card rounded-lg animate-pulse"},$))}):r.length===0?d.jsx(Ti,{className:"text-center py-12",children:d.jsxs(Ji,{children:[d.jsx(Yp,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:"Nessun documento caricato"}),d.jsxs(tt,{className:"mt-4",onClick:D,children:[d.jsx(of,{className:"w-4 h-4 mr-2"}),"Carica il primo documento"]})]})}):d.jsx("div",{className:"space-y-4",children:r.map($=>{const G=d$e[$.documentType]||Yp;return d.jsx(Ti,{"data-testid":`document-card-${$.id}`,children:d.jsx(Ji,{className:"p-4",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsx("div",{className:"flex-shrink-0 p-2 bg-muted rounded-lg",children:W($.mimeType)?d.jsx(Fk,{className:"h-8 w-8 text-primary"}):d.jsx(G,{className:"h-8 w-8 text-primary"})}),d.jsxs("div",{className:"flex-grow min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("h3",{className:"font-semibold",children:$.title}),d.jsx(En,{variant:"secondary",children:u$e[$.documentType]||$.documentType}),$.isPublished?d.jsxs(En,{variant:"default",className:"gap-1",children:[d.jsx(Tb,{className:"w-3 h-3"}),"Pubblicato"]}):d.jsxs(En,{variant:"outline",className:"gap-1",children:[d.jsx(Ok,{className:"w-3 h-3"}),"Bozza"]})]}),$.description&&d.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:$.description}),d.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[d.jsx("span",{children:$.fileName}),$.fileSize&&d.jsxs("span",{children:[($.fileSize/1024).toFixed(1)," KB"]}
3911),$.createdAt&&d.jsx("span",{children:rc(new Date($.createdAt),"dd/MM/yyyy")})]})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsx(ou,{checked:$.isPublished,onCheckedChange:te=>N.mutate({id:$.id,isPublished:te}),"data-testid":`switch-publish-${$.id}`}),d.jsx("a",{href:$.storagePath,target:"_blank",rel:"noopener noreferrer",children:d.jsx(tt,{variant:"ghost",size:"icon",children:d.jsx(XN,{className:"w-4 h-4"})})}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>V($),"data-testid":`button-edit-${$.id}`,children:d.jsx(QN,{className:"w-4 h-4"})}),d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>{confirm("Eliminare questo documento?")&&I.mutate($.id)},"data-testid":`button-delete-${$.id}`,children:d.jsx(Ld,{className:"w-4 h-4 text-destructive"})})]})]})})},$.id)})}),d.jsx(ll,{open:e,onOpenChange:i,children:d.jsxs(Va,{className:"max-w-lg",children:[d.jsxs(cl,{children:[d.jsx($a,{children:n?"Modifica Documento":"Nuovo Documento"}),d.jsx(Oc,{children:"Carica documenti come Privacy Policy, Codice Etico o Regolamenti"})]}),d.jsxs("form",{onSubmit:B,className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"title",children:"Titolo *"}),d.jsx(an,{id:"title",value:c.title,onChange:$=>f({...c,title:$.target.value}),placeholder:"es. Privacy Policy 2025",required:!0,"data-testid":"input-document-title"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"documentType",children:"Tipo Documento"}),d.jsxs("select",{id:"documentType",value:c.documentType,onChange:$=>f({...c,documentType:$.target.value}),className:"w-full h-10 px-3 border rounded-md bg-background","data-testid":"select-document-type",children:[d.jsx("option",{value:"privacy",children:"Privacy Policy"}),d.jsx("option",{value:"ethics",children:"Codice Etico"}),d.jsx("option",{value:"regulations",children:"Regolamenti"}),d.jsx("option",{value:"other",children:"Altro"})]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"description",children:"Descrizione"}),d.jsx(Uc,{id:"description",value:c.description,onChange:$=>f({...c,description:$.target.value}),placeholder:"Breve descrizione del documento",rows:3,"data-testid":"input-document-description"})]}),d.jsx(h$e,{value:c.storagePath,onChange:($,G,te,ce)=>f({...c,storagePath:$,fileName:G,fileSize:te,mimeType:ce})}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{htmlFor:"sortOrder",children:"Ordine"}),d.jsx(an,{id:"sortOrder",type:"number",value:c.sortOrder,onChange:$=>f({...c,sortOrder:$.target.value}),placeholder:"0","data-testid":"input-document-order"})]}),d.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[d.jsx(ou,{id:"isPublished",checked:c.isPublished,onCheckedChange:$=>f({...c,isPublished:$}),"data-testid":"switch-document-published"}),d.jsx(Fn,{htmlFor:"isPublished",children:"Pubblicato"})]})]}),d.jsxs(rg,{children:[d.jsx(tt,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Annulla"}),d.jsxs(tt,{type:"submit",disabled:S.isPending||C.isPending,"data-testid":"button-save-document",children:[(S.isPending||C.isPending)&&d.jsx(lv,{className:"w-4 h-4 mr-2 animate-spin"}),n?"Aggiorna":"Crea"]})]})]})]})})]})}const Hz={title:"",description:"",eventDate:"",location:"",posterUrl:"",isPublished:!0},f$e=t=>new Intl.DateTimeFormat("it-IT",{dateStyle:"medium",timeStyle:"short"}).format(new Date(t)),m$e=t=>{const e=new Date(t),i=e.getTimezoneOffset()*6e4;return new Date(e.getTime()-i).toISOString().slice(0,16)};function g$e(){const{toast:t}=ks(),e=K.useRef(null),[i,n]=K.useState(Hz),[o,c]=K.useState(null),[f,r]=K.useState(!1),{data:x=[],isLoading:S}=Xn({queryKey:["/api/admin/events"]}),C=$n({mutationFn:async()=>xn(o?"PATCH":"POST",o?`/api/admin/events/${o}`:"/api/admin/events",{...i,eventDate:new Date(i.eventDate).toISOString(),posterUrl:i.posterUrl||null}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/events"]}),n(Hz),c(null),t({title:o?"Evento aggiornato":"Evento creato"})},onError:()=>t({title:"Errore salvataggio",variant:"destructive"})}),I=$n({mutationFn:B=>xn("DELETE",`/api/admin/events/${B}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/events"]}),t({title:"Evento eliminato"})}}),N=$n({mutationFn:B=>xn("PATCH",`/api/admin/events/${B.id}`,{isPublished:!B.isPublished}),onSuccess:()=>Qi.invalidateQueries({queryKey:["/api/admin/events"]})}),D=async B=>{if(!B.type.startsWith("image/"))return t({title:"Seleziona un'immagine",variant:"destructive"});r(!0);try{const W=await xn("POST","/api/objects/upload"),{uploadURL:$}=await W.json();if(!(await fetch($,{method:"PUT",body:B,headers:{"Content-Type":B.type}})).ok)throw new Error;const te=await xn("POST","/api/admin/events/confirm-poster-upload",{fileURL:$}),{posterUrl:ce}=await te.json();n(_e=>({..._e,posterUrl:ce})),t({title:"Locandina caricata"})}catch{t({title:"Errore upload",description:"Riprova con un'immagine JPG, PNG o WebP fino a 10 MB.",variant:"destructive"})}finally{r(!1)}},V=B=>
3911n({title:B.title,description:B.description,eventDate:m$e(B.eventDate),location:B.location,posterUrl:B.posterUrl||"",isPublished:B.isPublished});return d.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(280px,380px)_1fr]",children:[d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Hp,{className:"h-5 w-5 text-primary"}),o?"Modifica evento":"Nuovo evento"]})}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"Titolo"}),d.jsx(an,{value:i.title,onChange:B=>n({...i,title:B.target.value})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"Descrizione"}),d.jsx(Uc,{rows:5,value:i.description,onChange:B=>n({...i,description:B.target.value})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"Data e ora"}),d.jsx(an,{type:"datetime-local",value:i.eventDate,onChange:B=>n({...i,eventDate:B.target.value})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"Luogo"}),d.jsx(an,{value:i.location,onChange:B=>n({...i,location:B.target.value})})]}),d.jsx("input",{ref:e,type:"file",accept:"image/*",className:"hidden",onChange:B=>{var W;return((W=B.target.files)==null?void 0:W[0])&&D(B.target.files[0])}}),d.jsxs(tt,{type:"button",variant:"outline",className:"w-full",onClick:()=>{var B;return(B=e.current)==null?void 0:B.click()},disabled:f,children:[d.jsx(K3,{className:"mr-2 h-4 w-4"}),f?"Caricamento...":i.posterUrl?"Sostituisci locandina":"Carica locandina"]}),i.posterUrl&&d.jsx("img",{src:i.posterUrl,alt:"Anteprima locandina",className:"max-h-40 w-full rounded-lg object-cover"}),d.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[d.jsx(Fn,{htmlFor:"publish-event",children:"Pubblicato"}),d.jsx(ou,{id:"publish-event",checked:i.isPublished,onCheckedChange:B=>n({...i,isPublished:B})})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{className:"flex-1",disabled:C.isPending||!i.title||!i.description||!i.eventDate||!i.location,onClick:()=>C.mutate(),children:o?"Salva modifiche":"Crea evento"}),o&&d.jsx(tt,{variant:"outline",onClick:()=>{c(null),n(Hz)},children:"Annulla"})]})]})]}),d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsx(kn,{children:"Eventi pubblicati e bozze"})}),d.jsx(Ji,{children:S?d.jsx("div",{className:"h-32 animate-pulse rounded bg-muted"}):d.jsx("div",{className:"space-y-3",children:x.map(B=>
3911d.jsxs("div",{className:"flex flex-wrap items-center gap-4 rounded-xl border p-3",children:[d.jsx("div",{className:"h-16 w-20 shrink-0 overflow-hidden rounded-lg bg-muted",children:B.posterUrl?d.jsx("img",{src:B.posterUrl,alt:"",className:"h-full w-full object-cover"}):d.jsx(Hp,{className:"m-5 h-6 w-6 text-primary/50"})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("p",{className:"font-semibold",children:B.title}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:[f$e(B.eventDate)," · ",B.location]}),d.jsx(En,{variant:B.isPublished?"default":"secondary",className:"mt-1",children:B.isPublished?"Pubblicato":"Bozza"})]}),d.jsxs("div",{className:"flex gap-1",children:[d.jsx(tt,{size:"icon",variant:"ghost",title:B.isPublished?"Nascondi":"Pubblica",onClick:()=>N.mutate(B),children:B.isPublished?d.jsx(Ok,{className:"h-4 w-4"}):d.jsx(Tb,{className:"h-4 w-4"})}),d.jsx(tt,{size:"icon",variant:"ghost",title:"Modifica",onClick:()=>{c(B.id),V(B)},children:d.jsx(nO,{className:"h-4 w-4"})}),d.jsx(tt,{size:"icon",variant:"ghost",title:"Elimina",onClick:()=>window.confirm("Eliminare questo evento?")&&I.mutate(B.id),children:d.jsx(Ld,{className:"h-4 w-4 text-destructive"})})]})]},B.id))})})]})]})}function y$e(){const{toast:t}=ks(),[e,i]=K.useState(null),n=$n({mutationFn:async()=>xn("POST","/api/admin/auto-recover-referral-bonuses",{dryRun:!0}),onSuccess:async c=>{const f=await c.json();i(f)},onError:async c=>{var r,x;let f="Errore sconosciuto";try{f=((x=await((r=c.json)==null?void 0:r.call(c)))==null?void 0:x.message)||f}catch{}t({title:"Errore",description:f,variant:"destructive"})}}),o=$n({mutationFn:async()=>xn("POST","/api/admin/auto-recover-referral-bonuses",{dryRun:!1}),onSuccess:async c=>{const f=await c.json();t({title:"Recupero completato",description:f.message}),i(null),Qi.invalidateQueries({queryKey:["/api/admin/users"]})},onError:async c=>{var r,x;let f="Errore sconosciuto";try{f=((x=await((r=c.json)==null?void 0:r.call(c)))==null?void 0:x.message)||f}catch{}t({title:"Errore",description:f,variant:"destructive"})}});return d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Bc,{className:"w-5 h-5"}),"Recupero Automatico Bonus Referral"]}),d.jsx(da,{children:"Trova tutti gli utenti con referral registrato ma bonus non ancora erogato e accredita in blocco"})]}),d.jsx(Ji,{className:"space-y-4",children:e?d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex gap-4 text-sm",children:[d.jsxs("span",{className:"font-medium text-green-600 dark:text-green-400",children:[e.totalToRecover," da recuperare"]}),d.jsxs("span",{className:"text-muted-foreground",children:[e.totalSkipped," già elaborati"]})]}),e.totalToRecover===0?d.jsx("p",{className:"text-sm text-muted-foreground italic",children:"Nessun bonus mancante trovato. Tutto in ordine."}):d.jsx("div",{className:"border rounded-md overflow-hidden max-h-48 overflow-y-auto",children:e.toRecover.map((c,f)=>d.jsxs("div",{className:"px-3 py-2 text-xs border-b last:border-0",children:[d.jsx("span",{className:"font-medium",children:c.newUser.name||c.newUser.email}),d.jsxs("span",{className:"text-muted-foreground",children:[" â +",c.refereeCEI," CEI"]}),d.jsx("span",{className:"text-muted-foreground mx-1",children:"|"}),d.jsx("span",{className:"font-medium",children:c.referrer.name||c.referrer.email}),d.jsxs("span",{className:"text-muted-foreground",children:[" â +",c.referrerCEI," CEI"]})]},f))}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{variant:"outline",onClick:()=>i(null),className:"flex-1","data-testid":"button-referral-recover-cancel",children:"Annulla"}),e.totalToRecover>0&&d.jsx(tt,{onClick:()=>o.mutate(),disabled:o.isPending,className:"flex-1","data-testid":"button-referral-recover-apply",children:o.isPending?"Applicazione...":`Applica ${e.totalToRecover} bonus`})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("p",{className:"text-sm text-muted-foreground",children:["Il sistema cercherà utenti con campo ",d.jsx("strong",{children:"referredBy"})," compilato ma senza transazione ",d.jsx("strong",{children:"referral_bonus"}),". Prima mostra un'anteprima, poi puoi confermare."]}),d.jsx(tt,{onClick:()=>n.mutate(),disabled:n.isPending,variant:"outline",className:"w-full","data-testid":"button-referral-dry-run",children:n.isPending?"Analisi in corso...":"Analizza bonus mancanti"})]})})]})}function _$e({users:t}){const{toast:e}=ks(),[i,n]=K.useState(""),[o,c]=K.useState(""),[f,r]=K.useState(""),[x,S]=K.useState(""),C=$n({mutationFn:async W=>xn("POST","/api/admin/apply-referral-bonus",W),onSuccess:async W=>{const $=await W.json();e({title:"Bonus applicato",description:$.message}),n(""),c(""),r(""),S(""),Qi.invalidateQueries({queryKey:["/api/admin/users"]})},onError:async W=>{var G,te;let $="Errore sconosciuto";
3911try{$=((te=await((G=W.json)==null?void 0:G.call(W)))==null?void 0:te.message)||$}catch{}e({title:"Errore",description:$,variant:"destructive"})}}),I=W=>t.filter($=>W.length<2?!1:`${$.firstName||""} ${$.lastName||""} ${$.email||""}`.toLowerCase().includes(W.toLowerCase())).slice(0,8),N=I(f),D=I(x),V=t.find(W=>W.id===i),B=t.find(W=>W.id===o);return d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(t1,{className:"w-5 h-5"}),"Bonus Referral Manuale"]}),d.jsx(da,{children:"Accredita retroattivamente i bonus referral persi (es. utenti registrati senza link)"})]}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Nuovo utente (chi si è iscritto)"}),d.jsx(an,{placeholder:"Cerca per nome o email...",value:f,onChange:W=>{r(W.target.value),n("")},"data-testid":"input-referral-new-user"}),i&&V&&d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selezionato: ",d.jsxs("strong",{children:[V.firstName," ",V.lastName]})," (",V.email,")"]}),N.length>0&&!i&&d.jsx("div",{className:"border rounded-md overflow-hidden",children:N.map(W=>d.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm hover-elevate",onClick:()=>{n(W.id),r(`${W.firstName||""} ${W.lastName||""} â ${W.email}`)},"data-testid":`option-new-user-${W.id}`,children:[W.firstName," ",W.lastName," ",d.jsxs("span",{className:"text-muted-foreground",children:["(",W.email,")"]})]},W.id))})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Chi ha invitato (referrer)"}),d.jsx(an,{placeholder:"Cerca per nome o email...",value:x,onChange:W=>{S(W.target.value),c("")},"data-testid":"input-referral-referrer"}),o&&B&&d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Selezionato: ",d.jsxs("strong",{children:[B.firstName," ",B.lastName]})," (",B.email,")"]}),D.length>0&&!o&&d.jsx("div",{className:"border rounded-md overflow-hidden",children:D.map(W=>d.jsxs("button",{type:"button",className:"w-full text-left px-3 py-2 text-sm hover-elevate",onClick:()=>{c(W.id),S(`${W.firstName||""} ${W.lastName||""} â ${W.email}`)},"data-testid":`option-referrer-${W.id}`,children:[W.firstName," ",W.lastName," ",d.jsxs("span",{className:"text-muted-foreground",children:["(",W.email,")"]})]},W.id))})]}),d.jsx(tt,{onClick:()=>C.mutate({newUserId:i,referrerUserId:o}),disabled:!i||!o||C.isPending,className:"w-full","data-testid":"button-apply-referral-bonus",children:C.isPending?"Applicazione in corso...":"Applica Bonus Referral"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Verificherà automaticamente che il bonus non sia già stato erogato prima di procedere."})]})]})}function v$e(){var es,dl,ta,Fr,co,qo,ia;const{t}=pr(),{user:e,isLoading:i,isAuthenticated:n,isAdmin:o}=Ka();dv();const{toast:c}=ks(),[,f]=$o(),[r,x]=K.useState({}),[S,C]=K.useState({isOpen:!1,targetUser:null,newRole:!1}),[I,N]=K.useState(null),[D,V]=K.useState({open:!1,userId:null}),[B,W]=K.useState({isOpen:!1,targetUser:null}),[$,G]=K.useState(""),[te,ce]=K.useState(""),[_e,Te]=K.useState(""),[we,Ne]=K.useState(""),pe={name:"",address:"",city:"",phone:"",latitude:"",longitude:"",logoUrl:"",isVisible:!0},[Pe,De]=K.useState(pe),[Je,dt]=K.useState(null),[At,qt]=K.useState(!1),[kt,Vt]=K.useState(!1),Fe=K.useRef(null),lt=K.useRef(null),pt=async Qe=>{if(!Qe.type.startsWith("image/")){c({title:"Formato non valido",description:"Carica un'immagine (PNG, JPG, SVG, WebP).",variant:"destructive"});return}if(Qe.size>5*1024*1024){c({title:"File troppo grande",description:"Massimo 5 MB.",variant:"destructive"});return}Vt(!0);try{const Di=await fetch("/api/objects/upload",{method:"POST",credentials:"include"});if(!Di.ok)throw new Error("Impossibile ottenere URL di upload");const{uploadURL:bn}=await Di.json();await fetch(bn,{method:"PUT",body:Qe,headers:{"Content-Type":Qe.type}});const Br=await fetch("/api/admin/confirm-video-upload",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileURL:bn,folder:"map-points"})});if(!Br.ok)throw new Error("Errore nella conferma upload");const{url:na}=await Br.json();De(yo=>({...yo,logoUrl:na})),c({title:"Logo caricato",description:"L'immagine è stata caricata con successo."})}catch(Di){c({title:"Errore upload",description:(Di==null?void 0:Di.message)||"Riprova.",variant:"destructive"})}finally{Vt(!1)}},Ge=async()=>{const Qe=Pe.address.trim();if(!Qe){c({title:"Indirizzo mancante",description:"Scrivi prima l'indirizzo da cercare.",variant:"destructive"});return}const Di="pk.eyJ1IjoiY2VpbWFwIiwiYSI6ImNtaTRseHF5YzE2Nmwya3NmM2ZobmY2aGsifQ.4jIw7xJ2iOpibQfJ9CthhQ";qt(!0);try{const bn=`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(Qe)}.json?access_token=${Di}
3911&language=it&country=it&limit=1`,na=await(await fetch(bn)).json();if(!na.features||na.features.length===0){c({title:"Indirizzo non trovato",description:"Prova a essere più preciso (es. Via Roma 1, Milano).",variant:"destructive"});return}const[yo,Mo]=na.features[0].center;De(hu=>({...hu,latitude:String(Mo),longitude:String(yo)})),c({title:"Coordinate trovate",description:`${Mo.toFixed(6)}, ${yo.toFixed(6)}`})}catch{c({title:"Errore geocoding",description:"Impossibile contattare il servizio mappe.",variant:"destructive"})}finally{qt(!1)}},{data:Rt=[],isLoading:Ot}=Xn({queryKey:["/api/admin/users"],enabled:!!e&&o}),Ci=new URLSearchParams;Object.entries(r).forEach(([Qe,Di])=>{Di&&Ci.set(Qe,Di)});const Hi=Ci.toString(),{data:ei=[],isLoading:si}=Xn({queryKey:["/api/admin/transactions",Hi],queryFn:async()=>{const Qe=`/api/admin/transactions${Hi?`?${Hi}`:""}`,Di=await fetch(Qe,{credentials:"include"});if(!Di.ok)throw new Error(t("messages.fetchError"));return Di.json()},enabled:!!e&&o}),{data:Oi=[],isLoading:Ei}=Xn({queryKey:["/api/admin/audit-logs"],enabled:!!e&&o}),{data:Ai}=Xn({queryKey:["/api/admin/credit-stats"],enabled:!!e&&o}),{data:Xi=[],isLoading:Nn}=Xn({queryKey:["/api/admin/map-points"],enabled:!!e&&o}),zi=$n({mutationFn:Qe=>xn("POST","/api/admin/map-points",Qe),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/map-points"]}),Qi.invalidateQueries({queryKey:["/api/map-points"]}),De(pe),c({title:"Punto aggiunto",description:"Il punto è stato aggiunto alla mappa."})},onError:()=>c({title:"Errore",description:"Impossibile aggiungere il punto.",variant:"destructive"})}),Gi=$n({mutationFn:({id:Qe,data:Di})=>xn("PATCH",`/api/admin/map-points/${Qe}`,Di),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/map-points"]}),Qi.invalidateQueries({queryKey:["/api/map-points"]}),dt(null),De(pe),c({title:"Punto aggiornato"})},onError:()=>c({title:"Errore",description:"Impossibile aggiornare il punto.",variant:"destructive"})}),Sr=$n({mutationFn:Qe=>xn("DELETE",`/api/admin/map-points/${Qe}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/admin/map-points"]}),Qi.invalidateQueries({queryKey:["/api/map-points"]}),c({title:"Punto eliminato"})},onError:()=>c({title:"Errore",description:"Impossibile eliminare il punto.",variant:"destructive"})}),Kr=(Qe,Di)=>{if(!Di.trim())return Qe;const bn=Di.toLowerCase().trim();return Qe.filter(Br=>{const na=`${Br.firstName||""} ${Br.lastName||""}`.toLowerCase(),yo=(Br.email||"").toLowerCase(),Mo=(Br.city||"").toLowerCase(),hu=Br.memberNumber?String(Br.memberNumber):"";return na.includes(bn)||yo.includes(bn)||Mo.includes(bn)||hu.includes(bn)})},rs=Kr(Rt,$),Yn=Kr(Rt,te),Ys=Kr(Rt,_e),Ia=Kr(Rt,we),Qs=$n({mutationFn:async({userId:Qe,isAdmin:Di})=>await(await xn("POST","/api/admin/users/role",{userId:Qe,isAdmin:Di,reason:t(Di?"messages.promotedToAdmin":"messages.demotedFromAdmin")})).json(),onSuccess:Qe=>{Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.invalidateQueries({queryKey:["/api/admin/audit-logs"]}),c({title:t("messages.success"),description:Qe.message}),C({isOpen:!1,targetUser:null,newRole:!1})},onError:Qe=>{c({title:t("messages.error"),description:Qe.message,variant:"destructive"})}}),ot=$n({mutationFn:async({userId:Qe,isProfessional:Di})=>await(await xn("POST","/api/admin/users/professional",{userId:Qe,isProfessional:Di,reason:t(Di?"admin.manualProfessionalActivation":"admin.manualProfessionalDeactivation")})).json(),onSuccess:Qe=>{Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.invalidateQueries({queryKey:["/api/admin/audit-logs"]}),c({title:t("messages.success"),description:Qe.message})},onError:Qe=>{c({title:t("messages.error"),description:Qe.message||t("messages.failedToUpdateRole"),variant:"destructive"})}}),Pt=$n({mutationFn:async()=>await(await xn("POST","/api/admin/fix-coordinates",{})).json(),onSuccess:Qe=>{c({title:"Coordinate corrette",description:Qe.message||`${Qe.fixedCount} utente/i aggiornato/i`})},onError:Qe=>{c({title:"Errore",description:Qe.message||"Impossibile correggere le coordinate",variant:"destructive"})}}),$t=$n({mutationFn:async Qe=>await(await xn("POST",`/api/admin/users/${Qe}/regeocode`,{})).json(),onSuccess:(Qe,Di)=>{Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.removeQueries({queryKey:["/api/users-with-location"]}),c({title:"Re-geocodifica completata",description:`${Qe.message||"Coordinate aggiornate"}. Apertura mappa...`}),setTimeout(()=>f(`/map?userId=${Di}`),800)},onError:Qe=>{c({title:"Errore re-geocodifica",description:Qe.message||"Impossibile geocodificare l'utente",variant:"destructive"})}}),Li=$n({mutationFn:async({userId:Qe,latitude:Di,longitude:bn,city:Br})=>await(await xn("POST",`/api/admin/users/${Qe}/coordinates`,{latitude:Di,longitude:bn,city:Br})).json(),onSuccess:Qe=>{Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.removeQueries({queryKey:["/api/users-with-location"]}),c({title:"Coordinate aggiornate",description:Qe.message||"Coordinate salvate con successo"}),N(null)},onError:Qe=>{c({title:"Errore",description:Qe.message||"Impossibile aggiornare le coordinate",variant:"destructive"})}}),wi=$n({mutationFn:async Qe=>await(await xn("DELETE",`/api/admin/users/${Qe}`)).json(),onSuccess:Qe=>{Qi.invalidateQueries({queryKey:["/api/admin/users"]}),Qi.invalidateQueries({queryKey:["/api/admin/audit-logs"]}),c({title:t("messages.success"),description:Qe.message||t("admin.userDeleted","Utente eliminato con successo")}),W({isOpen:!1,targetUser:null})},onError:Qe=>{c({title:t("messages.error"),description:Qe.message||t("admin.deleteUserFailed","Impossibile eliminare l'utente"),variant:"destructive"})}}),pi=(Qe,Di)=>{C({isOpen:!0,targetUser:Qe,newRole:Di})},en=Qe=>{W({isOpen:!0,targetUser:Qe})},jn=()=>{B.targetUser&&wi.mutate(B.targetUser.id)},ss=()=>{S.targetUser&&Qs.mutate({userId:S.targetUser.id,isAdmin:S.newRole})};return K.useEffect(()=>{if(!i&&!n){c({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}!i&&n&&!o&&(c({title:t("messages.accessDenied"),description:t("messages.accessDeniedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/"},1e3))},[n,o,i,c,t]),i?d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-12 h-12 border-4 border-primary border-t-transparent roun
3911ded-full animate-spin mx-auto mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("common.loading")})]})}):o?d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-4 flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-12 h-12"}),d.jsxs("div",{children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("span",{className:"text-xl font-bold",children:t("header.adminDashboard")})}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Wallet Manager"})]})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(TE,{}),d.jsx(tt,{variant:"outline",asChild:!0,children:d.jsxs(yr,{href:"/dashboard",children:[d.jsx(eM,{className:"w-4 h-4 mr-2"}),t("header.myWallet")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-admin-logout",children:d.jsxs("a",{href:"/api/logout",children:[d.jsx(CJ,{className:"w-4 h-4 mr-2"}),t("common.signOut")]})})]})]})}),d.jsxs("main",{className:"max-w-7xl mx-auto px-6 py-8",children:[d.jsxs("div",{className:"mb-8",children:[d.jsx("h1",{className:"text-3xl font-bold mb-2",children:t("admin.title")}),d.jsx("p",{className:"text-muted-foreground",children:t("admin.subtitle")})]}),d.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4 mb-8",children:[d.jsxs(Ti,{"data-testid":"card-total-members",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:t("admin.totalMembers","Iscritti Totali")}),d.jsx(Bc,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(Ji,{children:[d.jsx("div",{className:"text-2xl font-bold","data-testid":"text-total-members",children:Ot?"...":Rt.length}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("admin.totalMembersDesc","Tutti gli utenti registrati")})]})]}),d.jsxs(Ti,{"data-testid":"card-members-with-tax-code",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:"Iscritti con Codice Fiscale"}),d.jsx(z8,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(Ji,{children:[d.jsx("div",{className:"text-2xl font-bold","data-testid":"text-members-with-tax-code",children:Ot?"...":Rt.filter(Qe=>{var Di;return!!((Di=Qe.codiceFiscale)!=null&&Di.trim())}).length}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Codice fiscale compilato nel profilo"})]})]}),d.jsxs(Ti,{"data-testid":"card-visible-members",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:t("admin.visibleOnMap","Visibili in Mappa")}),d.jsx(z8,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(Ji,{children:[d.jsx("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400","data-testid":"text-visible-members",children:Ot?"...":Rt.filter(Qe=>Qe.profileCompleted&&Qe.latitude&&Qe.longitude).length}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("admin.visibleOnMapDesc","Profilo completo con posizione")})]})]}),d.jsxs(Ti,{"data-testid":"card-wallet-balance",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:t("admin.totalCreditsIssued","Totale Crediti CEI")}),d.jsx(e1,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(Ji,{children:[d.jsxs("div",{className:"text-2xl font-bold text-blue-600 dark:text-blue-400","data-testid":"text-total-credits-issued",children:[((es=Ai==null?void 0:Ai.totalWalletBalance)==null?void 0:es.toLocaleString("it-IT"))??"..."," CEI"]}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("admin.creditsIssuedDesc","Somma saldi di tutti i wallet")})]})]}),d.jsxs(Ti,{"data-testid":"card-exchange-volume",children:[d.jsxs(In,{className:"flex flex-row items-center justify-between gap-2 space-y-0 pb-2",children:[d.jsx(kn,{className:"text-sm font-medium",children:t("admin.exchangeVolume","Volume Scambi")}),d.jsx(Fve,{className:"h-4 w-4 text-muted-foreground"})]}),d.jsxs(Ji,{children:[d.jsxs("div",{className:"text-2xl font-bold text-green-600 dark:text-green-400","data-testid":"text-exchange-volume",children:[((dl=Ai==null?void 0:Ai.exchangeVolume)==null?void 0:dl.toLocaleStr
3911ing("it-IT"))??"..."," CEI"]}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("admin.exchangeVolumeDesc","Transazioni fra utenti")})]})]})]}),d.jsxs(qM,{defaultValue:"users",className:"space-y-6",children:[d.jsxs(RE,{className:"flex-wrap",children:[d.jsx(za,{value:"users","data-testid":"tab-users",children:"Users & Wallets"}),d.jsx(za,{value:"management","data-testid":"tab-admin-management",children:"Admin Management"}),d.jsxs(za,{value:"vouchers","data-testid":"tab-vouchers",children:[d.jsx(t1,{className:"w-4 h-4 mr-1"}),"Vouchers"]}),d.jsxs(za,{value:"videos","data-testid":"tab-videos",children:[d.jsx(Eb,{className:"w-4 h-4 mr-1"}),"Video Academy"]}),d.jsx(za,{value:"documents","data-testid":"tab-documents",children:"Documenti"}),d.jsxs(za,{value:"events","data-testid":"tab-events",children:[d.jsx(Hp,{className:"w-4 h-4 mr-1"}),"Eventi"]}),d.jsx(za,{value:"settings","data-testid":"tab-settings",children:"Settings"}),d.jsxs(za,{value:"map-points","data-testid":"tab-map-points",children:[d.jsx(fo,{className:"w-4 h-4 mr-1"}),"Punti Mappa"]}),d.jsx(za,{value:"audit","data-testid":"tab-audit-logs",children:"Audit Logs"})]}),d.jsx(La,{value:"users",className:"space-y-6",children:d.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[d.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center justify-between gap-4 mb-4 flex-wrap",children:[d.jsx("h2",{className:"text-xl font-semibold",children:t("admin.allUsers")}),d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsxs(tt,{variant:"outline",size:"sm",onClick:async()=>{try{const Di=await(await xn("POST","/api/admin/members/backfill-member-numbers")).json();c({title:Di.message}),Qi.invalidateQueries({queryKey:["/api/admin/users"]})}catch(Qe){c({title:"Errore",description:Qe.message,variant:"destructive"})}},"data-testid":"button-backfill-member-numbers",children:[d.jsx(P8,{className:"h-4 w-4 mr-2"}),t("admin.assignMemberNumbers","Assegna N. Tessera Mancanti")]}),d.jsxs(tt,{variant:"outline",size:"sm",onClick:async()=>{if(confirm(t("admin.reassignConfirm","Vuoi riassegnare TUTTI i numeri tessera in ordine cronologico? I numeri attuali verranno annullati.")))try{const Di=await(await xn("POST","/api/admin/members/backfill-member-numbers",{reassignAll:!0})).json();c({title:Di.message}),Qi.invalidateQueries({queryKey:["/api/admin/users"]})}catch(Qe){c({title:"Errore",description:Qe.message,variant:"destructive"})}},"data-testid":"button-reassign-member-numbers",children:[d.jsx(P8,{className:"h-4 w-4 mr-2"}),t("admin.reassignMemberNumbers","Riassegna Tutte le Tessere")]}),d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>{window.open("/api/admin/members/export-csv","_blank")},"data-testid":"button-export-libro-soci",children:[d.jsx(Qve,{className:"h-4 w-4 mr-2"}),t("admin.exportMembers","Esporta Libro Soci (CSV)")]})]})]}),d.jsxs("div",{className:"relative mb-4",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:t("admin.searchUsers","Cerca utente per nome, email, città o n. tessera..."),value:$,onChange:Qe=>G(Qe.target.value),className:"pl-10","data-testid":"input-search-users"})]}),Ot?d.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:[1,2,3,4].map(Qe=>d.jsx("div",{className:"h-32 bg-card rounded-lg animate-pulse"},Qe))}):rs.length===0?d.jsx("div",{className:"text-center py-12 bg-card rounded-lg",children:d.jsx("p",{className:"text-muted-foreground",children:$?t("admin.noSearchResults","Nessun utente trovato"):t("admin.noUsers")})}):d.jsxs(d.Fragment,{children:[$&&d.jsxs("p",{className:"text-sm text-muted-foreground mb-2",children:[rs.length," ",rs.length===1?"risultato":"risultati"]}),d.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:rs.map(Qe=>d.jsx(e$e,{user:Qe},Qe.id))})]})]}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:t("admin.allTransactions")}),d.jsx(Ece,{transactions:ei,isLoading:si,isAdmin:!0,onFilterChange:x})]})]}),d.jsx("div",{children:d.jsx(t$e,{})})]})}),d.jsx(La,{value:"management",children:d.jsxs("div",{className:"space-y-6",children:[d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(GI,{className:"w-5 h-5"}),t("admin.professionalStatusTitle")]}),d.jsx(da,{children:t("admin.professionalStatusDesc")})]}),d.jsxs(Ji,{children:[d.jsxs("div",{className:"relative mb-4",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:t("admin.searchUsers","Cerca utente per nome, email, città o n. tessera..."),value:te,onChange:Qe=>ce(Qe.target.value),className:"pl-10","data-testid":"input-search-professional"})]}),Ot?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(Qe=>d.jsx("div",{className:"h-16 bg-muted rounded-lg animate-pulse"},Qe))}):Yn.length===0?d.jsx("div",{className:"text-center py-8",children:d.jsx("p",{className:"text-muted-foreground",children:t("admin.noSearchResults","Nessun utente trovato")})}):d.jsxs("div",{className:"space-y-4",children:[te&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:[Yn.length," ",Yn.length===1?"risultato":"risultati"]}),Yn.map(Qe=>d.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg hover-elevate","data-testid":`user-professional-${Qe.id}`,children:[d.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("p",{className:"font-medium",children:Qe.firstName&&Qe.lastName?`${Qe.firstName} ${Qe.lastName}`:Qe.email}),d.jsx("p",{className:"text-sm text-muted-foreground",children:Qe.email})]}),d.jsx("div",{children:Qe.isProfessional?d.jsxs(En,{variant:"default",className:"gap-1 bg-amber-500 hover:bg-amber-600",children:[d.jsx(GI,{className:"w-3 h-3"}),"Professional"]}):d.jsx(En,{variant:"secondary",children:"Standard"})})]}),d.jsx("div",{className:"ml-4",children:Qe.isProfessional?d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>ot.mutate({userId:Qe.id,isProfessional:!1}),disabled:ot.isPending,"data-testid":`button-deactivate-professional-${Qe.id}`,children:[d.jsx(B_,{className:"w-4 h-4 mr-2"}),t("admin.deactivateProfessional")]}):d.jsxs(tt,{variant:"default",size:"sm",onClick:()=>ot.mutate({userId:Qe.id,isProfessional:!0}),disabled:ot.isPending,"data-testid":`button-activate-professional-${Qe.id}`,children:[d.jsx(GI,{className:"w-4 h-4 mr-2"}),t("admin.activateProfessional")]})})]},Qe.id))]})]})]}),d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsx(kn,{children:"Admin Role Management"}),d.jsx(da,{children:"Manage administrator privileges for users"})]}),d.jsxs(Ji,{children:[d.jsxs("div",{className:"relative mb-4",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:t("admin.searchUsers","Cerca utente per nome, email, città o n. tessera..."),value:_e,onChange:Qe=>Te(Qe.target.value),className:"pl-10","data-testid":"input-search-roles"})]}),Ot?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(Qe=>d.jsx("div",{className:"h-16 bg-muted rounded-lg animate-pulse"},Qe))}):Ys.length===0?d.jsx("div",{className:"text-center py-8",children:d.jsx("p",{className:"text-muted-foreground",children:t("admin.noSearchResults","Nessun utente trovato")})}):d.jsxs("div",{className:"space-y-4",children:[_e&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:[Ys.length," ",Ys.length===1?"risultato":"risultati"]}),Ys.map(Qe=>d.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg hover-elevate","data-testid":`user-role-${Qe.id}`,children:[d.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("p",{className:"font-medium","data-testid":`text-user-name-${Qe.id}`,children:Qe.firstName&&Qe.lastName?`${Qe.firstName} ${Qe.lastName}`:Qe.email}),d.jsx("p",{className:"text-sm text-muted-foreground","data-testid":`text-user-email-${Qe.id}`,children:Qe.email})]}),d.jsx("div",{children:Qe.isAdmin?d.jsxs(En,{variant:"default",className:"gap-1","data-testid":`badge-admin-${Qe.id}`,children:[d.jsx(Ij,{className:"w-3 h-3"}),"Admin"]}):d.jsx(En,{variant:"secondary","data-testid":`badge-user-${Qe.id}`,children:"User"})})]}),d.jsxs("div",{className:"ml-4 flex items-center gap-2",children:[d.jsx(tt,{variant:"ghost",size:"icon",onClick:()=>V({open:!0,userId:Qe.id}),"data-testid":`button-view-profile-${Qe.id}`,title:"Visualizza profilo",children:d.jsx(Tb,{className:"w-4 h-4"})}),Qe.id===(e==null?void 0:e.id)?d.jsx(tt,{variant:"ghost",size:"sm",disabled:!0,"data-testid":`button-role-disabled-${Qe.id}`,children:"You"}):Qe.isAdmin?d.jsxs(tt,{variant:"outline",size:"sm",onClick:()=>pi(Qe,!1),"data-testid":`button-demote-${Qe.id}`,children:[d.jsx(D8,{className:"w-4 h-4 mr-2"}),"Demote"]}):d.jsxs(d.Fragment,{children:[d.jsxs(tt,{variant:"default",size:"sm",onClick:()=>pi(Qe,!0),"data-testid":`button-promote-${Qe.id}`,children:[d.jsx(Ij,{className:"w-4 h-4 mr-2"}),"Promote"]}),d.jsx(tt,{variant:"destructive",size:"icon",onClick:()=>en(Qe),"data-testid":`button-delete-user-${Qe.id}
3911`,title:t("admin.deleteUser","Elimina utente"),children:d.jsx(Ld,{className:"w-4 h-4"})})]})]})]},Qe.id))]})]})]})]})}),d.jsx(La,{value:"vouchers",children:d.jsx(s$e,{})}),d.jsx(La,{value:"videos",children:d.jsx(c$e,{})}),d.jsx(La,{value:"documents",children:d.jsx(p$e,{})}),d.jsx(La,{value:"events",children:d.jsx(g$e,{})}),d.jsx(La,{value:"settings",children:d.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[d.jsx(i$e,{}),d.jsx(n$e,{}),d.jsx(y$e,{}),d.jsx(_$e,{users:Rt}),d.jsx(r$e,{}),d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(fo,{className:"w-5 h-5"}),"Correggi Coordinate Utenti"]}),d.jsx(da,{children:"Corregge automaticamente le coordinate invertite (lat/long scambiate) per tutti gli utenti sulla mappa"})]}),d.jsxs(Ji,{children:[d.jsx(tt,{onClick:()=>Pt.mutate(),disabled:Pt.isPending,"data-testid":"button-fix-coordinates",className:"w-full",children:Pt.isPending?"Correzione in corso...":"Correggi Coordinate"}),d.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"Questo tool identifica e corregge automaticamente utenti con coordinate fuori range o invertite."})]})]}),d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(fo,{className:"w-5 h-5"}),"Gestione Coordinate Utenti"]}),d.jsx(da,{children:"Visualizza e modifica le coordinate GPS degli utenti"})]}),d.jsxs(Ji,{children:[d.jsxs("div",{className:"relative mb-3",children:[d.jsx(jh,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),d.jsx(an,{placeholder:t("admin.searchUsers","Cerca utente per nome, email, città o n. tessera..."),value:we,onChange:Qe=>Ne(Qe.target.value),className:"pl-10","data-testid":"input-search-coords"})]}),d.jsxs("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:[Ia.length===0?d.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:t("admin.noSearchResults","Nessun utente trovato")}):null,Ia.map(Qe=>d.jsx("div",{className:"p-3 border rounded-lg","data-testid":`coords-user-${Qe.id}`,children:(I==null?void 0:I.userId)===Qe.id?d.jsxs("div",{className:"space-y-3",children:[d.jsxs("p",{className:"font-medium text-sm",children:[Qe.firstName," ",Qe.lastName]}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsxs("div",{children:[d.jsx(Fn,{className:"text-xs",children:"Latitudine"}),d.jsx(an,{type:"text",value:I.latitude,onChange:Di=>N({...I,latitude:Di.target.value}),placeholder:"es. 43.8476",className:"h-8 text-sm","data-testid":`input-lat-${Qe.id}`})]}),d.jsxs("div",{children:[d.jsx(Fn,{className:"text-xs",children:"Longitudine"}),d.jsx(an,{type:"text",value:I.longitude,onChange:Di=>N({...I,longitude:Di.target.value}),placeholder:"es. 10.2513",className:"h-8 text-sm","data-testid":`input-lon-${Qe.id}`})]}),d.jsxs("div",{children:[d.jsx(Fn,{className:"text-xs",children:"Città "}),d.jsx(an,{type:"text",value:I.city,onChange:Di=>N({...I,city:Di.target.value}),placeholder:"es. Lucca",className:"h-8 text-sm","data-testid":`input-city-${Qe.id}`})]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs(tt,{size:"sm",onClick:()=>Li.mutate(I),disabled:Li.isPending,"data-testid":`button-save-coords-${Qe.id}`,children:[d.jsx(IJ,{className:"w-3 h-3 mr-1"}),Li.isPending?"Salvo...":"Salva"]}),d.jsxs(tt,{size:"sm",variant:"outline",onClick:()=>N(null),"data-testid":`button-cancel-coords-${Qe.id}`,children:[d.jsx(Fa,{className:"w-3 h-3 mr-1"}),"Annulla"]})]})]}):d.jsxs("div",{className:"flex items-start justify-between",children:[d.jsxs("div",{className:"flex-1",children:[d.jsxs("p",{className:"font-medium text-sm mb-1",children:[Qe.firstName," ",Qe.lastName]}),d.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:Qe.city||"Città non specificata"}),Qe.latitude&&Qe.longitude?d.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs font-mono bg-muted p-2 rounded",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-muted-foreground",children:"Lat:"})," ",d.jsx("span",{className:"font-semibold",children:Qe.latitude})]}),d.jsxs("div",{children:[d.jsx("span",{className:"text-muted-foreground",children:"Lon:"})," ",d.jsx("span",{className:"font-semibold",children:Qe.longitude})]})]}
3911):d.jsx("p",{className:"text-xs text-orange-600 dark:text-orange-400",children:"Coordinate mancanti"})]}),d.jsxs("div",{className:"flex gap-1",children:[d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>$t.mutate(Qe.id),disabled:$t.isPending,title:"Re-geocodifica automatica dalla città ","data-testid":`button-regeocode-${Qe.id}`,children:d.jsx(fo,{className:"w-4 h-4"})}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>{var Di,bn;return N({userId:Qe.id,latitude:((Di=Qe.latitude)==null?void 0:Di.toString())||"",longitude:((bn=Qe.longitude)==null?void 0:bn.toString())||"",city:Qe.city||""})},"data-testid":`button-edit-coords-${Qe.id}`,children:d.jsx(nO,{className:"w-4 h-4"})})]})]})},Qe.id)),Rt.length===0&&d.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Nessun utente registrato"})]})]})]})]})}),d.jsx(La,{value:"map-points",className:"space-y-6",children:d.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[d.jsxs(Ti,{ref:lt,children:[d.jsxs(In,{children:[d.jsx(kn,{className:"text-base",children:Je?"Modifica Punto":"Aggiungi Punto"}),d.jsx(da,{children:`Inserisci le coordinate dalla mappa (es. Google Maps â tasto destro â "Cosa c'è qui?")`})]}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Nome sede *"}),d.jsx(an,{placeholder:"Es. Centro Medico Amico - Milano",value:Pe.name,onChange:Qe=>De(Di=>({...Di,name:Qe.target.value})),"data-testid":"input-map-point-name"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Città "}),d.jsx(an,{placeholder:"Es. Milano",value:Pe.city,onChange:Qe=>De(Di=>({...Di,city:Qe.target.value})),"data-testid":"input-map-point-city"})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Telefono"}),d.jsx(an,{placeholder:"Es. 02 1234567",value:Pe.phone,onChange:Qe=>De(Di=>({...Di,phone:Qe.target.value})),"data-testid":"input-map-point-phone"})]})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsx(Fn,{children:"Indirizzo"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(an,{placeholder:"Via Roma 1, Milano",value:Pe.address,onChange:Qe=>De(Di=>({...Di,address:Qe.target.value})),onKeyDown:Qe=>{Qe.key==="Enter"&&(Qe.preventDefault(),Ge())},"data-testid":"input-map-point-address"}),d.jsx(tt,{type:"button",variant:"outline",onClick:Ge,disabled:At||!Pe.address.trim(),"data-testid":"button-geocode-address",className:"shrink-0",children:At?d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsxs("svg",{className:"animate-spin w-4 h-4",viewBox:"0 0 24 24",fill:"none",children:[d.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),d.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Ricerca..."]}):d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(fo,{className:"w-4 h-4"}),"Trova coordinate"]})})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsxs(Fn,{className:"flex items-center gap-1",children:["Latitudine",Pe.latitude&&d.jsx("span",{className:"text-xs text-green-600 font-normal",children:"rilevata"})]}),d.jsx(an,{placeholder:"automatica",value:Pe.latitude,onChange:Qe=>De(Di=>({...Di,latitude:Qe.target.value})),"data-testid":"input-map-point-lat",className:Pe.latitude?"bg-muted/40":""})]}),d.jsxs("div",{className:"space-y-1",children:[d.jsxs(Fn,{className:"flex items-center gap-1",children:["Longitudine",Pe.longitude&&d.jsx("span",{className:"text-xs text-green-600 font-normal",children:"rilevata"})]}),d.jsx(an,{placeholder:"automatica",value:Pe.longitude,onChange:Qe=>De(Di=>({...Di,longitude:Qe.target.value})),"data-testid":"input-map-point-lng",className:Pe.longitude?"bg-muted/40":""})]})]}),d.jsx("p",{className:"text-xs text-muted-foreground -mt-1",children:`Scrivi l'indirizzo e clicca "Trova coordinate". Puoi anche modificarle manualmente.`}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(Fn,{children:"Logo"}),d.jsx("input",{ref:Fe,type:"file",accept:"image/*",className:"hidden","data-testid":"input-map-point-logo-file",onChange:Qe=>{var bn;const Di=(bn=Qe.target.files)==null?void 0:bn[0];Di&&pt(Di),Qe.target.value=""}}),d.jsxs("div",{className:"flex items-center gap-3",children:[Pe.logoUrl?d.jsx("img",{src:Pe.logoUrl,alt:"logo",className:"w-14 h-14 roun
3911ded-full object-cover border-2 border-border shrink-0",onError:Qe=>Qe.currentTarget.style.display="none"}):d.jsx("div",{className:"w-14 h-14 rounded-full bg-muted flex items-center justify-center shrink-0 border-2 border-dashed border-border",children:d.jsx(fo,{className:"w-6 h-6 text-muted-foreground"})}),d.jsxs("div",{className:"flex flex-col gap-1.5",children:[d.jsx(tt,{type:"button",variant:"outline",size:"sm",onClick:()=>{var Qe;return(Qe=Fe.current)==null?void 0:Qe.click()},disabled:kt,"data-testid":"button-upload-logo",children:kt?d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsxs("svg",{className:"animate-spin w-4 h-4",viewBox:"0 0 24 24",fill:"none",children:[d.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),d.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Caricamento..."]}):Pe.logoUrl?"Cambia logo":"Carica logo"}),Pe.logoUrl&&d.jsx(tt,{type:"button",variant:"ghost",size:"sm",onClick:()=>De(Qe=>({...Qe,logoUrl:""})),"data-testid":"button-remove-logo",children:"Rimuovi"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG, SVG, WebP â max 5 MB"})]})]})]}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(ou,{checked:Pe.isVisible,onCheckedChange:Qe=>De(Di=>({...Di,isVisible:Qe})),"data-testid":"switch-map-point-visible"}),d.jsx(Fn,{children:"Visibile in mappa"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{onClick:()=>{if(!Pe.name||!Pe.latitude||!Pe.longitude){c({title:"Campi obbligatori",description:"Nome, latitudine e longitudine sono richiesti.",variant:"destructive"});return}Je?Gi.mutate({id:Je.id,data:Pe}):zi.mutate(Pe)},disabled:zi.isPending||Gi.isPending,"data-testid":"button-save-map-point",children:Je?"Salva Modifiche":"Aggiungi Punto"}),Je&&d.jsx(tt,{variant:"outline",onClick:()=>{dt(null),De(pe)},"data-testid":"button-cancel-map-point-edit",children:"Annulla"})]})]})]}),d.jsxs(Ti,{children:[d.jsx(In,{children:d.jsxs(kn,{className:"text-base",children:["Punti Inseriti (",Xi.length,")"]})}),d.jsx(Ji,{children:Nn?d.jsx("p",{className:"text-sm text-muted-foreground",children:"Caricamento..."}):Xi.length===0?d.jsx("p",{className:"text-sm text-muted-foreground",children:"Nessun punto inserito."}):d.jsx("div",{className:"space-y-3",children:Xi.map(Qe=>d.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md border",children:[Qe.logoUrl?d.jsx("img",{src:Qe.logoUrl,alt:Qe.name,className:"w-10 h-10 rounded-full object-cover border shrink-0",onError:Di=>Di.currentTarget.style.display="none"}):d.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:d.jsx(fo,{className:"w-5 h-5 text-muted-foreground"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("span",{className:"font-medium text-sm",children:Qe.name}),d.jsx(En,{variant:Qe.isVisible?"default":"secondary",className:"text-xs",children:Qe.isVisible?"Visibile":"Nascosto"})]}),(Qe.city||Qe.address)&&d.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:[Qe.city,Qe.address].filter(Boolean).join(" â ")}),Qe.phone&&d.jsx("p",{className:"text-xs text-muted-foreground",children:Qe.phone}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:[Qe.latitude,", ",Qe.longitude]})]}),d.jsxs("div",{className:"flex gap-1 shrink-0",children:[d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>{dt(Qe),De({name:Qe.name,address:Qe.address||"",city:Qe.city||"",phone:Qe.phone||"",latitude:String(Qe.latitude),longitude:String(Qe.longitude),logoUrl:Qe.logoUrl||"",isVisible:Qe.isVisible}),setTimeout(()=>{var Di;(Di=lt.current)==null||Di.scrollIntoView({behavior:"smooth",block:"start"})},50)},"data-testid":`button-edit-map-point-${Qe.id}`,children:d.jsx(nO,{className:"w-4 h-4"})}),d.jsx(tt,{size:"icon",variant:"ghost",onClick:()=>Sr.mutate(Qe.id),disabled:Sr.isPending,"data-testid":`button-delete-map-point-${Qe.id}`,children:d.jsx(Ld,{className:"w-4 h-4 text-destructive"})})]})]},Qe.id))})})]})]})}),d.jsx(La,{value:"audit",children:d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsx(kn,{children:"Admin Audit Logs"}),d.jsx(da,{children:"Track all admin role changes"})]}),d.jsx(Ji,{children:Ei?d.jsx("div",{className:"space-y-4",children:[1,2,3].map(Qe=>d.jsx("div",{className:"h-20 bg-muted rounded-lg animate-pulse"},Qe))}):Oi.length===0?d.jsxs("div",{className:"text-center py-12",children:[d.jsx(qh,{className:"w-12 h-12 mx-auto mb-4 text-muted-foreground"}),d.jsx("p",{className:"text-muted-foreground",children:"No audit logs yet"})]}):d.jsx("div",{className:"space-y-4",children:Oi.map(Qe=>{var Di,bn;return d.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-lg","data-testid":`audit-log-${Qe.id}`,children:[d.jsx("div",{className:`p-2 rounded-lg ${Qe.action==="promote"?"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300":"bg-orange-100 text-orange-700 dark:bg-orange-900 dark:text-orange-300"}`,children:Qe.action==="promote"?d.jsx(Ij,{className:"w-5 h-5"}):d.jsx(D8,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex-1",children:[d.jsxs("p",{className:"font-medium","data-testid":`text-audit-action-${Qe.id}`,children:[d.jsx("span",{className:Qe.actor?"":"text-primary font-semibold",children:((Di=Qe.actor)==null?void 0:Di.email)||"System"})," ",Qe.action==="promote"?"promoted":"demoted"," ",((bn=Qe.target)==null?void 0:bn.email)||"Unknown User"]}
3911),Qe.reason&&d.jsxs("p",{className:"text-sm text-muted-foreground mt-1","data-testid":`text-audit-reason-${Qe.id}`,children:["Reason: ",Qe.reason]}),d.jsx("p",{className:"text-xs text-muted-foreground mt-2","data-testid":`text-audit-timestamp-${Qe.id}`,children:Qe.createdAt&&rc(new Date(Qe.createdAt),"PPpp")})]})]},Qe.id)})})})]})})]}),d.jsx(q_,{open:S.isOpen,onOpenChange:Qe=>!Qe&&C({isOpen:!1,targetUser:null,newRole:!1}),children:d.jsxs(gg,{"data-testid":"dialog-role-change",children:[d.jsxs(yg,{children:[d.jsx(vg,{children:S.newRole?"Promote to Admin":"Demote from Admin"}),d.jsx(xg,{children:S.newRole?d.jsxs(d.Fragment,{children:["Are you sure you want to promote ",d.jsx("strong",{children:(ta=S.targetUser)==null?void 0:ta.email})," to administrator? They will have full access to manage users and credits."]}):d.jsxs(d.Fragment,{children:["Are you sure you want to demote ",d.jsx("strong",{children:(Fr=S.targetUser)==null?void 0:Fr.email})," from administrator? They will lose admin privileges."]})})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-role-change",children:"Cancel"}),d.jsx(H_,{onClick:ss,disabled:Qs.isPending,"data-testid":"button-confirm-role-change",children:Qs.isPending?t("admin.processing"):"Confirm"})]})]})}),d.jsx(q_,{open:B.isOpen,onOpenChange:Qe=>!Qe&&W({isOpen:!1,targetUser:null}),children:d.jsxs(gg,{"data-testid":"dialog-delete-user",children:[d.jsxs(yg,{children:[d.jsx(vg,{className:"text-destructive",children:t("admin.deleteUser","Elimina Utente")}),d.jsxs(xg,{children:[t("admin.deleteUserWarning","Sei sicuro di voler eliminare l'utente")," ",d.jsxs("strong",{children:[(co=B.targetUser)==null?void 0:co.firstName," ",(qo=B.targetUser)==null?void 0:qo.lastName]})," (",(ia=B.targetUser)==null?void 0:ia.email,")?",d.jsx("br",{}),d.jsx("br",{}),d.jsx("span",{className:"text-destructive font-medium",children:t("admin.deleteUserPermanent","Questa azione è irreversibile. Tutti i dati dell'utente (wallet, annunci, ordini, messaggi) verranno eliminati definitivamente.")})]})]}),d.jsxs(_g,{children:[d.jsx(G_,{"data-testid":"button-cancel-delete-user",children:t("common.cancel","Annulla")}),d.jsx(H_,{onClick:jn,disabled:wi.isPending,className:"bg-destructive text-destructive-foreground","data-testid":"button-confirm-delete-user",children:wi.isPending?t("admin.processing"):t("admin.confirmDelete","Elimina Definitivamente")})]})]})}),d.jsx(Cce,{open:D.open,onOpenChange:Qe=>V({open:Qe,userId:Qe?D.userId:null}),userId:D.userId,isAdmin:!0})]})]}):null}function x$e(){const{t}=pr(),{user:e,isLoading:i,isAuthenticated:n}=Ka(),{toast:o}=ks(),[,c]=$o(),[f,r]=K.useState(null),[x,S]=K.useState(!1),[C,I]=K.useState(null),[N,D]=K.useState(!1),V=(e==null?void 0:e.isProfessional)||(e==null?void 0:e.isAdmin),B=K.useCallback(async()=>({method:"PUT",url:(await(await fetch("/api/objects/upload",{method:"POST",credentials:"include"})).json()).uploadURL}),[]),W=K.useCallback(async Ne=>{S(!0);try{for(const pe of Ne.successful||[])if(pe.uploadURL){const Pe=pe.uploadURL.split("?")[0];(await xn("PATCH","/api/profile/store-cover",{storeCoverImageUrl:Pe})).ok&&(r(Pe),await Qi.refetchQueries({queryKey:["/api/auth/user"]}),o({title:t("profile.coverUpdated","Copertina aggiornata"),description:t("profile.coverUpdatedDesc","La copertina del tuo negozio è stata aggiornata")}))}}catch{o({title:t("common.error","Errore"),description:t("profile.coverUpdateError","Errore durante l'aggiornamento della copertina"),variant:"destructive"})}finally{S(!1)}},[o,t]),$=async()=>{try{(await xn("PATCH","/api/profile/store-cover",{storeCoverImageUrl:null})).ok&&(r(null),await Qi.refetchQueries({queryKey:["/api/auth/user"]}),o({title:t("profile.coverRemoved","Copertina rimossa")}))}catch{o({title:t("common.error","Errore"),variant:"destructive"})}},G=K.useCallback(async Ne=>{D(!0);try{for(const pe of Ne.successful||[])if(pe.uploadURL){const Pe=pe.uploadURL.split("?")[0];(await xn("PATCH","/api/profile/image",{profileImageUrl:Pe})).ok&&(I(Pe),await Qi.refetchQueries({queryKey:["/api/auth/user"]}),o({title:t("profile.imageUpdated","Immagine profilo aggiornata")}))}}catch{o({title:t("common.error","Errore"),description:t("profile.imageUpdateError","Errore durante l'aggiornamento dell'immagine"),variant:"destructive"})}finally{D(!1)}},[o,t]),te=async()=>{try{(await xn("PATCH","/api/profile/image",{profileImageUrl:null})).ok&&(I(null),await Qi.refetchQueries({queryKey:["/api/auth/user"]}),o({title:t("profile.imageRemoved","Immagine profilo rimossa")}))}catch{o({title:t("common.error","Errore"),variant:"destructive"})}},ce=zg({resolver:Lg(M6e),defaultValues:{firstName:"",lastName:"",phone:"",address:"",city:"",dateOfBirth:"",codiceFiscale:"",profession:"",bio:"",website:""}}
3911);K.useEffect(()=>{e&&(ce.reset({firstName:e.firstName||"",lastName:e.lastName||"",phone:e.phone||"",address:e.address||"",city:e.city||"",dateOfBirth:e.dateOfBirth?new Date(e.dateOfBirth).toISOString().split("T")[0]:"",codiceFiscale:e.codiceFiscale||"",profession:e.profession||"",bio:e.bio||"",website:e.website||""}),e.storeCoverImageUrl&&r(e.storeCoverImageUrl),e.profileImageUrl&&I(e.profileImageUrl))},[e,ce]);const _e=$n({mutationFn:async Ne=>await(await xn("PATCH","/api/profile",Ne)).json(),onSuccess:async()=>{await Qi.refetchQueries({queryKey:["/api/auth/user"]}),o({title:t("profile.successTitle"),description:t("profile.successDesc")}),c("/dashboard")},onError:Ne=>{o({title:t("profile.errorTitle"),description:Ne.message||t("profile.errorDesc"),variant:"destructive"})}}),Te=Ne=>{_e.mutate(Ne)};if(K.useEffect(()=>{!i&&!n&&(o({title:t("messages.unauthorized"),description:t("messages.unauthorizedLogin"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500))},[n,i,o,t]),i)return d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-12 h-12 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("common.loading")})]})});const we=e==null?void 0:e.profileCompleted;return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-4 flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-12 h-12"}),d.jsx("span",{className:"text-xl font-bold",children:"Wallet Manager"})]}),d.jsx(TE,{})]})}),d.jsxs("main",{className:"max-w-2xl mx-auto px-6 py-8",children:[d.jsxs("div",{className:"mb-8 text-center",children:[d.jsx("h1",{className:"text-3xl font-bold mb-2",children:t(we?"profile.editTitle":"profile.title")}),d.jsx("p",{className:"text-muted-foreground",children:t(we?"profile.editSubtitle":"profile.subtitle")})]}),d.jsxs(Ti,{className:"p-6",children:[d.jsxs("div",{className:"mb-6 pb-6 border-b",children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("profile.profileImage","Immagine Profilo")}),d.jsxs("div",{className:"flex items-center gap-4",children:[C?d.jsx("img",{src:C,alt:t("profile.profileImageAlt","Immagine profilo"),className:"w-20 h-20 rounded-full object-cover border","data-testid":"img-profile-preview"}):d.jsx(Nc,{className:"w-20 h-20",children:d.jsx(Mc,{className:"text-2xl",children:d.jsx(ju,{className:"w-8 h-8"})})}),d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs(MT,{maxNumberOfFiles:1,maxFileSize:10485760,allowedFileTypes:["image/*"],onGetUploadParameters:B,onComplete:G,children:[d.jsx(ju,{className:"w-4 h-4 mr-2"}),C?t("profile.changeImage","Cambia immagine"):t("profile.uploadImage","Carica immagine")]}),C&&d.jsxs(tt,{type:"button",variant:"outline",size:"sm",onClick:te,"data-testid":"button-remove-profile-image",children:[d.jsx(Ld,{className:"w-4 h-4 mr-2"}),t("common.remove","Rimuovi")]}),N&&d.jsx("p",{className:"text-sm text-muted-foreground",children:t("common.uploading","Caricamento in corso...")})]})]})]}),d.jsx($g,{...ce,children:d.jsxs("form",{onSubmit:ce.handleSubmit(Te),className:"space-y-6",children:[d.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[d.jsx(ns,{control:ce.control,name:"firstName",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.firstName")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.firstNamePlaceholder"),...Ne,"data-testid":"input-firstname"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"lastName",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.lastName")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.lastNamePlaceholder"),...Ne,"data-testid":"input-lastname"})}),d.jsx(Is,{})]})})]}),d.jsx(ns,{control:ce.control,name:"phone",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.phone")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.phonePlaceholder"),...Ne,"data-testid":"input-phone"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"address",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.address")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.addressPlaceholder"),...Ne,"data-testid":"input-address"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"city",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.city")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.cityPlaceholder"),...Ne,"data-testid":"input-city"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"dateOfBirth",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.dateOfBirth")}),d.jsx(Qr,{children:d.jsx(an,{type:"date",...Ne,"data-testid":"input-dateofbirth"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"codiceFiscale",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.codiceFiscale","Codice Fiscale")}
3911),d.jsx(Qr,{children:d.jsx(an,{placeholder:"Es. RSSMRA80A01H501Z",...Ne,onChange:pe=>Ne.onChange(pe.target.value.toUpperCase()),maxLength:16,className:"uppercase","data-testid":"input-codice-fiscale"})}),d.jsx("p",{className:"text-xs text-muted-foreground",children:t("profile.codiceFiscaleHint","Obbligatorio per l'iscrizione al libro soci e per l'emissione della tessera associativa.")}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"profession",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.profession")}),d.jsx(Qr,{children:d.jsx(an,{placeholder:t("profile.professionPlaceholder"),...Ne,"data-testid":"input-profession"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"bio",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.bio")}),d.jsx(Qr,{children:d.jsx(Uc,{placeholder:t("profile.bioPlaceholder"),...Ne,rows:4,className:"resize-none","data-testid":"input-bio"})}),d.jsx(Is,{})]})}),d.jsx(ns,{control:ce.control,name:"website",render:({field:Ne})=>d.jsxs(Yr,{children:[d.jsx(ds,{children:t("profile.website")}),d.jsx(Qr,{children:d.jsx(an,{type:"url",placeholder:t("profile.websitePlaceholder"),...Ne,"data-testid":"input-website"})}),d.jsx(Is,{})]})}),V&&d.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ru,{className:"w-5 h-5 text-primary fill-current"}),d.jsx("h3",{className:"font-semibold",children:t("profile.storeSettings","Impostazioni Negozio")}),d.jsx(En,{variant:"default",className:"bg-primary",children:"Professional"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"text-sm font-medium mb-2 block",children:t("profile.storeCover","Copertina Negozio")}),d.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t("profile.storeCoverDesc","Carica un'immagine di copertina per la pagina del tuo negozio (consigliato: 1200x400px)")}),f?d.jsxs("div",{className:"space-y-3",children:[d.jsx("div",{className:"relative aspect-[3/1] rounded-lg overflow-hidden border",children:d.jsx("img",{src:f,alt:t("profile.storeCoverAlt","Copertina negozio"),className:"w-full h-full object-cover","data-testid":"img-store-cover-preview"})}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs(MT,{maxNumberOfFiles:1,maxFileSize:10485760,allowedFileTypes:["image/*"],onGetUploadParameters:B,onComplete:W,buttonClassName:"flex-1",children:[d.jsx(Fk,{className:"w-4 h-4 mr-2"}),t("profile.changeCover","Cambia copertina")]}),d.jsxs(tt,{type:"button",variant:"outline",onClick:$,"data-testid":"button-remove-cover",children:[d.jsx(Ld,{className:"w-4 h-4 mr-2"}),t("common.remove","Rimuovi")]})]})]}):d.jsxs(MT,{maxNumberOfFiles:1,maxFileSize:10485760,allowedFileTypes:["image/*"],onGetUploadParameters:B,onComplete:W,buttonClassName:"w-full",children:[d.jsx(Fk,{className:"w-4 h-4 mr-2"}),t("profile.uploadCover","Carica copertina negozio")]}),x&&d.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:t("common.uploading","Caricamento in corso...")})]})]}),d.jsx(tt,{type:"submit",className:"w-full",disabled:_e.isPending,"data-testid":"button-save-profile",children:_e.isPending?t("profile.updating"):t(we?"profile.updateProfile":"profile.saveProfile")})]})})]})]})]})}function b$e(){const{t}=pr(),{user:e,isLoading:i,isAuthenticated:n}=Ka();dv();const{toast:o}=ks();$o();const[c,f]=K.useState(!1),{data:r,isLoading:x}=Xn({queryKey:["/api/referrals/my-stats"],enabled:!!e}),{data:S=[],isLoading:C}=Xn({queryKey:["/api/referrals/my-referrals"],enabled:!!e});K.useEffect(()=>{!i&&!n&&(o({title:t("messages.unauthorized"),description:t("messages.unauthorizedDesc"),variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500))},[n,i,o,t]);const I=r!=null&&r.referralCode?`${window.location.origin}?ref=${r.referralCode}`:"",N=async()=>{if(I)try{await navigator.clipboard.writeText(I),f(!0),o({title:t("referral.copied"),description:t("referral.copiedDesc")}),setTimeout(()=>f(!1),2e3)}catch{o({title:t("messages.error"),description:t("referral.copyError"),variant:"destructive"})}},D=()=>{const W=encodeURIComponent(t("referral.emailSubject")),$=encodeURIComponent(t("referral.emailBody",{link:I}));window.open(`mailto:?subject=${W}&body=${$}`,"_blank")},V=()=>{const W=encodeURIComponent(t("referral.whatsappMessage",{link:I}));window.open(`https://wa.me/?text=${W}`,"_blank")},B=()=>{const W=encodeURIComponent(t("referral.telegramMessage",{link:I}));window.open(`https://t.me/share/url?url=${encodeURIComponent(I)}&text=${W}`,"_blank")};return i?d.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"w-12 h-12 border-4 border-primary border-t-transparent roun
3911ded-full animate-spin mx-auto mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("common.loading")})]})}):d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b",children:d.jsxs("div",{className:"max-w-6xl mx-auto px-6 py-4 flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-12 h-12"}),d.jsx("span",{className:"text-xl font-bold",children:t("referral.title")})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx(TE,{}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-back-to-dashboard",children:d.jsxs(yr,{href:"/dashboard",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),t("common.backToDashboard")]})})]})]})}),d.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",children:[d.jsxs("div",{className:"mb-8",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx(t1,{className:"w-8 h-8 text-primary"}),d.jsx("h1",{className:"text-3xl font-bold",children:t("referral.heroTitle")})]}),d.jsx("p",{className:"text-lg text-muted-foreground",children:t("referral.heroDescription")})]}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[d.jsxs(Ti,{"data-testid":"card-referral-count",children:[d.jsx(In,{className:"pb-3",children:d.jsxs(kn,{className:"text-sm font-medium flex items-center gap-2",children:[d.jsx(Bc,{className:"w-4 h-4"}),t("referral.friendsInvited")]})}),d.jsx(Ji,{children:d.jsx("div",{className:"text-3xl font-bold","data-testid":"text-referral-count",children:x?"...":(r==null?void 0:r.referralCount)||0})})]}),d.jsxs(Ti,{"data-testid":"card-credits-earned",children:[d.jsx(In,{className:"pb-3",children:d.jsxs(kn,{className:"text-sm font-medium flex items-center gap-2",children:[d.jsx(e1,{className:"w-4 h-4"}),t("referral.creditsEarned")]})}),d.jsx(Ji,{children:d.jsx("div",{className:"text-3xl font-bold text-primary","data-testid":"text-credits-earned",children:x?"...":`${(r==null?void 0:r.totalEarned)||"0"} CEI`})})]}),d.jsxs(Ti,{"data-testid":"card-your-code",children:[d.jsx(In,{className:"pb-3",children:d.jsxs(kn,{className:"text-sm font-medium flex items-center gap-2",children:[d.jsx(dxe,{className:"w-4 h-4"}),t("referral.yourCode")]})}),d.jsx(Ji,{children:d.jsx("div",{className:"text-2xl font-mono font-bold","data-testid":"text-referral-code",children:x?"...":(r==null?void 0:r.referralCode)||"---"})})]})]}),d.jsxs(Ti,{className:"mb-8",children:[d.jsxs(In,{children:[d.jsx(kn,{children:t("referral.shareLink")}),d.jsx(da,{children:t("referral.shareLinkDesc")})]}),d.jsxs(Ji,{className:"space-y-4",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(an,{value:
3911I,readOnly:!0,className:"font-mono text-sm","data-testid":"input-referral-link"}),d.jsx(tt,{onClick:N,variant:"default",className:"shrink-0","data-testid":"button-copy-link",children:c?d.jsxs(d.Fragment,{children:[d.jsx(Cd,{className:"w-4 h-4 mr-2"}),t("referral.copied")]}):d.jsxs(d.Fragment,{children:[d.jsx(QT,{className:"w-4 h-4 mr-2"}),t("referral.copy")]})})]}),d.jsxs("div",{className:"flex flex-wrap gap-3",children:[d.jsxs(tt,{onClick:V,variant:"outline",className:"flex-1 min-w-40","data-testid":"button-share-whatsapp",children:[d.jsx(Cb,{className:"w-4 h-4 mr-2"}),"WhatsApp"]}),d.jsxs(tt,{onClick:B,variant:"outline",className:"flex-1 min-w-40","data-testid":"button-share-telegram",children:[d.jsx(Cb,{className:"w-4 h-4 mr-2"}),"Telegram"]}),d.jsxs(tt,{onClick:D,variant:"outline",className:"flex-1 min-w-40","data-testid":"button-share-email",children:[d.jsx(Z3,{className:"w-4 h-4 mr-2"}),"Email"]})]})]})]}),d.jsxs(Ti,{children:[d.jsxs(In,{children:[d.jsx(kn,{children:t("referral.yourReferrals")}),d.jsx(da,{children:t("referral.yourReferralsDesc")})]}),d.jsx(Ji,{children:C?d.jsxs("div",{className:"text-center py-8",children:[d.jsx("div",{className:"w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto mb-2"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t("common.loading")})]}):S.length===0?d.jsxs("div",{className:"text-center py-8",children:[d.jsx(Bc,{className:"w-12 h-12 text-muted-foreground mx-auto mb-2"}),d.jsx("p",{className:"text-muted-foreground",children:t("referral.noReferrals")})]}):d.jsx("div",{className:"space-y-3",children:S.map(W=>{var $,G;return d.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg border hover-elevate","data-testid":`referral-item-${W.id}`,children:[d.jsxs(Nc,{className:"w-10 h-10",children:[d.jsx(Rd,{src:W.profileImageUrl||void 0}),d.jsxs(Mc,{children:[($=W.firstName)==null?void 0:$[0],(G=W.lastName)==null?void 0:G[0]]})]}),d.jsxs("div",{className:"flex-1",children:[d.jsx("p",{className:"font-medium",children:W.firstName&&W.lastName?`${W.firstName} ${W.lastName}`:t("user.defaultName")}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t("referral.joinedOn",{date:new Date(W.createdAt).toLocaleDateString()})})]}),d.jsx(En,{variant:"secondary",children:t("referral.active")})]},W.id)})})})]})]})]})}function w$e(){const{t}=pr(),[,e]=$o(),{isAuthenticated:i}=Ka(),[n,o]=K.useState(""),[c,f]=K.useState("all"),{data:r,isLoading:x}=Xn({queryKey:["/api/listings"]}),S=(r==null?void 0:r.filter(N=>N.serviceType==="volunteer_request"&&N.isActive))||[],C=S.filter(N=>{const D=!n||N.title.toLowerCase().includes(n.toLowerCase())||tP(N.description).toLowerCase().includes(n.toLowerCase()),V=c==="all"||N.city===c;return D&&V}),I=Array.from(new Set(S.map(N=>N.city).filter(Boolean)));return x?d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsx(Rc,{className:"h-12 w-64 mb-8"}),d.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3,4,5,6].map(N=>d.jsx(Rc,{className:"h-64"},N))})]})}):d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b sticky top-0 z-10 bg-background",children:d.jsx("div",{className:"container mx-auto px-4 py-4",children:d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsx(tt,{variant:"ghost",asChild:!0,"data-testid":"button-back",children:d.jsxs(yr,{href:"/",children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("common.backToMarketplace","Torna al Marketplace")]})}),i&&d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-my-applications",children:d.jsx(yr,{href:"/volunteer/my-applications",children:t("volunteer.myApplications","Le Mie Candidature")})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-dashboard",children:d.jsx(yr,{href:"/dashboard",children:t("common.dashboard")})})]})]})})}),d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsxs("div",{className:"flex flex-col gap-6 mb-8",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold","data-testid":"heading-volunteer-opportunities",children:t("volunteer.opportunities.title","Opportunità di Volontariato")}),d.jsx("p",{className:"text-muted-foreground mt-2",children:t("volunteer.opportunities.subtitle","Contribuisci alla comunità e guadagna crediti CEI")})]}),d.jsxs("div",{className:"flex gap-4 flex-wrap",children:[d.jsx(an,{placeholder:t("volunteer.search","Cerca opportunità ..."),value:n,onChange:N=>o(N.target.value),className:"max-w-sm","data-testid":"input-search-volunteer"}),d.jsxs(Jy,{value:c,onValueChange:f,children:[d.jsx(Vm,{className:"w-[200px]","data-testid":"select-city-filter",children:d.jsx(e_,{placeholder:t("volunteer.allCities","Tutte le città ")})}),d.jsxs($m,{children:[d.jsx(ja,{value:"all",children:t("volunteer.allCities","Tutte le città ")}),I.map(N=>d.jsx(ja,{value:N,children:N},N))]})]}),d.jsx("div",{className:"ml-auto",children:d.jsxs(En,{variant:"secondary",className:"text-base px-4 py-2",children:[d.jsx(ig,{className:"w-4 h-4 mr-2"}),C.length," ",t("volunteer.opportunities.available","opportunità ")]})})]})]}),C.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(ig,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("h3",{className:"text-lg font-semibold mb-2",children:t("volunteer.opportunities.noResults","Nessuna opportunità trovata")}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.opportunities.tryDifferentFilters","Prova a modificare i filtri di ricerca")})]})}):d.jsx("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:C.map(N=>d.jsxs(Ti,{className:"hover-elevate active-elevate-2 cursor-pointer transition-all",onClick:()=>e(`/listings/${N.id}`),"data-testid":`card-volunteer-${N.id}`,children:[d.jsxs(In,{children:[d.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[d.jsx(kn,{className:"line-clamp-2",children:N.title}),N.isRecurring&&d.jsxs(En,{variant:"secondary",className:"shrink-0",children:[d.jsx(Yb,{className:"w-3 h-3 mr-1"}),t("volunteer.recurring","Ricorrente")]})]}),d.jsx(da,{className:"line-clamp-3",children:tP(N.description)})]}),d.jsx(Ji,{children:d.jsxs("div",{className:"flex flex-col gap-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:N.city})]}),N.maxVolunteers&&N.maxVolunteers>1&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Bc,{className:"w-4 h-4"}),d.jsx("span",{children:t("volunteer.maxVolunteers","Fino a {{count}} volontari",{count:N.maxVolunteers})})]}),d.jsx("div",{className:"pt-2 border-t",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("span",{className:"text-sm font-medium text-primary",children:["ð° ",t("volunteer.reward","Compenso piattaforma")]}),d.jsx(En,{variant:"default",className:"font-bold",children:"50 CEI"})]})}),d.jsx(tt,{className:"w-full mt-2",onClick:D=>{D.stopPropagation(),e(`/listings/${N.id}`)},"data-testid":`button-view-opportunity-${N.id}`,children:t("volunteer.viewDetails","Vedi Dettagli")})]})})]},N.id))})]})]})}const S$e={lessThanXSeconds:{one:"meno di un secondo",other:"meno di {{count}} secondi"},xSeconds:{one:"un secondo",other:"{{count}} secondi"},halfAMinute:"alcuni secondi",lessThanXMinutes:{one:"meno di un minuto",other:"meno di {{count}} minuti"},xMinutes:{one:"un minuto",other:"{{count}} minuti"},aboutXHours:{one:"circa un'ora",other:"circa {{count}} ore"},xHours:{one:"un'ora",other:"{{count}} ore"},xDays:{one:"un giorno",other:"{{count}} giorni"},aboutXWeeks:{one:"circa una settimana",other:"circa {{count}} settimane"},xWeeks:{one:"una settimana",other:"{{count}} settimane"},aboutXMonths:{one:"circa un mese",other:"circa {{count}} mesi"},xMonths:{one:"un mese",other:"{{count}} mesi"},aboutXYears:{one:"circa un anno",other:"circa {{count}} anni"},xYears:{one:"un anno",other:"{{count}} anni"},overXYears:{one:"più di un anno",other:"più di {{count}} anni"},almostXYears:{one:"quasi un anno",other:"quasi {{count}} anni"}},T$e=(t,e,i)=>{let n;const o=S$e[t];
3911return typeof o=="string"?n=o:e===1?n=o.one:n=o.other.replace("{{count}}",e.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"tra "+n:n+" fa":n},C$e={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},E$e={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},A$e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},I$e={date:R0({formats:C$e,defaultWidth:"full"}),time:R0({formats:E$e,defaultWidth:"full"}),dateTime:R0({formats:A$e,defaultWidth:"full"})},e5=["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"];function k$e(t){switch(t){case 0:return"'domenica scorsa alle' p";default:return"'"+e5[t]+" scorso alle' p"}}function Y7(t){return"'"+e5[t]+" alle' p"}function P$e(t){switch(t){case 0:return"'domenica prossima alle' p";default:return"'"+e5[t]+" prossimo alle' p"}}const N$e={lastWeek:(t,e,i)=>{const n=t.getDay();return V7(t,e,i)?Y7(n):k$e(n)},yesterday:"'ieri alle' p",today:"'oggi alle' p",tomorrow:"'domani alle' p",nextWeek:(t,e,
3911i)=>{const n=t.getDay();return V7(t,e,i)?Y7(n):P$e(n)},other:"P"},M$e=(t,e,i,n)=>{const o=N$e[t];return typeof o=="function"?o(e,i,n):o},D$e={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["avanti Cristo","dopo Cristo"]},R$e={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},j$e={narrow:["G","F","M","A","M","G","L","A","S","O","N","D"],abbreviated:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],wide:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},z$e={narrow:["D","L","M","M","G","V","S"],short:["dom","lun","mar","mer","gio","ven","sab"],abbreviated:["dom","lun","mar","mer","gio","ven","sab"],wide:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},L$e={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"}},O$e={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"}},F$e=(t,e)=>{const i=Number(t);return String(i)},B$e={ordinalNumber:F$e,era:Dh({values:D$e,defaultWidth:"wide"}),quarter:Dh({values:R$e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Dh({values:j$e,defaultWidth:"wide"}),day:Dh({values:z$e,defaultWidth:"wide"}),dayPeriod:Dh({values:L$e,defaultWidth:"wide",formattingValues:O$e,defaultFormattingWidth:"wide"})},U$e=/^(\d+)(º)?/i,V$e=/\d+/i,$$e={narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},q$e={any:[/^a/i,/^(d|e)/i]},H$e={narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},G$e={any:[/1/i,/2/i,/3/i,/4/i]},W$e={narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},K$e={narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Z$e={narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},X$e={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},Y$e={narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},Q$e={any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},J$e={ordinalNumber:bce({matchPattern:U$e,parsePattern:V$e,valueCallback:t=>parseInt(t,10)}),era:Rh({matchPatterns:$$e,defaultMatchWidth:"wide",parsePatterns:q$e,defaultParseWidth:"any"}),quarter:Rh({matchPatterns:H$e,defaultMatchWidth:"wide",parsePatterns:G$e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Rh({matchPatterns:W$e,defaultMatchWidth:"wide",parsePatterns:K$e,defaultParseWidth:"any"}),day:Rh({matchPatterns:Z$e,defaultMatchWidth:"wide",parsePatterns:X$e,defaultParseWidth:"any"}),dayPeriod:Rh({matchPatterns:Y$e,defaultMatchWidth:"any",parsePatterns:Q$e,defaultParseWidth:"any"})},y0={code:"it",formatDistance:T$e,formatLong:I$e,formatRelative:M$e,localize:B$e,match:J$e,options:{weekStartsOn:1,firstWeekContainsDate:4}},e8e={applied:{label:"In Attesa",variant:"secondary",icon:qh},accepted:{label:"Accettato",variant:"default",icon:Wo},service_done_pending:{label:"Da Confermare",variant:"secondary",icon:Jb},confirmed:{label:"Confermato",variant:"default",icon:Wo},declined:{label:"Rifiutato",variant:"destructive",icon:B_},withdrawn:{label:"Ritirato",variant:"outline",icon:B_}};function t8e(){const{t}=pr(),[,e]=$o(),{toast:i}=ks(),{user:n,isLoading:o}=Ka(),{data:c,isLoading:f}=Xn({queryKey:["/api/volunteer/my-applications"],enabled:!!n});K.useEffect(()=>{!o&&!n&&e("/")},[o,n,e]);const r=$n({mutationFn:N=>xn("POST",`/api/volunteer/complete/${N}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/volunteer/my-applications"]}
3911),i({title:t("volunteer.markedAsDone","Servizio completato"),description:t("volunteer.waitingConfirmation","In attesa di conferma dal richiedente")})},onError:()=>{i({variant:"destructive",title:t("common.error","Errore"),description:t("volunteer.markDoneError","Impossibile segnare come completato")})}}),x=(c==null?void 0:c.filter(N=>["applied","accepted","service_done_pending"].includes(N.status)))||[],S=(c==null?void 0:c.filter(N=>N.status==="confirmed"))||[],C=(c==null?void 0:c.filter(N=>["declined","withdrawn"].includes(N.status)))||[];if(f||o)return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsx(Rc,{className:"h-12 w-64 mb-8"}),d.jsx(Rc,{className:"h-96"})]})});const I=N=>{var B,W,$,G,te;const D=e8e[N.status],V=D.icon;return d.jsxs(Ti,{"data-testid":`card-application-${N.id}`,children:[d.jsx(In,{children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx(kn,{className:"mb-2",children:N.listing.title}),d.jsx(da,{className:"line-clamp-2",children:tP(N.listing.description)})]}),d.jsxs(En,{variant:D.variant,children:[d.jsx(V,{className:"w-3 h-3 mr-1"}),D.label]})]})}),d.jsx(Ji,{children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:N.listing.city})]}),d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Yb,{className:"w-4 h-4"}),d.jsxs("span",{children:["Candidatura: ",rc(new Date(N.createdAt),"d MMM yyyy",{locale:y0})]})]}),N.requester.firstName&&d.jsxs("div",{className:"text-sm",children:[d.jsx("span",{className:"text-muted-foreground",children:"Richiedente: "}),d.jsxs("span",{className:"font-medium",children:[N.requester.firstName," ",N.requester.lastName]})]}),N.volunteerNotes&&d.jsxs("div",{className:"text-sm border-l-2 border-primary pl-3",children:[d.jsx("span",{className:"text-muted-foreground",children:"Le tue note: "}),d.jsx("p",{className:"mt-1",children:N.volunteerNotes})]}),N.requesterNotes&&d.jsxs("div",{className:"text-sm border-l-2 border-secondary pl-3",children:[d.jsx("span",{className:"text-muted-foreground",children:"Note richiedente: "}),d.jsx("p",{className:"mt-1",children:N.requesterNotes})]}),N.status==="accepted"&&d.jsx("div",{className:"bg-green-500/10 rounded-lg p-4 border border-green-500/20",children:d.jsx("p",{className:"text-sm font-medium text-green-700 dark:text-green-400",children:t("volunteer.acceptedInfo",'La tua candidatura è stata accettata! Contatta il richiedente per organizzare il servizio. Quando hai completato, clicca "Segna Completato".')})}),N.status==="service_done_pending"&&d.jsx("div",{className:"bg-yellow-500/10 rounded-lg p-4 border border-yellow-500/20",children:d.jsx("p",{className:"text-sm font-medium text-yellow-700 dark:text-yellow-400",children:t("volunteer.pendingConfirmation","Hai segnato il servizio come completato. In attesa che il richiedente confermi per ricevere il pagamento.")})}),N.status==="confirmed"&&d.jsx("div",{className:"bg-primary/10 rounded-lg p-4 border border-primary/20",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium",children:((B=N.platformPayout)==null?void 0:B.status)==="completed"||((W=N.platformPayout)==null?void 0:W.status)==="paid"?"ð° Compenso Ricevuto":(($=N.platformPayout)==null?void 0:$.status)==="failed"?"â ï¸ Pagamento non riuscito":"â³ Pagamento in elaborazione"}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:((G=N.platformPayout)==null?void 0:G.paidAt)&&rc(new Date(N.platformPayout.paidAt),"d MMM yyyy",{locale:y0})})]}),((te=N.platformPayout)==null?void 0:te.amount)&&d.jsxs(En,{variant:"default",className:"text-lg font-bold",children:[N.platformPayout.amount," CEI"]})]})}),d.jsxs("div",{className:"flex gap-2 pt-2 flex-wrap",children:[d.jsx(tt,{variant:"outline",className:"flex-1",onClick:()=>e(`/listings/${N.listing.id}`),"data-testid":`button-view-listing-${N.id}`,children:t("volunteer.viewListing","Vedi Inserzione")}),N.status==="accepted"&&d.jsxs(d.Fragment,{children:[d.jsxs(tt,{variant:"outline",className:"flex-1",onClick:()=>e(`/messages?userId=${N.requesterId}`),"data-testid":`button-contact-${N.id}`,children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("volunteer.contactRequester","Contatta")]}),d.jsx(tt,{className:"flex-1",onClick:()=>r.mutate(N.id),disabled:r.isPending,"data-testid":`button-mark-done-${N.id}`,children:r.isPending?t("common.processing","Elaborazione..."):t("volunteer.markAsDone","Segna Completato")})]}),N.status==="service_done_pending"&&d.jsxs(tt,{variant:"outline",className:"flex-1",onClick:()=>e(`/messages?userId=${N.requesterId}`),"data-testid":`button-contact-pending-${N.id}`,children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("volunteer.remindRequester","Sollecita Conferma")]})]})]})})]},N.id)};return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b sticky top-0 z-10 bg-background",children:d.jsx("div",{className:"container mx-auto px-4 py-4",children:d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsx(tt,{variant:"ghost",asChild:!0,"data-testid":"button-back",children:d.jsxs(yr,{href:"/volunteer",children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("volunteer.backToOpportunities","Torna alle Opportunità ")]})}),d.jsx(tt,{variant:"outline",asChild:!0,"data-testid":"button-dashboard",children:d.jsx(yr,{href:"/dashboard",children:t("common.dashboard")})})]})})}),d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsxs("div",{className:"mb-8",children:[d.jsx("h1",{className:"text-3xl font-bold","data-testid":"heading-my-applications",children:t("volunteer.myApplications","Le Mie Candidature")}),d.jsx("p",{className:"text-muted-foreground mt-2",children:t("volunteer.applications.subtitle","Gestisci le tue candidature di volontariato")})]}),d.jsxs(qM,{defaultValue:"active",className:"w-full",children:[d.jsxs(RE,{className:"mb-6",children:[d.jsxs(za,{value:"active","data-testid":"tab-active",children:[t("volunteer.active","Attive")," (",x.length,")"]}),d.jsxs(za,{value:"completed","data-testid":"tab-completed",children:[t("volunteer.completed","Completate")," (",S.length,")"]}),d.jsxs(za,{value:"other","data-testid":"tab-other",children:[t("volunteer.other","Altre")," (",C.length,")"]})]}),d.jsx(La,{value:"active",className:"space-y-4",children:x.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(qh,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noActiveApplications","Nessuna candidatura attiva")})]})}):x.map(I)}),d.jsx(La,{value:"completed",className:"space-y-4",children:S.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(Wo,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noCompletedServices","Nessun servizio completato")})]})}):S.map(I)}),d.jsx(La,{value:"other",className:"space-y-4",children:C.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(B_,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noOtherApplications","Nessun altra candidatura")})]})}):C.map(I)})]})]})]})}const i8e={applied:{label:"In Attesa",variant:"secondary",icon:qh},accepted:{label:"Accettato",variant:"default",icon:Wo},service_done_pending:{label:"Da Confermare",variant:"secondary",icon:Jb},confirmed:{label:"Confermato",variant:"default",icon:Wo},declined:{label:"Rifiutato",variant:"destructive",icon:B_}};function n8e(){var W;const{t}=pr(),[,e]=$o(),{toast:i}=ks(),[n,o]=K.useState(null),[c,f]=K.useState(!1),{data:r,isLoading:x}=Xn({queryKey:["/api/volunteer/my-requests"]}),{data:S}=Xn({queryKey:["/api/volunteer/reward"]}),C=$n({mutationFn:$=>xn("POST",`/api/volunteer/accept/${$}`),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/volunteer/my-requests"]}),i({title:t("volunteer.applicationAccepted","Candidatura accettata"),description:t("volunteer.volunteerNotified","Il volontario è stato notificato")})},onError:()=>{i({variant:"destructive",title:t("common.error","Errore"),description:t("volunteer.acceptError","Impossibile accettare la candidatura")})}}),I=$n({mutationFn:$=>xn("POST",`/api/volunteer/confirm/${$}`,{}),onSuccess:()=>{Qi.invalidateQueries({queryKey:["/api/volunteer/my-requests"]}),f(!1),o(null),i({title:t("volunteer.serviceConfirmed","Servizio confermato"),description:t("volunteer.paymentProcessed","Il pagamento è stato elaborato")})},onError:()=>{i({variant:"destructive",title:t("common.error","Errore"),description:t("volunteer.confirmError","Impossibile confermare il servizio")})}}),N=(r==null?void 0:r.filter($=>$.status==="applied"))||[],D=(r==null?void 0:r.filter($=>["accepted","service_done_pending"].includes($.status)))||[],V=(r==null?void 0:r.filter($=>$.status==="confirmed"))||[];
3911if(x)return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsx(Rc,{className:"h-12 w-64 mb-8"}),d.jsx(Rc,{className:"h-96"})]})});const B=$=>{var ce,_e,Te,we,Ne,pe,Pe;const G=i8e[$.status],te=G.icon;return d.jsxs(Ti,{"data-testid":`card-request-${$.id}`,children:[d.jsx(In,{children:d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx(kn,{className:"mb-2",children:$.listing.title}),d.jsx(da,{children:$.listing.city})]}),d.jsxs(En,{variant:G.variant,children:[d.jsx(te,{className:"w-3 h-3 mr-1"}),G.label]})]})}),d.jsx(Ji,{children:d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"bg-secondary/30 rounded-lg p-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"w-10 h-10 bg-primary/10 rounded-full flex items-center justify-center",children:d.jsx(Bc,{className:"w-5 h-5 text-primary"})}),d.jsxs("div",{children:[d.jsxs("p",{className:"font-medium",children:[$.volunteer.firstName," ",$.volunteer.lastName]}),d.jsx("p",{className:"text-sm text-muted-foreground",children:"Volontario"})]})]}),$.volunteerNotes&&d.jsxs("div",{className:"text-sm border-l-2 border-primary pl-3 mt-3",children:[d.jsx("span",{className:"text-muted-foreground",children:"Note volontario: "}),d.jsx("p",{className:"mt-1",children:$.volunteerNotes})]})]}),d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Yb,{className:"w-4 h-4"}),d.jsxs("span",{children:["Candidatura: ",rc(new Date($.createdAt),"d MMM yyyy",{locale:y0})]})]}),$.acceptedAt&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Wo,{className:"w-4 h-4"}),d.jsxs("span",{children:["Accettato: ",rc(new Date($.acceptedAt),"d MMM yyyy",{locale:y0})]})]}),$.completedAt&&d.jsxs("div",{className:"flex items-center gap-2 text-sm text-success",children:[d.jsx(Jb,{className:"w-4 h-4"}),d.jsxs("span",{children:["Completato: ",rc(new Date($.completedAt),"d MMM yyyy",{locale:y0})]})]}),$.status==="accepted"&&d.jsx("div",{className:"bg-green-500/10 rounded-lg p-4 border border-green-500/20",children:d.jsx("p",{className:"text-sm font-medium text-green-700 dark:text-green-400",children:t("volunteer.acceptedRequesterInfo","Hai accettato questo volontario! Contattalo per organizzare il servizio. Quando il servizio sarà completato, il volontario te lo segnalerà .")})}),$.status==="service_done_pending"&&d.jsx("div",{className:"bg-yellow-500/10 rounded-lg p-4 border border-yellow-500/20",children:d.jsx("p",{className:"text-sm font-medium text-yellow-700 dark:text-yellow-400",children:t("volunteer.confirmRequesterInfo","Il volontario ha segnato il servizio come completato. Conferma per attivare il pagamento dei crediti CEI.")})}),$.status==="confirmed"&&d.jsx("div",{className:"bg-primary/10 rounded-lg p-4 border border-primary/20",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium",children:((ce=$.platformPayout)==null?void 0:ce.status)==="completed"||((_e=$.platformPayout)==null?void 0:_e.status)==="paid"?"ð° Compenso Pagato":((Te=$.platformPayout)==null?void 0:Te.status)==="failed"?"â ï¸ Pagamento non riuscito":"â³ Pagamento in elaborazione"}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:((we=$.platformPayout)==null?void 0:we.paidAt)&&rc(new Date($.platformPayout.paidAt),"d MMM yyyy",{locale:y0})})]}),((Ne=$.platformPayout)==null?void 0:Ne.amount)&&d.jsxs(En,{variant:"default",className:"text-lg font-bold",children:[$.platformPayout.amount," CEI"]})]})}),d.jsxs("div",{className:"flex gap-2 pt-2 flex-wrap",children:[d.jsx(tt,{variant:"outline",className:"flex-1",onClick:()=>e(`/listings/${$.listing.id}`),"data-testid":`button-view-listing-${$.id}`,children:t("volunteer.viewListing","Vedi Inserzione")}),$.status==="applied"&&d.jsx(tt,{className:"flex-1",onClick:()=>C.mutate($.id),disabled:C.isPending,"data-testid":`button-accept-${$.id}`,children:C.isPending?t("common.processing","Elaborazione..."):t("volunteer.accept","Accetta")}),$.status==="accepted"&&d.jsxs(tt,{variant:"outline",className:"flex-1",onClick:()=>e(`/messages?userId=${$.volunteer.id}`),"data-testid":`button-contact-volunteer-${$.id}`,children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("volunteer.contactVolunteer","Contatta Volontario")]}),$.status==="service_done_pending"&&d.jsx(tt,{className:"flex-1",onClick:()=>{o($),f(!0)},"data-testid":`button-confirm-${$.id}`,children:t("volunteer.confirmService","Conferma Servizio")}),$.status==="confirmed"&&((pe=$.platformPayout)==null?void 0:pe.status)!=="completed"&&((Pe=$.platformPayout)==null?void 0:Pe.status)!=="paid"&&d.jsx(tt,{className:"flex-1",onClick:()=>{o($),f(!0)},"data-testid":`button-retry-payment-${$.id}`,children:t("volunteer.retryPayment","Riprova pagamento")})]})]})})]},$.id)};return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("header",{className:"border-b sticky top-0 z-10 bg-background",children:d.jsx("div",{className:"container mx-auto px-4 py-4",children:d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsx(tt,{variant:"ghost",asChild:!0,"data-testid":"button-back",children:d.jsxs(yr,{href:"/dashboard",children:[d.jsx(Ao,{className:"mr-2 h-4 w-4"}),t("common.backToDashboard","Torna alla Dashboard")]})}),d.jsx(tt,{onClick:()=>e("/listings/new"),"data-testid":"button-create-request",children:t("volunteer.createRequest","Nuova Richiesta")})]})})}),d.jsxs("div",{className:"container mx-auto px-4 py-8",children:[d.jsxs("div",{className:"mb-8",children:[d.jsx("h1",{className:"text-3xl font-bold","data-testid":"heading-my-requests",children:t("volunteer.myRequests","Le Mie Richieste")}),d.jsx("p",{className:"text-muted-foreground mt-2",children:t("volunteer.requests.subtitle","Gestisci le candidature ricevute")})]}),d.jsxs(qM,{defaultValue:"pending",className:"w-full",children:[d.jsxs(RE,{className:"mb-6",children:[d.jsxs(za,{value:"pending","data-testid":"tab-pending",children:[t("volunteer.pending","In Attesa")," (",N.length,")"]}),d.jsxs(za,{value:"active","data-testid":"tab-active",children:[t("volunteer.active","Attive")," (",D.length,")"]}),d.jsxs(za,{value:"completed","data-testid":"tab-completed",children:[t("volunteer.completed","Completate")," (",V.length,")"]})]}),d.jsx(La,{value:"pending",className:"space-y-4",children:N.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(qh,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noPendingRequests","Nessuna candidatura in attesa")})]})}):N.map(B)}),d.jsx(La,{value:"active",className:"space-y-4",children:D.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(Wo,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noActiveRequests","Nessuna richiesta attiva")})]})}):D.map(B)}),d.jsx(La,{value:"completed",className:"space-y-4",children:V.length===0?d.jsx(Ti,{children:d.jsxs(Ji,{className:"py-12 text-center",children:[d.jsx(Wo,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("volunteer.noCompletedRequests","Nessuna richiesta completata")})]})}):V.map(B)})]})]}),d.jsx(ll,{open:c,onOpenChange:f,children:d.jsxs(Va,{children:[d.jsxs(cl,{children:[d.jsx($a,{children:t("volunteer.confirmServiceTitle","Conferma Completamento")}),d.jsx(Oc,{children:t("volunteer.confirmServiceDescription","Confermi che il servizio è stato completato? Il volontario riceverà automaticamente il compenso in crediti CEI.")})]}),n&&d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("div",{className:"bg-secondary/30 rounded-lg p-4",children:[d.jsx("p",{className:"font-medium mb-1",children:n.listing.title}),d.jsxs("p",{className:"text-sm text-muted-foreground",children:["Volontario: ",n.volunteer.firstName," ",n.volunteer.lastName]})]}),d.jsxs("div",{className:"bg-primary/10 rounded-lg p-4 border border-primary/20",children:[d.jsx("p",{className:"text-sm font-medium mb-1",children:"ð° Compenso"}),d.jsxs("p",{className:"text-2xl font-bold",children:[(W=n.platformPayout)!=null&&W.amount&&parseFloat(n.platformPayout.amount)>0?n.platformPayout.amount:n.listing.priceCredits&&parseFloat(n.listing.priceCredits)>0?n.listing.priceCredits:(S==null?void 0:S.amount)??"50"," CEI"]}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Pagato automaticamente dalla piattaforma"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tt,{variant:"outline",className:"flex-1",onClick:()=>{f(!1),o(null)},children:t("common.cancel","Annulla")}),d.jsx(tt,{className:"flex-1",onClick:()=>n&&I.mutate(n.id),disabled:I.isPending,"data-testid":"button-confirm-payment",children:I.isPending?t("common.processing","Elaborazione..."):t("volunteer.confirmAndPay","Conferma e Paga")})]})]})]})})]})}function Q7(){const{t}=pr(),e=[{number:1,icon:kj,titleKey:"registrationGuide.step1Title",descKey:"registrationGuide.step1Desc",tipsKey:"registrationGuide.step1Tips",imageAlt:"Click Sign In button"},{number:2,icon:Z3,titleKey:"registrationGuide.step2Title",descKey:"registrationGuide.step2Desc",tipsKey:"registrationGuide.step2Tips",imageAlt:"Continue with email"},{number:3,icon:sxe,titleKey:"registrationGuide.step3Title",descKey:"registrationGuide.step3Desc",tipsKey:"registrationGuide.step3Tips",imageAlt:"Enter verification code"},{number:4,icon:i1,titleKey:"registrationGuide.step4Title",descKey:"registrationGuide.step4Desc",tipsKey:"registrationGuide.step4Tips",imageAlt:"Create username"},{number:5,icon:Wo,titleKey:"registrationGuide.step5Title",descKey:"registrationGuide.step5Desc",tipsKey:"registrationGuide.step5Tips",imageAlt:"Authorize CEI"},{number:6,icon:ju,titleKey:"registrationGuide.step6Title",descKey:"registrationGuide.step6Desc",tipsKey:"registrationGuide.step6Tips",imageAlt:"Complete CEI profile"},{number:7,icon:fo,titleKey:"registrationGuide.step7Title",descKey:"registrationGuide.step7Desc",tipsKey:"registrationGuide.step7Tips",imageAlt:"Add location"},{number:8,icon:Yp,titleKey:"registrationGuide.step8Title",descKey:"registrationGuide.step8Desc",tipsKey:"registrationGuide.step8Tips",imageAlt:"Save and start"}];return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-8",children:[d.jsx("div",{className:"flex items-center gap-4 mb-8",children:d.jsx(yr,{href:"/","data-testid":"link-back-marketplace",children:d.jsxs(tt,{variant:"ghost",size:"sm","data-testid":"button-back-marketplace",children:[d.jsx(Ao,{className:"h-4 w-4 mr-2"}),d.jsx("span",{children:t("registrationGuide.backToMarketplace")})]})})}),d.jsxs("div",{className:"text-center mb-12",children:[d.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[d.jsx(kj,{className:"h-10 w-10 text-primary","data-testid":"icon-guide-hero"}),d.jsx("h1",{className:"text-4xl font-bold","data-testid":"text-guide-hero-title",children:t("registrationGuide.heroTitle")})]}),d.jsx("p",{className:"text-xl text-muted-foreground mb-4","data-testid":"text-guide-hero-subtitle",children:t("registrationGuide.heroSubtitle")}),d.jsx("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-4 max-w-2xl mx-auto",children:d.jsx("p",{className:"text-sm text-primary font-medium",children:t("registrationGuide.timeEstimate")})})]}),d.jsxs(Ti,{className:"mb-8 border-2 border-primary/20 bg-primary/5",children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(Gve,{className:"h-5 w-5 text-primary"}),t("registrationGuide.beforeYouStart")]})}),d.jsx(Ji,{children:d.jsxs("ul",{className:"space-y-2",children:[d.jsxs("li",{className:"flex items-start gap-2",children:[d.jsx(Wo,{className:"h-5 w-5 text-green-500 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("registrationGuide.requirement1")})]}),d.jsxs("li",{className:"flex items-start gap-2",children:[d.jsx(Wo,{className:"h-5 w-5 text-green-500 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("registrationGuide.requirement2")})]}),d.jsxs("li",{className:"flex items-start gap-2",children:[d.jsx(Wo,{className:"h-5 w-5 text-green-500 mt-0.5 flex-shrink-0"}),d.jsx("span",{children:t("registrationGuide.requirement3")})]})]})})]}),d.jsx("div",{className:"space-y-6",children:e.map((i,n)=>{const o=i.icon,c=n===e.length-1;return d.jsxs(Ti,{className:"relative overflow-hidden","data-testid":`card-step-${i.number}`,children:[d.jsx("div",{className:"absolute top-0 left-0 w-2 h-full bg-primary"}),d.jsx(In,{className:"pl-6",children:d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-primary text-primary-foreground font-bold text-xl",children:i.number}),d.jsx("div",{className:"flex-1",children:d.jsxs(kn,{className:"flex items-center gap-2 text-xl",children:[d.jsx(o,{className:"h-5 w-5 text-primary"}),t(i.titleKey)]})})]})}),d.jsxs(Ji,{className:"pl-6",children:[d.jsxs("div",{className:"ml-16",children:[d.jsx("p",{className:"text-muted-foreground mb-4 whitespace-pre-line",children:t(i.descKey)}),d.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 border-l-4 border-primary/50",children:[d.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:t("registrationGuide.tipLabel")}),d.jsx("p",{className:"text-sm text-muted-foreground",children:t(i.tipsKey)})]})]}),!c&&d.jsx("div",{className:"flex justify-center mt-6",children:d.jsx(Bve,{className:"h-6 w-6 text-muted-foreground animate-pulse"})})]})]},i.number)})}),d.jsxs(Ti,{className:"mt-8 border-2 border-green-500/20 bg-green-500/5",children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2 text-green-600",children:[d.jsx(Wo,{className:"h-6 w-6"}),t("registrationGuide.completedTitle")]})}),d.jsxs(Ji,{children:[d.jsx("p",{className:"text-muted-foreground mb-4",children:t("registrationGuide.completedDesc")}),d.jsxs("ul",{className:"space-y-2 mb-6",children:[d.jsxs("li",{className:"flex items-center gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 text-green-500"}),d.jsx("span",{children:t("registrationGuide.benefit1")})]}),d.jsxs("li",{className:"flex items-center gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 text-green-500"}),d.jsx("span",{children:t("registrationGuide.benefit2")})]}),d.jsxs("li",{className:"flex items-center gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 text-green-500"}),d.jsx("span",{children:t("registrationGuide.benefit3")})]}),d.jsxs("li",{className:"flex items-center gap-2",children:[d.jsx(Wo,{className:"h-4 w-4 text-green-500"}),d.jsx("span",{children:t("registrationGuide.benefit4")})]})]})]})]}),d.jsxs("div",{className:"text-center mt-8",children:[d.jsx("p",{className:"text-muted-foreground mb-4",children:t("registrationGuide.readyToStart")}),d.jsx(yr,{href:"/",children:d.jsxs(tt,{size:"lg","data-testid":"button-start-registration",children:[d.jsx(kj,{className:"h-5 w-5 mr-2"}),t("registrationGuide.startButton")]})})]}),d.jsx("div",{className:"text-center mt-8",children:d.jsxs("p",{className:"text-sm text-muted-foreground",children:[t("registrationGuide.needHelp")," ",d.jsx(yr,{href:"/faq",className:"text-primary hover:underline",children:t("registrationGuide.checkFaq")})]})})]})})}function r8e(){const{t}=pr(),[,e]=uE("/store/:userId"),i=e==null?void 0:e.userId,n=K.useMemo(()=>new URLSearchParams(window.location.search).get("from")==="map"?"/map":"/",[]),o=n==="/map"?t("common.backToMap","Torna alla mappa"):t("common.backToMarketplace","Torna al marketplace"),{data:c,isLoading:f,error:r}=Xn({queryKey:["/api/store",i],enabled:!!i});if(f)return d.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:d.jsx("div",{className:"animate-pulse text-muted-foreground",children:t("common.loading","Caricamento...")})});if(r||!c)return d.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background gap-4",children:[d.jsx("p",{className:"text-muted-foreground",children:t("store.notFound","Negozio non trovato")}),d.jsx(yr,{href:n,children:d.jsxs(tt,{var
3911iant:"outline",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),o]})})]});const{user:x,listings:S}=c,C=`${x.firstName||""} ${x.lastName||""}`.trim()||t("store.unnamed","Negozio"),I=`${(x.firstName||"")[0]||""}${(x.lastName||"")[0]||""}`.toUpperCase()||"?";return d.jsxs("div",{className:"min-h-screen bg-background",children:[x.storeCoverImageUrl?d.jsxs("div",{className:"relative h-48 md:h-64 lg:h-80 overflow-hidden",children:[d.jsx("img",{src:x.storeCoverImageUrl,alt:t("store.coverAlt","Copertina negozio"),className:"w-full h-full object-cover","data-testid":"img-store-cover"}),d.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"})]}):d.jsx("div",{className:"h-32 md:h-40 bg-gradient-to-r from-primary/20 to-primary/10"}),d.jsxs("div",{className:"container mx-auto px-4",children:[d.jsx("div",{className:`relative ${x.storeCoverImageUrl?"-mt-16":"-mt-8"} mb-8`,children:d.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-end gap-4",children:[d.jsxs(Nc,{className:"w-24 h-24 md:w-32 md:h-32 border-4 border-background shadow-lg",children:[d.jsx(Rd,{src:x.profileImageUrl||void 0,alt:C}),d.jsx(Mc,{className:"text-2xl md:text-3xl bg-primary text-primary-foreground",children:I})]}),d.jsxs("div",{className:"flex-1 pb-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[d.jsx("h1",{className:"text-2xl md:text-3xl font-bold","data-testid":"text-store-name",children:C}),(x.isProfessional||x.isAdmin)&&d.jsxs(En,{variant:"default",className:"bg-primary","data-testid":"badge-professional",children:[d.jsx(Ru,{className:"w-3 h-3 mr-1 fill-current"}),"Professional"]})]}),d.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground",children:[x.city&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:x.city})]}),x.website&&d.jsxs("a",{href:x.website.startsWith("http")?x.website:`https://${x.website}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 hover:text-primary transition-colors",children:[d.jsx(YN,{className:"w-4 h-4"}),d.jsx("span",{children:t("store.visitWebsite","Sito web")})]})]}),x.profession&&d.jsx("p",{className:"mt-2 text-muted-foreground","data-testid":"text-profession",children:x.profession}),x.bio&&d.jsx("p",{className:"mt-3 text-sm","data-testid":"text-bio",children:x.bio})]}),d.jsx("div",{className:"flex gap-2",children:d.jsx(yr,{href:n,children:d.jsxs(tt,{variant:"outline",size:"sm",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),o]})})})]})}),d.jsxs("div",{className:"mb-6",children:[d.jsx("h2",{className:"text-xl font-semibold mb-1","data-testid":"text-listings-title",children:t("store.products","Prodotti e servizi")}),d.jsx("p",{className:"text-muted-foreground",children:t("store.listingsCount","{{count}} annunci disponibili",{count:S.length})})]}),S.length>0?d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 pb-12",children:S.map(N=>d.jsx(_ie,{listing:N},N.id))}):d.jsx("div",{className:"text-center py-16",children:d.jsx("p",{className:"text-muted-foreground",children:t("store.noListings","Questo negozio non ha ancora annunci")})})]})]})}function s8e(){const{t}=pr(),{user:e}=Ka(),[,i]=uE("/user/:userId"),n=i==null?void 0:i.userId,o=K.useMemo(()=>new URLSearchParams(window.location.search).get("from")==="map"?"/map":"/",[]),c=o==="/map"?t("common.backToMap","Torna alla mappa"):t("common.backToMarketplace","Torna al marketplace"),{data:f,isLoading:r,error:x}=Xn({queryKey:["/api/user-profile",n],enabled:!!n});if(r)return d.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:d.jsx("div",{className:"animate-pulse text-muted-foreground",children:t("common.loading","Caricamento...")})});if(x||!f)return d.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background gap-4",children:[d.jsx("p",{className:"text-muted-foreground",children:t("profile.notFound","Profilo non trovato")}),d.jsx(yr,{href:o,children:d.jsxs(tt,{variant:"outline",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),c]})})]});const{user:S}=f,C=`${S.firstName||""} ${S.lastName||""}`.trim()||t("profile.anonymous","Utente"),I=`${(S.firstName||"")[0]||""}${(S.lastName||"")[0]||""}`.toUpperCase()||"?";return d.jsxs("div",{className:"min-h-screen bg-background",children:[d.jsx("div",{className:"h-32 bg-gradient-to-r from-primary/20 to-primary/10"}),d.jsx("div",{className:"container mx-auto px-4 max-w-2xl",children:d.jsx("div",{className:"relative -mt-16 mb-8",children:d.jsx(Ti,{children:d.jsx(Ji,{className:"pt-6",children:d.jsxs("div",{className:"flex flex-col items-center text-center",children:[d.jsxs(Nc,{className:"w-24 h-24 border-4 border-background shadow-lg -mt-16 mb-4",children:[d.jsx(Rd,{src:S.profileImageUrl||void 0,alt:C}),d.jsx(Mc,{className:"text-2xl bg-primary text-primary-foreground",children:I})]}),d.jsx("h1",{className:"text-2xl font-bold mb-2","data-testid":"text-user-name",children:C}),S.profession&&d.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-2",children:[d.jsx(W3,{className:"w-4 h-4"}),d.jsx("span",{"data-testid":"text-profession",children:S.profession})]}),S.city&&d.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-4",children:[d.jsx(fo,{className:"w-4 h-4"}),d.jsx("span",{children:S.city})]}),S.bio&&d.jsx("p",{className:"text-sm max-w-md mb-6","data-testid":"text-bio",children:S.bi
3911o}),d.jsxs("div",{className:"flex gap-3",children:[d.jsx(yr,{href:o,children:d.jsxs(tt,{variant:"outline",size:"sm",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),c]})}),e&&e.id!==S.id&&d.jsx(yr,{href:`/messages?userId=${S.id}`,children:d.jsxs(tt,{size:"sm",children:[d.jsx(sf,{className:"w-4 h-4 mr-2"}),t("profile.sendMessage","Invia messaggio")]})})]})]})})})})})]})}function J7(){const{t,i18n:e}=pr(),[,i]=$o(),n=e.language;return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[d.jsxs(tt,{variant:"ghost",onClick:()=>i("/"),className:"mb-6 touch-manipulation","data-testid":"button-back-home",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),n==="it"?"Torna alla Home":"Back to Home"]}),d.jsx(Ti,{children:d.jsx(Ji,{className:"p-6 md:p-8 prose prose-sm md:prose-base dark:prose-invert max-w-none",children:n==="it"?d.jsx(o8e,{}):d.jsx(a8e,{})})})]})})}function o8e(){return d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-6","data-testid":"text-privacy-title",children:"Informativa sulla Privacy"}),d.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Ultimo aggiornamento: ",new Date().toLocaleDateString("it-IT")]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"1. Titolare del Trattamento"}),d.jsx("p",{children:"Il Titolare del trattamento dei dati personali è:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Associazione Comunità Economica Indipendente"})}),d.jsx("p",{children:"Email: [email protected]"}),d.jsx("p",{children:"Sito web: lacei.it"})]}),d.jsx("p",{children:"Per qualsiasi domanda relativa al trattamento dei tuoi dati personali, puoi contattarci all'indirizzo email sopra indicato."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"2. Tipologie di Dati Raccolti"}),d.jsx("p",{children:"La piattaforma raccoglie le seguenti categorie di dati personali:"}),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Dati forniti volontariamente dall'utente:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"Nome e cognome"}),d.jsx("li",{children:"Indirizzo email"}),d.jsx("li",{children:"Numero di telefono"}),d.jsx("li",{children:"Indirizzo di residenza (città , via, CAP)"}),d.jsx("li",{children:"Data di nascita"}),d.jsx("li",{children:"Professione"}),d.jsx("li",{children:"Foto del profilo"}),d.jsx("li",{children:"Sito web personale"})]}),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Dati raccolti automaticamente:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"Indirizzo IP"}),d.jsx("li",{children:"Tipo di browser e dispositivo"}),d.jsx("li",{children:"Dati di navigazione e interazione con la piattaforma"}),d.jsx("li",{children:"Dati di geolocalizzazione (solo se autorizzati)"})]}),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Dati relativi alle transazioni:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"Storico delle transazioni in crediti CEI"}),d.jsx("li",{children:"Saldo del wallet"}),d.jsx("li",{children:"Annunci pubblicati"}),d.jsx("li",{children:"Messaggi scambiati sulla piattaforma"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"3. Finalità del Trattamento"}),d.jsx("p",{children:"I tuoi dati personali sono trattati per le seguenti finalità :"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Registrazione e gestione dell'account:"})," per creare e gestire il tuo profilo utente sulla piattaforma."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Erogazione dei servizi:"})," per permetterti di pubblicare annunci, effettuare transazioni in crediti CEI, e comunicare con altri utenti."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Gestione del wallet:"})," per gestire il tuo portafoglio di crediti CEI, incluse le transazioni e il saldo."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Geolocalizzazione:"})," per mostrare la tua posizione sulla mappa della community (solo se autorizzi)."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Comunicazioni di servizio:"}
3911)," per inviarti notifiche relative al tuo account e alle tue transazioni."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Sicurezza:"})," per prevenire frodi e garantire la sicurezza della piattaforma."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Adempimenti legali:"})," per rispettare obblighi di legge applicabili."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"4. Base Giuridica del Trattamento"}),d.jsx("p",{children:"Il trattamento dei tuoi dati si basa su:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Esecuzione del contratto (Art. 6.1.b GDPR):"})," per la registrazione e l'utilizzo dei servizi della piattaforma."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Consenso (Art. 6.1.a GDPR):"})," per la geolocalizzazione e l'invio di comunicazioni promozionali."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Legittimo interesse (Art. 6.1.f GDPR):"})," per la sicurezza della piattaforma e la prevenzione delle frodi."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Obbligo legale (Art. 6.1.c GDPR):"})," per adempiere a obblighi di legge."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"5. Destinatari dei Dati"}),d.jsx("p",{children:"I tuoi dati personali possono essere condivisi con:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Altri utenti della piattaforma:"})," le informazioni del tuo profilo pubblico sono visibili agli altri membri della community."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Fornitori di servizi tecnici:"})," hosting (Replit/Google Cloud), servizi di mappe (Mapbox)."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Autorità competenti:"})," quando richiesto dalla legge."]})]}),d.jsx("p",{className:"mt-4",children:"Non vendiamo né cediamo i tuoi dati personali a terzi per finalità di marketing."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"6. Trasferimento dei Dati all'Estero"}),d.jsx("p",{children:"Alcuni dei nostri fornitori di servizi hanno sede negli Stati Uniti. Il trasferimento dei dati verso questi paesi avviene sulla base di:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsx("li",{children:"Clausole Contrattuali Standard approvate dalla Commissione Europea"}),d.jsx("li",{children:"Decisioni di adeguatezza della Commissione Europea (dove applicabili)"})]}),d.jsx("p",{className:"mt-4",children:"Puoi richiedere una copia delle garanzie appropriate contattandoci all'indirizzo email indicato sopra."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"7. Periodo di Conservazione"}),d.jsx("p",{children:"I tuoi dati personali saranno conservati per i seguenti periodi:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Dati dell'account:"})," per tutta la durata dell'iscrizione e per 5 anni dalla cancellazione."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Dati delle transazioni:"})," per 10 anni come richiesto dalla normativa fiscale italiana."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Messaggi:"})," per 2 anni dall'ultimo messaggio."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Log di sicurezza:"})," per 6 mesi."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"8. I Tuoi Diritti"}),d.jsx("p",{children:"Ai sensi del GDPR e del Codice Privacy italiano, hai diritto a:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Accesso:"})," ottenere conferma del trattamento e copia dei tuoi dati."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Rettifica:"})," correggere i tuoi dati inesatti o incompleti."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Cancellazione:"}),` richiedere la cancellazione dei tuoi dati ("diritto all'oblio").`]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Limitazione:"})," limitare il trattamento in determinati casi."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Portabilità :"})," ricevere i tuoi dati in formato strutturato e trasferirli ad altro titolare."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Opposizione:"})," opporti al trattamento basato sul legittimo interesse."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Revoca del consenso:"})," revocare il consenso in qualsiasi momento."]})]}),d.jsx("p",{className:"mt-4",children:"Per esercitare questi diritti, contattaci all'indirizzo: [email protected]"})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"9. Diritto di Reclamo"}),d.jsx("p",{children:"Hai il diritto di proporre reclamo all'Autorità Garante per la Protezione dei Dati Personali:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Garante per la protezione dei dati personali"})}),d.jsx("p",{children:"Piazza Venezia 11 - 00187 Roma"}),d.jsx("p",{children:"Email: [email protected]"}),d.jsx("p",{children:"PEC: [email protected]"}),d.jsx("p",{children:"Sito web: www.garanteprivacy.it"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"10. Cookie"}),d.jsx("p",{children:"La piattaforma utilizza cookie tecnici necessari per il funzionamento del servizio. Non utilizziamo cookie di profilazione o di terze parti per finalità pubblicitarie."}),d.jsx("p",{className:"mt-4",children:"I cookie tecnici utilizzati includono:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Cookie di sessione:"})," per mantenere l'autenticazione dell'utente."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Cookie di preferenze:"})," per memorizzare la lingua e il tema scelti."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"11. Minori"}),d.jsx("p",{children:"La piattaforma è rivolta a utenti maggiorenni. In conformità con la normativa italiana, gli utenti di età inferiore ai 14 anni non possono registrarsi senza il consenso dei genitori o di chi esercita la responsabilità genitoriale."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"12. Sicurezza dei Dati"}),d.jsx("p",{children:"Adottiamo misure tecniche e organizzative appropriate per proteggere i tuoi dati personali, tra cui:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsx("li",{children:"Crittografia dei dati in transito (HTTPS/TLS)"}),d.jsx("li",{children:"Autenticazione sicura tramite provider OAuth"}),d.jsx("li",{children:"Backup regolari dei dati"}),d.jsx("li",{children:"Accesso limitato ai dati da parte del personale autorizzato"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"13. Modifiche alla Privacy Policy"}),d.jsx("p",{children:"Ci riserviamo il diritto di modificare questa informativa in qualsiasi momento. Le modifiche saranno pubblicate su questa pagina con indicazione della data di ultimo aggiornamento. Ti invitiamo a consultare periodicamente questa pagina."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"14. Contatti"}),d.jsx("p",{children:"Per qualsiasi domanda relativa a questa informativa o al trattamento dei tuoi dati personali, puoi contattarci a:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Associazione Comunità Economica Indipendente"})}),d.jsx("p",{children:"Email: [email protected]"})]})]})]})}function a8e(){return d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-6","data-testid":"text-privacy-title",children:"Privacy Policy"}),d.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Last updated: ",new Date().toLocaleDateString("en-US")]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"1. Data Controller"}),d.jsx("p",{children:"The Data Controller for personal data processing is:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Associazione Comunità Economica Indipendente"})}),d.jsx("p",{children:"Email: [email protected]"}),d.jsx("p",{children:"Website: lacei.it"})]}),d.jsx("p",{children:"For any questions regarding the processing of your personal data, you can contact us at the email address indicated above."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"2. Types of Data Collected"}),d.jsx("p",{children:"The platform collects the following categories of personal data:"}
3911),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Data voluntarily provided by the user:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"First and last name"}),d.jsx("li",{children:"Email address"}),d.jsx("li",{children:"Phone number"}),d.jsx("li",{children:"Residential address (city, street, postal code)"}),d.jsx("li",{children:"Date of birth"}),d.jsx("li",{children:"Profession"}),d.jsx("li",{children:"Profile photo"}),d.jsx("li",{children:"Personal website"})]}),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Automatically collected data:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"IP address"}),d.jsx("li",{children:"Browser and device type"}),d.jsx("li",{children:"Navigation and interaction data with the platform"}),d.jsx("li",{children:"Geolocation data (only if authorized)"})]}),d.jsx("h3",{className:"text-lg font-medium mt-4 mb-2",children:"Transaction-related data:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-1",children:[d.jsx("li",{children:"CEI credits transaction history"}),d.jsx("li",{children:"Wallet balance"}),d.jsx("li",{children:"Published listings"}),d.jsx("li",{children:"Messages exchanged on the platform"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"3. Purposes of Processing"}),d.jsx("p",{children:"Your personal data is processed for the following purposes:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Registration and account management:"})," to create and manage your user profile on the platform."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Service delivery:"})," to allow you to publish listings, make CEI credit transactions, and communicate with other users."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Wallet management:"})," to manage your CEI credit wallet, including transactions and balance."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Geolocation:"})," to show your location on the community map (only if authorized)."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Service communications:"})," to send you notifications regarding your account and transactions."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Security:"})," to prevent fraud and ensure platform security."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Legal compliance:"})," to comply with applicable legal obligations."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"4. Legal Basis for Processing"}),d.jsx("p",{children:"The processing of your data is based on:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Contract performance (Art. 6.1.b GDPR):"})," for registration and use of platform services."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Consent (Art. 6.1.a GDPR):"})," for geolocation and sending promotional communications."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Legitimate interest (Art. 6.1.f GDPR):"})," for platform security and fraud prevention."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Legal obligation (Art. 6.1.c GDPR):"})," to comply with legal obligations."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"5. Data Recipients"}),d.jsx("p",{children:"Your personal data may be shared with:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Other platform users:"})," your public profile information is visible to other community members."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Technical service providers:"})," hosting (Replit/Google Cloud), map services (Mapbox)."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Competent authorities:"})," when required by law."]})]}),d.jsx("p",{className:"mt-4",children:"We do not sell or transfer your personal data to third parties for marketing purposes."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"6. International Data Transfers"}),d.jsx("p",{children:"Some of our service providers are based in the United States. Data transfers to these countries are made on the basis of:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsx("li",{children:"Standard Contractual Clauses approved by the European Commission"}),d.jsx("li",{children:"European Commission adequacy decisions (where applicable)"})]}),d.jsx("p",{className:"mt-4",children:"You can request a copy of the appropriate safeguards by contacting us at the email address indicated above."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"7. Retention Period"}),d.jsx("p",{children:"Your personal data will be retained for the following periods:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Account data:"})," for the duration of registration and for 5 years after deletion."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Transaction data:"})," for 10 years as required by Italian tax law."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Messages:"})," for 2 years from the last message."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Security logs:"})," for 6 months."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"8. Your Rights"}),d.jsx("p",{children:"Under GDPR and Italian Privacy Code, you have the right to:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Access:"})," obtain confirmation of processing and a copy of your data."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Rectification:"})," correct your inaccurate or incomplete data."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Erasure:"}
3911),' request deletion of your data ("right to be forgotten").']}),d.jsxs("li",{children:[d.jsx("strong",{children:"Restriction:"})," limit processing in certain cases."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Portability:"})," receive your data in a structured format and transfer it to another controller."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Object:"})," object to processing based on legitimate interest."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Withdraw consent:"})," withdraw your consent at any time."]})]}),d.jsx("p",{className:"mt-4",children:"To exercise these rights, contact us at: [email protected]"})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"9. Right to Complain"}),d.jsx("p",{children:"You have the right to lodge a complaint with the Italian Data Protection Authority:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Garante per la protezione dei dati personali"})}),d.jsx("p",{children:"Piazza Venezia 11 - 00187 Roma, Italy"}),d.jsx("p",{children:"Email: [email protected]"}),d.jsx("p",{children:"PEC: [email protected]"}),d.jsx("p",{children:"Website: www.garanteprivacy.it"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"10. Cookies"}),d.jsx("p",{children:"The platform uses technical cookies necessary for the operation of the service. We do not use profiling cookies or third-party cookies for advertising purposes."}),d.jsx("p",{className:"mt-4",children:"Technical cookies used include:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Session cookies:"})," to maintain user authentication."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Preference cookies:"})," to store the chosen language and theme."]})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"11. Minors"}),d.jsx("p",{children:"The platform is intended for adult users. In accordance with Italian law, users under 14 years of age cannot register without the consent of parents or those exercising parental responsibility."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"12. Data Security"}),d.jsx("p",{children:"We adopt appropriate technical and organizational measures to protect your personal data, including:"}),d.jsxs("ul",{className:"list-disc pl-6 space-y-2 mt-4",children:[d.jsx("li",{children:"Encryption of data in transit (HTTPS/TLS)"}),d.jsx("li",{children:"Secure authentication via OAuth providers"}),d.jsx("li",{children:"Regular data backups"}),d.jsx("li",{children:"Limited data access by authorized personnel"})]})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"13. Changes to Privacy Policy"}),d.jsx("p",{children:"We reserve the right to modify this policy at any time. Changes will be published on this page with an indication of the last update date. We encourage you to periodically review this page."})]}),d.jsxs("section",{className:"mb-8",children:[d.jsx("h2",{className:"text-xl font-semibold mb-4",children:"14. Contacts"}),d.jsx("p",{children:"For any questions regarding this policy or the processing of your personal data, you can contact us at:"}),d.jsxs("div",{className:"bg-muted p-4 rounded-md my-4",children:[d.jsx("p",{children:d.jsx("strong",{children:"Associazione Comunità Economica Indipendente"})}),d.jsx("p",{children:"Email: [email protected]"})]})]})]})}const l8e={privacy:i1,ethics:yJ,regulations:kJ,other:Yp},c8e={privacy:"documents.typePrivacy",ethics:"documents.typeEthics",regulations:"documents.typeRegulations",other:"documents.typeOther"};function eW(t){return(t==null?void 0:t.startsWith("image/"))??!1}function u8e(t){return t==="application/pdf"}function tW(){const{t}=pr(),{data:e=[],isLoading:i}=Xn({queryKey:["/api/documents"]}),n=e.reduce((c,f)=>{const r=f.documentType;return c[r]||(c[r]=[]),c[r].push(f),c},{}),o=["privacy","ethics","regulations","other"].filter(c=>{var f;return((f=n[c])==null?void 0:f.length)>0});return d.jsx("div",{className:"min-h-screen bg-background",children:d.jsxs("div",{className:"container max-w-4xl mx-auto px-4 py-8",children:[d.jsx("div",{className:"flex items-center gap-4 mb-8",children:d.jsx(yr,{href:"/","data-testid":"link-back-home",children:d.jsxs(tt,{variant:"ghost",size:"sm","data-testid":"button-back-home",children:[d.jsx(Ao,{className:"h-4 w-4 mr-2"}),d.jsx("span",{children:t("documents.backToHome","Torna alla Home")})]})})}),d.jsxs("div",{className:"text-center mb-12",children:[d.jsx("h1",{className:"text-4xl font-bold mb-4","data-testid":"text-documents-title",children:t("documents.title","Documenti")}),d.jsx("p",{className:"text-xl text-muted-foreground","data-testid":"text-documents-subtitle",children:t("documents.subtitle","Privacy, Codice Etico e Regolamenti della Comunità ")})]}),i?d.jsx("div",{className:"flex justify-center py-12",children:d.jsx("div",{className:"animate-pulse text-muted-foreground",children:t("common.loading","Caricamento...")})}):e.length===0?d.jsx(Ti,{className:"text-center py-12",children:d.jsxs(Ji,{children:[d.jsx(Yp,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),d.jsx("p",{className:"text-muted-foreground",children:t("documents.noDocuments","Nessun documento disponibile al momento.")})]})}):d.jsx("div",{className:"space-y-8",children:o.map(c=>{const f=l8e[c]||Yp,r=n[c];return d.jsxs(Ti,{"data-testid":`card-document-type-${c}`,children:[d.jsx(In,{children:d.jsxs(kn,{className:"flex items-center gap-2",children:[d.jsx(f,{className:"h-6 w-6 text-primary"}),t(c8e[c],c)]})}),d.jsx(Ji,{children:d.jsx("div",{className:"space-y-4",children:r.map(x=>d.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-lg border bg-card hover-elevate","data-testid":`document-item-${x.id}`,children:[d.jsx("div",{className:"flex-shrink-0",children:eW(x.mimeType)?d.jsx(Fk,{className:"h-8 w-8 text-primary"}):u8e(x.mimeType)?d.jsx(Yp,{className:"h-8 w-8 text-red-500"}):d.jsx(Jve,{className:"h-8 w-8 text-muted-foreground"})}),d.jsxs("div",{className:"flex-grow min-w-0",children:[d.jsx("h3",{className:"font-semibold text-lg",children:x.title}),x.description&&d.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:x.description}),x.fileSize&&d.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[(x.fileSize/1024).toFixed(1)," KB"]}
3911)]}),d.jsx("div",{className:"flex-shrink-0 flex gap-2",children:eW(x.mimeType)?d.jsx("a",{href:x.storagePath,target:"_blank",rel:"noopener noreferrer","data-testid":`button-view-${x.id}`,children:d.jsxs(tt,{variant:"outline",size:"sm",children:[d.jsx(XN,{className:"h-4 w-4 mr-2"}),t("documents.view","Visualizza")]})}):d.jsx("a",{href:x.storagePath,target:"_blank",rel:"noopener noreferrer","data-testid":`button-download-${x.id}`,children:d.jsxs(tt,{variant:"outline",size:"sm",children:[d.jsx(ZN,{className:"h-4 w-4 mr-2"}),t("documents.download","Scarica")]})})})]},x.id))})})]},c)})})]})})}const d8e="modulepreload",h8e=function(t){return"/"+t},iW={},p8e=function(e,i,n){let o=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),r=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=Promise.allSettled(i.map(x=>{if(x=h8e(x),x in iW)return;iW[x]=!0;const S=x.endsWith(".css"),C=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${x}"]${C}`))return;const I=document.createElement("link");if(I.rel=S?"stylesheet":d8e,S||(I.as="script"),I.crossOrigin="",I.href=x,r&&I.setAttribute("nonce",r),document.head.appendChild(I),S)return new Promise((N,D)=>{I.addEventListener("load",N),I.addEventListener("error",()=>D(new Error(`Unable to preload CSS for ${x}`)))})}))}function c(f){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=f,window.dispatchEvent(r),!r.defaultPrevented)throw f}return o.then(f=>{for(const r of f||[])r.status==="rejected"&&c(r.reason);return e().catch(c)})};function f8e(){const[,t]=$o(),e=K.useRef(null),i=K.useCallback(async()=>{if(!e.current)return;const{default:n}=await p8e(async()=>{const{default:f}=await import("./html2canvas.esm-CBrSDip1.js");return{default:f}},[]),o=await n(e.current,{scale:3,useCORS:!0,backgroundColor:null}),c=document.createElement("a");c.download="CEI_Locandina_Lancio_12Maggio2026.png",c.href=o.toDataURL("image/png"),c.click()},[]);return d.jsx("div",{className:"min-h-screen bg-background py-6 px-4",children:d.jsxs("div",{className:"max-w-2xl mx-auto",children:[d.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-2",children:[d.jsxs(tt,{variant:"ghost",onClick:()=>t("/"),"data-testid":"button-back-home",children:[d.jsx(Ao,{className:"w-4 h-4 mr-2"}),"Torna alla Home"]}),d.jsxs(tt,{onClick:i,"data-testid":"button-download-flyer",children:[d.jsx(ZN,{className:"w-4 h-4 mr-2"}),"Scarica Locandina"]})]}),d.jsxs("div",{ref:e,className:"relative overflow-hidden rounded-md",style:{background:"linear-gradient(160deg, #0b1a3a 0%, #0e3d6e 20%, #1565a0 40%, #1b88b8 55%, #22a0b8 70%, #2db89e 85%, #3ac98a 100%)",fontFamily:"'Inter', sans-serif"},children:[d.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"radial-gradient(ellipse 80% 60% at 15% 20%, rgba(100,180,255,0.35) 0%, transparent 60%), radial-gradient(ellipse 70% 50% at 85% 15%, rgba(255,220,100,0.25) 0%, transparent 55%), radial-gradient(ellipse 90% 70% at 50% 90%, rgba(80,255,200,0.2) 0%, transparent 50%), radial-gradient(ellipse 50% 40% at 70% 50%, rgba(160,120,255,0.15) 0%, transparent 50%), radial-gradient(circle at 30% 70%, rgba(255,160,80,0.18) 0%, transparent 40%)"}}),d.jsx("div",{className:"absolute inset-0 opacity-[0.03]",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`}}),d.jsxs("div",{className:"relative z-10 px-6 py-10 sm:px-10 sm:py-14",children:[d.jsx("div",{className:"flex justify-center mb-5",children:d.jsx("img",{src:cf,alt:"CEI Logo",className:"w-20 h-20 sm:w-24 sm:h-24",style:{filter:"drop-shadow(0 0 12px rgba(255,255,255,0.3))"}})}),d.jsx("p",{className:"text-center text-amber-300/90 text-xs font-bold tracking-[0.3em] uppercase mb-6",children:"Evento Storico"}),d.jsx("h1",{className:"text-center text-3xl sm:text-5xl font-black tracking-tight leading-tight mb-1",style:{color:"#fff"},children:"COMUNITÃ ECONOMICA"}),d.jsx("h1",{className:"text-center text-3xl sm:text-5xl font-black tracking-tight leading-tight mb-10",style:{color:"#a5e4ff"}
3911,children:"INDIPENDENTE"}),d.jsxs("div",{className:"flex items-center justify-center gap-4 mb-2",children:[d.jsx("div",{className:"h-px flex-1 max-w-[80px]",style:{background:"linear-gradient(90deg, transparent, rgba(255,255,255,0.4))"}}),d.jsx("p",{className:"text-amber-300 text-sm font-bold tracking-[0.25em] uppercase",children:"12 Maggio 2026"}),d.jsx("div",{className:"h-px flex-1 max-w-[80px]",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.4), transparent)"}})]}),d.jsx("p",{className:"text-center text-white text-2xl sm:text-3xl font-extrabold tracking-wide mb-1",children:"APERTURA UFFICIALE"}),d.jsx("p",{className:"text-center text-blue-200/80 text-lg font-semibold mb-10",children:"Nuova Piattaforma"}),d.jsx("div",{className:"text-center mb-3",children:d.jsx("span",{className:"text-4xl sm:text-5xl font-black",style:{color:"#b4f0ff",letterSpacing:"0.05em"},children:"lacei.it"})}),d.jsxs("p",{className:"text-center text-blue-100/60 text-sm mb-1",children:["Leggi le ",d.jsx("strong",{className:"text-white/90",children:"Linee Guida"})," in alto sotto Documenti"]}),d.jsxs("p",{className:"text-center text-blue-100/60 text-sm mb-10",children:["Leggi la ",d.jsx("strong",{className:"text-white/90",children:"Guida alla Registrazione"})," nel 2° banner"]}),d.jsx("p",{className:"text-center text-white text-xl sm:text-2xl font-extrabold tracking-wide mb-1",children:"ISCRIVITI GRATUITAMENTE"}),d.jsx("p",{className:"text-center text-emerald-300 text-sm font-semibold mb-10",children:"Ricevi il Bonus di Benvenuto in Crediti CEI"}),d.jsxs("div",{className:"flex items-center justify-center gap-4 mb-5",children:[d.jsx("div",{className:"h-px flex-1 max-w-[50px]",style:{background:"linear-gradient(90deg, transparent, rgba(255,255,255,0.25))"}}),d.jsx("p",{className:"text-white/90 text-sm font-bold tracking-[0.15em] uppercase",children:"Cosa puoi fare"}),d.jsx("div",{className:"h-px flex-1 max-w-[50px]",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.25), transparent)"}})]}),d.jsxs("div",{className:"max-w-md mx-auto space-y-2.5 mb-10",children:[d.jsx(Pp,{text:"Pubblicare annunci"}),d.jsx(Pp,{text:"Navigare gli annunci degli associati"}),d.jsx(Pp,{text:"Richiedere servizi di volontariato"}),d.jsx(Pp,{text:"Rispondere a richieste di volontariato"}),d.jsx(Pp,{text:"Guadagnare Crediti CEI in vari modi"}),d.jsx(Pp,{text:"Usare i Crediti CEI per almeno il 20% dei tuoi acquisti"}),d.jsx(Pp,{text:"Usare la messaggistica interna"}),d.jsx(Pp,{text:"Scoprire chi c'è intorno a te con la Mappa Utenti"}),d.jsx(Pp,{text:"Presentare i tuoi progetti"})]}),d.jsx("p",{className:"text-center text-xl sm:text-2xl font-black tracking-wide uppercase mb-3",style:{color:"#fbbf24"},children:"Scopri il potere di essere Comunità "}),d.jsx("p",{className:"text-center text-white/80 text-sm font-medium",children:"[email protected]"})]})]})]})})}function Pp({text:t}){return d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:"linear-gradient(135deg, #a5e4ff, #60d9a8)"}}),d.jsx("span",{className:"text-white/85 text-sm font-medium",children:t})]})}const nW=new Intl.DateTimeFormat("it-IT",{weekday:"short",day:"numeric",month:"long",year:"numeric"}),rW=new Intl.DateTimeFormat("it-IT",{hour:"2-digit",minute:"2-digit"});function m8e(){const{toast:t}=ks(),[e,i]=K.useState(null),{data:n=[],isLoading:o,isError:c}=Xn({queryKey:["/api/events"],refetchOnMount:"always",refetchOnWindowFocus:!0}),f=$n({mutationFn:S=>xn("POST",`/api/events/${S}/read`),onSuccess:(S,C)=>{Qi.setQueryData(["/api/events"],I=>I==null?void 0:I.map(N=>N.id===C?{...N,isRead:!0}:N)),Qi.invalidateQueries({queryKey:["/api/events/unread-count"]})},onError:()=>t({title:"Impossibile aggiornare la lettura",variant:"destructive"})}),r=S=>{i(S),S.isRead||f.mutate(S.id)},x=async S=>{if(S.posterUrl)try{const C=await fetch(S.posterUrl,{credentials:"include"});if(!C.ok)throw new Error;const I=await C.blob(),N=I.type==="image/png"?"png":I.type==="image/webp"?"webp":"jpg",D=S.title.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"evento",V=URL.createObjectURL(I),B=document.createElement("a");B.href=V,B.download=`locandina-${D}.${N}`,document.body.appendChild(B),B.click(),B.remove(),URL.revokeObjectURL(V)}catch{t({title:"Download non riuscito",description:"Non è stato possibile scaricare la locandina. Riprova.",variant:"destructive"})}};return d.jsxs("main",{className:"min-h-[100dvh] bg-background",children:[d.jsx("header",{className:"border-b bg-background/90 backdrop-blur-sm",children:d.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-5 py-4",children:[d.jsxs(yr,{href:"/",className:"flex items-center gap-3 text-sm font-semibold tracking-wide text-primary",children:[d.jsx("img",{src:cf,alt:"CEI",className:"h-10 w-10"}),"CEI Marketplace"]}),d.jsxs(yr,{href:"/",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[d.jsx(Ao,{className:"h-4 w-4"})," Marketplace"]})]})}),d.jsxs("section",{className:"mx-auto max-w-6xl px-5 pb-16 pt-12",children:[d.jsxs("div",{className:"mb-10 max-w-2xl",children:[d.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-xs font-semibold uppercase tracking-[0.18em] text-primary",children:[d.jsx(Vve,{className:"h-3.5 w-3.5"})," Comunità CEI"]}),d.jsx("h1",{className:"text-4xl font-bold tracking-tight md:text-5xl",children:"Eventi della comunità "}),d.jsx("p",{className:"mt-3 text-lg text-muted-foreground",children:"Incontri, iniziative e momenti per stare insieme. Scopri cosa succede vicino a te."})]}),o&&d.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(S=>d.jsx("div",{className:"h-80 animate-pulse rounded-2xl bg-muted"},S))}),c&&d.jsx(Ti,{children:d.jsx(Ji,{className:"py-12 text-center text-muted-foreground",children:"Non è stato possibile caricare gli eventi."})}),!o&&!c&&n.length===0&&d.jsx(Ti,{className:"border-dashed",children:d.jsxs(Ji,{className:"py-16 text-center",children:[d.jsx(Hp,{className:"mx-auto mb-4 h-10 w-10 text-primary/60"}),d.jsx("h2",{className:"text-xl font-semibold",children:"Nessun evento in programma"}),d.jsx("p",{className:"mt-2 text-muted-foreground",children:"Torna presto: qui troverai le prossime iniziative CEI."})]})}),d.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:n.map(S=>d.jsxs(Ti,{onClick:()=>r(S),className:"group cursor-pointer overflow-hidden border-border/70 transition-all duration-300 hover:-translate-y-1 hover:shadow-lg",children:[d.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[S.posterUrl?d.jsx("img",{src:S.posterUrl,alt:S.title,className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.03]"}):d.jsx("div",{className:"flex h-full items-center justify-center bg-primary/10",children:d.jsx(Hp,{className:"h-14 w-14 text-primary/50"})}),!S.isRead&&d.jsx(En,{variant:"destructive",className:"absolute left-4 top-4 shadow-sm",children:"Nuovo"})]}),d.jsxs(Ji,{className:"space-y-3 p-5",children:[d.jsx("h2",{className:"line-clamp-2 text-xl font-semibold leading-tight",children:S.title}),d.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Hp,{className:"h-4 w-4 text-primary"}),nW.format(new Date(S.eventDate))]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Zve,{className:"h-4 w-4 text-primary"}),rW.format(new Date(S.eventDate))]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(fo,{className:"h-4 w-4 text-primary"}),d.jsx("span",{className:"truncate",children:S.location})]})]})]})]},S.id))})]}),d.jsx(ll,{open:!!e,onOpenChange:S=>!S&&i(null),children:d.jsx(Va,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:e&&d.jsxs(d.Fragment,{children:[d.jsxs(cl,{children:[d.jsx($a,{className:"text-2xl",children:e.title}),d.jsx(Oc,{className:"sr-only",children:"Dettagli evento"})]}),d.jsxs("div",{className:"grid gap-6 md:grid-cols-[minmax(0,1fr)_minmax(220px,.8fr)]",children:[e.posterUrl?d.jsx("img",{src:e.posterUrl,alt:e.title,className:"max-h-[520px] w-full rounded-xl object-cover"}):d.jsx("div",{className:"flex min-h-64 items-center justify-center rounded-xl bg-primary/10",children:d.jsx(Hp,{className:"h-16 w-16 text-primary/50"})}),d.jsxs("div",{className:"space-y-5",children:[d.jsxs("div",{className:"rounded-xl bg-muted/60 p-4 text-sm",children:[d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(Hp,{className:"mt-0.5 h-5 w-5 text-primary"}),d.jsxs("div",{children:[d.jsx("p",{className:"font-semibold",children:nW.format(new Date(e.eventDate))}),d.jsx("p",{className:"text-muted-foreground",children:rW.format(new Date(e.eventDate))})]})]}),d.jsxs("div",{className:"mt-4 flex items-start gap-3",children:[d.jsx(fo,{className:"mt-0.5 h-5 w-5 text-primary"}),d.jsx("p",{children:e.location})]})]}),d.jsx("p",{className:"whitespace-pre-wrap leading-relaxed text-muted-foreground",children:e.description}),e.posterUrl&&d.jsxs(tt,{className:"w-full",onClick:()=>x(e),"data-testid":"button-download-event-poster",children:[d.jsx(ZN,{className:"mr-2 h-4 w-4"}),"Scarica locandina"]})]})]})]})})})]})}
3911function g8e(){return d.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-background",children:d.jsx(Ti,{className:"w-full max-w-md mx-4",children:d.jsxs(Ji,{className:"pt-6",children:[d.jsxs("div",{className:"flex mb-4 gap-2 items-center",children:[d.jsx(Jb,{className:"h-8 w-8 text-destructive"}),d.jsx("h1",{className:"text-2xl font-bold",children:"Pagina non trovata"})]}),d.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"La pagina che stai cercando non esiste o è stata spostata."}),d.jsx(tt,{asChild:!0,className:"mt-6 w-full",children:d.jsxs(yr,{href:"/",children:[d.jsx(ixe,{className:"mr-2 h-4 w-4"}),"Torna alla Home"]})})]})})})}function y8e(){const{isAuthenticated:t,privacyAccepted:e,isLoading:i}=Ka();return i||!t||e?null:d.jsx(qwe,{open:!0,onAccepted:()=>{window.location.reload()}})}function _8e(){const[t]=$o();return K.useEffect(()=>{["/dashboard","/profile","/referral","/my-listings","/orders","/messages","/volunteer","/admin","/listings/new","/events"].some(n=>t.startsWith(n))&&Qi.invalidateQueries({queryKey:["/api/auth/user"]})},[t]),null}function v8e(){const{isAuthenticated:t,isLoading:e,isAdmin:i}=Ka(),[n]=$o(),f=(["/dashboard","/profile","/referral","/my-listings","/orders","/messages","/volunteer","/admin","/listings/new","/events"].some(r=>n.startsWith(r))||n.match(/^\/listings\/[^/]+\/edit$/))&&!t&&!e;return d.jsxs(a_e,{children:[d.jsx(xr,{path:"/",component:G2e}),d.jsx(xr,{path:"/map",component:Y2e}),d.jsx(xr,{path:"/chi-siamo",component:Iq}),d.jsx(xr,{path:"/about",component:Iq}),d.jsx(xr,{path:"/faq",component:kq}),d.jsx(xr,{path:"/domande-frequenti",component:kq}),d.jsx(xr,{path:"/guida-registrazione",component:Q7}),d.jsx(xr,{path:"/registration-guide",component:Q7}),d.jsx(xr,{path:"/store/:userId",component:r8e}),d.jsx(xr,{path:"/user/:userId",component:s8e}),d.jsx(xr,{path:"/privacy",component:J7}),d.jsx(xr,{path:"/privacy-policy",component:J7}),d.jsx(xr,{path:"/documents",component:tW}),d.jsx(xr,{path:"/documenti",component:tW}),d.jsx(xr,{path:"/locandina",component:f8e}),e||f?d.jsxs(d.Fragment,{children:[d.jsx(xr,{path:"/profile",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/dashboard",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/referral",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/my-listings",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/orders",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/messages",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/messages/:userId",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/listings/new",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/listings/:id/edit",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/volunteer",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/volunteer/my-applications",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/volunteer/my-requests",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/admin",children:()=>d.jsx(Ec,{})}),d.jsx(xr,{path:"/events",children:()=>d.jsx(Ec,{})})]}):t?d.jsxs(d.Fragment,{children:[d.jsx(xr,{path:"/profile",component:x$e}),d.jsx(xr,{path:"/dashboard",component:Q6e}),d.jsx(xr,{path:"/referral",component:b$e}),d.jsx(xr,{path:"/my-listings",component:_Ue}),d.jsx(xr,{path:"/orders",component:jVe}),d.jsx(xr,{path:"/messages",component:$7}),d.jsx(xr,{path:"/messages/:userId",component:$7}),d.jsx(xr,{path:"/listings/new",component:j7}),d.jsx(xr,{path:"/listings/:id/edit",component:j7}),d.jsx(xr,{path:"/volunteer",component:w$e}),d.jsx(xr,{path:"/volunteer/my-applications",component:t8e}),d.jsx(xr,{path:"/volunteer/my-requests",component:n8e}),i&&d.jsx(xr,{path:"/admin",component:v$e}),d.jsx(xr,{path:"/events",component:m8e})]}):null,d.jsx(xr,{path:"/listings/:id",component:$Ae}),d.jsx(xr,{component:g8e})]})}function Ec(){return d.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:d.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Caricamento..."})})}function x8e(){return d.jsx(A_e,{client:Qi,children:d.jsxs(Cbe,{children:[d.jsx(e0e,{}),d.jsx(_8e,{}),d.jsx(y8e,{}),d.jsx(v8e,{})]})})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").then(t=>{console.log("SW registered:",t.scope)}).catch(t=>{console.log("SW registration failed:",t)})});yQ(document.getElementById("root")).render(d.jsx(x8e,{}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.